blob: ad4697d723113906cc41999b26293fd0b2e66881 [file] [log] [blame]
Bram Moolenaar68392722010-07-30 22:04:17 +02001#
2# Makefile to run all tests for Vim, on Dos-like machines
Bram Moolenaar34b6cb12008-09-20 14:27:03 +00003# with sh.exe or zsh.exe in the path or not.
4#
5# Author: Bill McCarthy
6#
7# Note that test54 has been removed until it is fixed.
8#
9# Requires a set of Unix tools: echo, diff, etc.
10
11ifneq (sh.exe, $(SHELL))
12DEL = rm -f
Bram Moolenaaracf92d22016-01-02 16:00:20 +010013DELDIR = rm -rf
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000014MV = mv
15CP = cp
Bram Moolenaarfda37292014-11-05 14:27:36 +010016CAT = cat
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000017DIRSLASH = /
18else
19DEL = del
Bram Moolenaaracf92d22016-01-02 16:00:20 +010020DELDIR = rd /s /q
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000021MV = rename
22CP = copy
Bram Moolenaarfda37292014-11-05 14:27:36 +010023CAT = type
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000024DIRSLASH = \\
25endif
26
27VIMPROG = ..$(DIRSLASH)vim
28
Bram Moolenaar40bbcee2015-12-28 22:24:41 +010029default: vimall
30
Bram Moolenaar7b6156f2015-12-28 16:01:26 +010031include Make_all.mak
32
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000033# Omitted:
34# test2 "\\tmp" doesn't work.
35# test10 'errorformat' is different
36# test12 can't unlink a swap file
37# test25 uses symbolic link
Bram Moolenaar7b6156f2015-12-28 16:01:26 +010038# test54 doesn't work yet
39# test97 \{ and \$ are not escaped characters
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000040
Bram Moolenaar7b6156f2015-12-28 16:01:26 +010041SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE4) $(SCRIPTS_WIN32)
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000042
Bram Moolenaarfda37292014-11-05 14:27:36 +010043SCRIPTS_BENCH = bench_re_freeze.out
44
Bram Moolenaara6082432015-12-28 16:26:45 +010045# Must run test1 first to create small.vim.
46$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS): $(SCRIPTS_FIRST)
47
Bram Moolenaar9bd31862016-06-13 22:58:39 +020048.SUFFIXES: .in .out .res .vim
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000049
Bram Moolenaar9bd31862016-06-13 22:58:39 +020050vimall: fixff $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) newtests
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020051 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000052
Bram Moolenaar9bd31862016-06-13 22:58:39 +020053nongui: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) newtests
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020054 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000055
Bram Moolenaarfda37292014-11-05 14:27:36 +010056benchmark: $(SCRIPTS_BENCH)
57
Bram Moolenaar9bd31862016-06-13 22:58:39 +020058small: nolog
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020059 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000060
Bram Moolenaar9bd31862016-06-13 22:58:39 +020061gui: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) newtests
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020062 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000063
Bram Moolenaar9bd31862016-06-13 22:58:39 +020064win32: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) newtests
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020065 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000066
Bram Moolenaar9bd31862016-06-13 22:58:39 +020067# TODO: find a way to avoid changing the distributed files.
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000068fixff:
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +010069 -$(VIMPROG) -u dos.vim $(NO_INITS) "+argdo set ff=dos|upd" +q *.in *.ok
70 -$(VIMPROG) -u dos.vim $(NO_INITS) "+argdo set ff=unix|upd" +q \
Bram Moolenaar3f9ebf32016-11-07 22:13:32 +010071 dotest.in test60.ok test_listchars.ok \
Bram Moolenaar298c6592016-04-02 22:24:20 +020072 test_getcwd.ok test_wordcount.ok
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000073
74clean:
Bram Moolenaar9bd31862016-06-13 22:58:39 +020075 -@if exist *.out $(DEL) *.out
76 -@if exist *.failed $(DEL) *.failed
77 -@if exist *.res $(DEL) *.res
78 -@if exist test.in $(DEL) test.in
79 -@if exist test.ok $(DEL) test.ok
80 -@if exist small.vim $(DEL) small.vim
81 -@if exist tiny.vim $(DEL) tiny.vim
82 -@if exist mbyte.vim $(DEL) mbyte.vim
83 -@if exist mzscheme.vim $(DEL) mzscheme.vim
84 -@if exist lua.vim $(DEL) lua.vim
85 -@if exist Xdir1 $(DELDIR) Xdir1
86 -@if exist Xfind $(DELDIR) Xfind
87 -@if exist X* $(DEL) X*
88 -@if exist viminfo $(DEL) viminfo
89 -@if exist test.log $(DEL) test.log
90 -@if exist messages $(DEL) messages
Bram Moolenaar65408f72017-03-07 21:31:27 +010091 -@if exist opt_test.vim $(DEL) opt_test.vim
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000092
93.in.out:
Bram Moolenaar9bd31862016-06-13 22:58:39 +020094 -@if exist $*.ok $(CP) $*.ok test.ok
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +010095 $(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $*.in
Bram Moolenaar9bd31862016-06-13 22:58:39 +020096 @diff test.out $*.ok
97 -@if exist $*.out $(DEL) $*.out
98 @$(MV) test.out $*.out
99 -@if exist Xdir1 $(DELDIR) Xdir1
100 -@if exist Xfind $(DELDIR) Xfind
101 -@if exist X* $(DEL) X*
102 -@if exist test.ok $(DEL) test.ok
103 -@if exist viminfo $(DEL) viminfo
104
105nolog:
106 -@if exist test.log $(DEL) test.log
107 -@if exist messages $(DEL) messages
Bram Moolenaarfda37292014-11-05 14:27:36 +0100108
109bench_re_freeze.out: bench_re_freeze.vim
110 -$(DEL) benchmark.out
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100111 $(VIMPROG) -u dos.vim $(NO_INITS) $*.in
Bram Moolenaarfda37292014-11-05 14:27:36 +0100112 $(CAT) benchmark.out
Bram Moolenaar9bd31862016-06-13 22:58:39 +0200113
114# New style of tests uses Vim script with assert calls. These are easier
115# to write and a lot easier to read and debug.
116# Limitation: Only works with the +eval feature.
117
118newtests: $(NEW_TESTS)
119
120.vim.res:
Bram Moolenaar5b4a3762016-08-06 20:36:34 +0200121 @echo "$(VIMPROG)" > vimcmd
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100122 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
123 @$(DEL) vimcmd
124
125test_gui.res: test_gui.vim
126 @echo "$(VIMPROG)" > vimcmd
127 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $<
128 @$(DEL) vimcmd
129
130test_gui_init.res: test_gui_init.vim
131 @echo "$(VIMPROG)" > vimcmd
132 $(VIMPROG) -u NONE -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $<
Bram Moolenaar5b4a3762016-08-06 20:36:34 +0200133 @$(DEL) vimcmd
Bram Moolenaar9bd31862016-06-13 22:58:39 +0200134
Bram Moolenaar65408f72017-03-07 21:31:27 +0100135opt_test.vim: ../option.c gen_opt_test.vim
Bram Moolenaarbb962262017-03-08 00:01:35 +0100136 $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../option.c