blob: 7ba6cf778e7c799623974a780dff2985533f2f33 [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:
56 -if exist *.out $(DEL) *.out
57 -if exist *.failed $(DEL) *.failed
58 -if exist *.res $(DEL) *.res
59 -if exist $(DOSTMP) rd /s /q $(DOSTMP)
60 -if exist test.in del test.in
61 -if exist test.ok del test.ok
62 -if exist small.vim del small.vim
63 -if exist tiny.vim del tiny.vim
64 -if exist mbyte.vim del mbyte.vim
65 -if exist mzscheme.vim del mzscheme.vim
66 -if exist Xdir1 rd /s /q Xdir1
67 -if exist Xfind rd /s /q Xfind
68 -if exist XfakeHOME rd /s /q XfakeHOME
69 -if exist X* $(DEL) X*
70 -for /d %i in (X*) do @rd /s/q %i
71 -if exist viminfo del viminfo
72 -if exist test.log del test.log
73 -if exist test_result.log del test_result.log
74 -if exist messages del messages
75 -if exist benchmark.out del benchmark.out
76 -if exist opt_test.vim del opt_test.vim
77
78nolog:
79 -if exist test.log del test.log
80 -if exist test_result.log del test_result.log
81 -if exist messages del messages
82
83
84# Tiny tests. Works even without the +eval feature.
85tinytests: $(SCRIPTS_TINY_OUT)
Bram Moolenaar071d4272004-06-13 20:20:40 +000086
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010087# Copy the input files to dostmp, changing the fileformat to dos.
88$(DOSTMP_INFILES): $(*B).in
89 if not exist $(DOSTMP)\NUL md $(DOSTMP)
90 if exist $@ del $@
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +010091 $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=dos|f $@|wq" $(*B).in
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010092
93# For each input file dostmp/test99.in run the tests.
94# This moves test99.in to test99.in.bak temporarily.
95$(TEST_OUTFILES): $(DOSTMP)\$(*B).in
96 -@if exist test.out DEL test.out
Bram Moolenaarb27523f2017-03-16 14:04:51 +010097 -@if exist $(DOSTMP)\$(*B).out DEL $(DOSTMP)\$(*B).out
Bram Moolenaar29891c42017-01-06 18:00:12 +010098 move $(*B).in $(*B).in.bak > nul
99 copy $(DOSTMP)\$(*B).in $(*B).in > nul
100 copy $(*B).ok test.ok > nul
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100101 $(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $(*B).in
Bram Moolenaar29891c42017-01-06 18:00:12 +0100102 -@if exist test.out MOVE /y test.out $(DOSTMP)\$(*B).out > nul
103 -@if exist $(*B).in.bak move /y $(*B).in.bak $(*B).in > nul
Bram Moolenaar13cf77b2015-02-27 21:11:02 +0100104 -@if exist test.ok del test.ok
105 -@if exist Xdir1 rd /s /q Xdir1
106 -@if exist Xfind rd /s /q Xfind
Bram Moolenaar30fe8862017-07-29 23:01:57 +0200107 -@if exist XfakeHOME rd /s /q XfakeHOME
Bram Moolenaaracf92d22016-01-02 16:00:20 +0100108 -@del X*
Bram Moolenaar13cf77b2015-02-27 21:11:02 +0100109 -@if exist viminfo del viminfo
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100110 $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=unix|f test.out|wq" \
Bram Moolenaar13cf77b2015-02-27 21:11:02 +0100111 $(DOSTMP)\$(*B).out
112 @diff test.out $*.ok & if errorlevel 1 \
Bram Moolenaar29891c42017-01-06 18:00:12 +0100113 ( move /y test.out $*.failed > nul \
Bram Moolenaar13cf77b2015-02-27 21:11:02 +0100114 & del $(DOSTMP)\$(*B).out \
115 & echo $* FAILED >> test.log ) \
Bram Moolenaar29891c42017-01-06 18:00:12 +0100116 else ( move /y test.out $*.out > nul )
Bram Moolenaarb78b0b02005-01-02 11:32:29 +0000117
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +0100118
119# New style of tests uses Vim script with assert calls. These are easier
120# to write and a lot easier to read and debug.
121# Limitation: Only works with the +eval feature.
122
Bram Moolenaar933bef72018-09-20 21:39:33 +0200123newtests: newtestssilent
124 @if exist messages (findstr "SKIPPED FAILED" messages > nul) && type messages
125
Bram Moolenaarec504012019-01-11 17:30:16 +0100126newtestssilent: $(NEW_TESTS_RES)
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +0100127
128.vim.res:
Bram Moolenaar4635e112017-10-07 21:05:18 +0200129 @echo $(VIMPROG) > vimcmd
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100130 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
131 @del vimcmd
132
133test_gui.res: test_gui.vim
Bram Moolenaar4635e112017-10-07 21:05:18 +0200134 @echo $(VIMPROG) > vimcmd
Bram Moolenaar10c60292017-02-23 20:17:13 +0100135 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100136 @del vimcmd
137
138test_gui_init.res: test_gui_init.vim
Bram Moolenaar4635e112017-10-07 21:05:18 +0200139 @echo $(VIMPROG) > vimcmd
Bram Moolenaar87748452017-03-12 17:10:33 +0100140 $(VIMPROG) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $*.vim
Bram Moolenaar5b4a3762016-08-06 20:36:34 +0200141 @del vimcmd
Bram Moolenaar65408f72017-03-07 21:31:27 +0100142
Bram Moolenaard9b0d832019-09-14 15:46:32 +0200143opt_test.vim: ../optiondefs.h gen_opt_test.vim
144 $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../optiondefs.h
Bram Moolenaarb96a32e2020-08-13 18:59:55 +0200145
146test_bench_regexp.res: test_bench_regexp.vim
147 -if exist benchmark.out del benchmark.out
148 @echo $(VIMPROG) > vimcmd
149 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
150 @del vimcmd
151 @IF EXIST benchmark.out ( type benchmark.out )