blob: 89563848ec86666dfc429315232cf099b6d7e9fa [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001#
Bram Moolenaar68392722010-07-30 22:04:17 +02002# Makefile to run all tests for Vim, on Dos-like machines.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003#
4# Requires a set of Unix tools: echo, diff, etc.
5
6VIMPROG = ..\\vim
7
Bram Moolenaar40bbcee2015-12-28 22:24:41 +01008default: nongui
9
Bram Moolenaar7b6156f2015-12-28 16:01:26 +010010!include Make_all.mak
11
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020012# Explicit dependencies.
13test_options.res test_alot.res: opt_test.vim
14
15TEST_OUTFILES = $(SCRIPTS_TINY_OUT)
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010016DOSTMP = dostmp
17DOSTMP_OUTFILES = $(TEST_OUTFILES:test=dostmp\test)
18DOSTMP_INFILES = $(DOSTMP_OUTFILES:.out=.in)
Bram Moolenaar071d4272004-06-13 20:20:40 +000019
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +010020.SUFFIXES: .in .out .res .vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000021
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020022nongui: nolog tinytests newtests report
Bram Moolenaar071d4272004-06-13 20:20:40 +000023
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020024gui: nolog tinytests newtests report
Bram Moolenaar071d4272004-06-13 20:20:40 +000025
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020026tiny: nolog tinytests report
Bram Moolenaar071d4272004-06-13 20:20:40 +000027
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020028benchmark: $(SCRIPTS_BENCH)
29
30report:
31 @rem without the +eval feature test_result.log is a copy of test.log
32 @if exist test.log ( copy /y test.log test_result.log > nul ) \
33 else ( echo No failures reported > test_result.log )
34 $(VIMPROG) -u NONE $(NO_INITS) -S summarize.vim messages
35 @echo.
36 @echo Test results:
37 @cmd /c type test_result.log
38 @if exist test.log ( echo TEST FAILURE & exit /b 1 ) \
39 else ( echo ALL DONE )
40
41
42# Execute an individual new style test, e.g.:
43# nmake -f Make_dos.mak test_largefile
44$(NEW_TESTS):
45 -if exist $@.res del $@.res
46 -if exist test.log del test.log
47 -if exist messages del messages
48 @$(MAKE) -nologo -f Make_dos.mak $@.res VIMPROG=$(VIMPROG)
49 @type messages
50 @if exist test.log exit 1
51
52
53# Delete files that may interfere with running tests. This includes some files
54# that may result from working on the tests, not only from running them.
55clean:
Bram Moolenaar16236192020-08-14 23:08:22 +020056 -if exist *.out del *.out
57 -if exist *.failed del *.failed
58 -if exist *.res del *.res
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020059 -if exist $(DOSTMP) rd /s /q $(DOSTMP)
60 -if exist test.in del test.in
61 -if exist test.ok del test.ok
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020062 -if exist Xdir1 rd /s /q Xdir1
63 -if exist Xfind rd /s /q Xfind
64 -if exist XfakeHOME rd /s /q XfakeHOME
Bram Moolenaar16236192020-08-14 23:08:22 +020065 -if exist X* del X*
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020066 -for /d %i in (X*) do @rd /s/q %i
67 -if exist viminfo del viminfo
68 -if exist test.log del test.log
69 -if exist test_result.log del test_result.log
70 -if exist messages del messages
71 -if exist benchmark.out del benchmark.out
72 -if exist opt_test.vim del opt_test.vim
73
74nolog:
75 -if exist test.log del test.log
76 -if exist test_result.log del test_result.log
77 -if exist messages del messages
78
79
80# Tiny tests. Works even without the +eval feature.
81tinytests: $(SCRIPTS_TINY_OUT)
Bram Moolenaar071d4272004-06-13 20:20:40 +000082
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010083# Copy the input files to dostmp, changing the fileformat to dos.
84$(DOSTMP_INFILES): $(*B).in
85 if not exist $(DOSTMP)\NUL md $(DOSTMP)
86 if exist $@ del $@
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +010087 $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=dos|f $@|wq" $(*B).in
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010088
89# For each input file dostmp/test99.in run the tests.
90# This moves test99.in to test99.in.bak temporarily.
91$(TEST_OUTFILES): $(DOSTMP)\$(*B).in
92 -@if exist test.out DEL test.out
Bram Moolenaarb27523f2017-03-16 14:04:51 +010093 -@if exist $(DOSTMP)\$(*B).out DEL $(DOSTMP)\$(*B).out
Bram Moolenaar29891c42017-01-06 18:00:12 +010094 move $(*B).in $(*B).in.bak > nul
95 copy $(DOSTMP)\$(*B).in $(*B).in > nul
96 copy $(*B).ok test.ok > nul
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +010097 $(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $(*B).in
Bram Moolenaar29891c42017-01-06 18:00:12 +010098 -@if exist test.out MOVE /y test.out $(DOSTMP)\$(*B).out > nul
99 -@if exist $(*B).in.bak move /y $(*B).in.bak $(*B).in > nul
Bram Moolenaar13cf77b2015-02-27 21:11:02 +0100100 -@if exist test.ok del test.ok
101 -@if exist Xdir1 rd /s /q Xdir1
102 -@if exist Xfind rd /s /q Xfind
Bram Moolenaar30fe8862017-07-29 23:01:57 +0200103 -@if exist XfakeHOME rd /s /q XfakeHOME
Bram Moolenaaracf92d22016-01-02 16:00:20 +0100104 -@del X*
Bram Moolenaar13cf77b2015-02-27 21:11:02 +0100105 -@if exist viminfo del viminfo
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100106 $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=unix|f test.out|wq" \
Bram Moolenaar13cf77b2015-02-27 21:11:02 +0100107 $(DOSTMP)\$(*B).out
108 @diff test.out $*.ok & if errorlevel 1 \
Bram Moolenaar29891c42017-01-06 18:00:12 +0100109 ( move /y test.out $*.failed > nul \
Bram Moolenaar13cf77b2015-02-27 21:11:02 +0100110 & del $(DOSTMP)\$(*B).out \
111 & echo $* FAILED >> test.log ) \
Bram Moolenaar29891c42017-01-06 18:00:12 +0100112 else ( move /y test.out $*.out > nul )
Bram Moolenaarb78b0b02005-01-02 11:32:29 +0000113
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +0100114
115# New style of tests uses Vim script with assert calls. These are easier
116# to write and a lot easier to read and debug.
117# Limitation: Only works with the +eval feature.
118
Bram Moolenaar933bef72018-09-20 21:39:33 +0200119newtests: newtestssilent
Bram Moolenaar6e3aeec2020-08-26 22:29:57 +0200120 @if exist messages type messages
Bram Moolenaar933bef72018-09-20 21:39:33 +0200121
Bram Moolenaarec504012019-01-11 17:30:16 +0100122newtestssilent: $(NEW_TESTS_RES)
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +0100123
124.vim.res:
Bram Moolenaar4635e112017-10-07 21:05:18 +0200125 @echo $(VIMPROG) > vimcmd
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100126 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
127 @del vimcmd
128
129test_gui.res: test_gui.vim
Bram Moolenaar4635e112017-10-07 21:05:18 +0200130 @echo $(VIMPROG) > vimcmd
Bram Moolenaar10c60292017-02-23 20:17:13 +0100131 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100132 @del vimcmd
133
134test_gui_init.res: test_gui_init.vim
Bram Moolenaar4635e112017-10-07 21:05:18 +0200135 @echo $(VIMPROG) > vimcmd
Bram Moolenaar87748452017-03-12 17:10:33 +0100136 $(VIMPROG) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $*.vim
Bram Moolenaar5b4a3762016-08-06 20:36:34 +0200137 @del vimcmd
Bram Moolenaar65408f72017-03-07 21:31:27 +0100138
Bram Moolenaard9b0d832019-09-14 15:46:32 +0200139opt_test.vim: ../optiondefs.h gen_opt_test.vim
140 $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../optiondefs.h
Bram Moolenaarb96a32e2020-08-13 18:59:55 +0200141
142test_bench_regexp.res: test_bench_regexp.vim
143 -if exist benchmark.out del benchmark.out
144 @echo $(VIMPROG) > vimcmd
145 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
146 @del vimcmd
147 @IF EXIST benchmark.out ( type benchmark.out )