blob: 9d1dc4ecc20f119bdd4722456036dc03886d42de [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 Moolenaar2d12c252022-06-13 21:42:45 +010022# Add --gui-dialog-file to avoid getting stuck in a dialog.
23COMMON_ARGS = $(NO_INITS) --gui-dialog-file guidialog
24
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020025nongui: nolog tinytests newtests report
Bram Moolenaar071d4272004-06-13 20:20:40 +000026
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020027gui: nolog tinytests newtests report
Bram Moolenaar071d4272004-06-13 20:20:40 +000028
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020029tiny: nolog tinytests report
Bram Moolenaar071d4272004-06-13 20:20:40 +000030
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020031benchmark: $(SCRIPTS_BENCH)
32
33report:
34 @rem without the +eval feature test_result.log is a copy of test.log
35 @if exist test.log ( copy /y test.log test_result.log > nul ) \
36 else ( echo No failures reported > test_result.log )
Bram Moolenaar2d12c252022-06-13 21:42:45 +010037 $(VIMPROG) -u NONE $(COMMON_ARGS) -S summarize.vim messages
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020038 @echo.
39 @echo Test results:
40 @cmd /c type test_result.log
41 @if exist test.log ( echo TEST FAILURE & exit /b 1 ) \
42 else ( echo ALL DONE )
43
44
45# Execute an individual new style test, e.g.:
46# nmake -f Make_dos.mak test_largefile
47$(NEW_TESTS):
48 -if exist $@.res del $@.res
49 -if exist test.log del test.log
50 -if exist messages del messages
51 @$(MAKE) -nologo -f Make_dos.mak $@.res VIMPROG=$(VIMPROG)
52 @type messages
53 @if exist test.log exit 1
54
55
56# Delete files that may interfere with running tests. This includes some files
57# that may result from working on the tests, not only from running them.
58clean:
Bram Moolenaar16236192020-08-14 23:08:22 +020059 -if exist *.out del *.out
60 -if exist *.failed del *.failed
61 -if exist *.res del *.res
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020062 -if exist $(DOSTMP) rd /s /q $(DOSTMP)
63 -if exist test.in del test.in
64 -if exist test.ok del test.ok
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020065 -if exist Xdir1 rd /s /q Xdir1
66 -if exist Xfind rd /s /q Xfind
67 -if exist XfakeHOME rd /s /q XfakeHOME
Bram Moolenaar16236192020-08-14 23:08:22 +020068 -if exist X* del X*
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020069 -for /d %i in (X*) do @rd /s/q %i
70 -if exist viminfo del viminfo
71 -if exist test.log del test.log
72 -if exist test_result.log del test_result.log
73 -if exist messages del messages
74 -if exist benchmark.out del benchmark.out
75 -if exist opt_test.vim del opt_test.vim
Bram Moolenaar2d12c252022-06-13 21:42:45 +010076 -if exist guidialog del guidialog
77 -if exist guidialogfile del guidialogfile
Bram Moolenaarb96a32e2020-08-13 18:59:55 +020078
79nolog:
80 -if exist test.log del test.log
81 -if exist test_result.log del test_result.log
82 -if exist messages del messages
83
84
85# Tiny tests. Works even without the +eval feature.
86tinytests: $(SCRIPTS_TINY_OUT)
Bram Moolenaar071d4272004-06-13 20:20:40 +000087
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010088# Copy the input files to dostmp, changing the fileformat to dos.
89$(DOSTMP_INFILES): $(*B).in
90 if not exist $(DOSTMP)\NUL md $(DOSTMP)
91 if exist $@ del $@
Bram Moolenaar2d12c252022-06-13 21:42:45 +010092 $(VIMPROG) -u dos.vim $(COMMON_ARGS) "+set ff=dos|f $@|wq" $(*B).in
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010093
94# For each input file dostmp/test99.in run the tests.
95# This moves test99.in to test99.in.bak temporarily.
96$(TEST_OUTFILES): $(DOSTMP)\$(*B).in
97 -@if exist test.out DEL test.out
Bram Moolenaarb27523f2017-03-16 14:04:51 +010098 -@if exist $(DOSTMP)\$(*B).out DEL $(DOSTMP)\$(*B).out
Bram Moolenaar29891c42017-01-06 18:00:12 +010099 move $(*B).in $(*B).in.bak > nul
100 copy $(DOSTMP)\$(*B).in $(*B).in > nul
101 copy $(*B).ok test.ok > nul
Bram Moolenaar2d12c252022-06-13 21:42:45 +0100102 $(VIMPROG) -u dos.vim $(COMMON_ARGS) -s dotest.in $(*B).in
Bram Moolenaar29891c42017-01-06 18:00:12 +0100103 -@if exist test.out MOVE /y test.out $(DOSTMP)\$(*B).out > nul
104 -@if exist $(*B).in.bak move /y $(*B).in.bak $(*B).in > nul
Bram Moolenaar13cf77b2015-02-27 21:11:02 +0100105 -@if exist test.ok del test.ok
106 -@if exist Xdir1 rd /s /q Xdir1
107 -@if exist Xfind rd /s /q Xfind
Bram Moolenaar30fe8862017-07-29 23:01:57 +0200108 -@if exist XfakeHOME rd /s /q XfakeHOME
Bram Moolenaaracf92d22016-01-02 16:00:20 +0100109 -@del X*
Bram Moolenaar13cf77b2015-02-27 21:11:02 +0100110 -@if exist viminfo del viminfo
Bram Moolenaar2d12c252022-06-13 21:42:45 +0100111 $(VIMPROG) -u dos.vim $(COMMON_ARGS) "+set ff=unix|f test.out|wq" \
Bram Moolenaar13cf77b2015-02-27 21:11:02 +0100112 $(DOSTMP)\$(*B).out
113 @diff test.out $*.ok & if errorlevel 1 \
Bram Moolenaar29891c42017-01-06 18:00:12 +0100114 ( move /y test.out $*.failed > nul \
Bram Moolenaar13cf77b2015-02-27 21:11:02 +0100115 & del $(DOSTMP)\$(*B).out \
116 & echo $* FAILED >> test.log ) \
Bram Moolenaar29891c42017-01-06 18:00:12 +0100117 else ( move /y test.out $*.out > nul )
Bram Moolenaarb78b0b02005-01-02 11:32:29 +0000118
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +0100119
120# New style of tests uses Vim script with assert calls. These are easier
121# to write and a lot easier to read and debug.
122# Limitation: Only works with the +eval feature.
123
Bram Moolenaar933bef72018-09-20 21:39:33 +0200124newtests: newtestssilent
Bram Moolenaar6e3aeec2020-08-26 22:29:57 +0200125 @if exist messages type messages
Bram Moolenaar933bef72018-09-20 21:39:33 +0200126
Bram Moolenaarec504012019-01-11 17:30:16 +0100127newtestssilent: $(NEW_TESTS_RES)
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +0100128
129.vim.res:
Bram Moolenaar4635e112017-10-07 21:05:18 +0200130 @echo $(VIMPROG) > vimcmd
Bram Moolenaar2d12c252022-06-13 21:42:45 +0100131 $(VIMPROG) -u NONE $(COMMON_ARGS) -S runtest.vim $*.vim
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100132 @del vimcmd
133
134test_gui.res: test_gui.vim
Bram Moolenaar4635e112017-10-07 21:05:18 +0200135 @echo $(VIMPROG) > vimcmd
Bram Moolenaar2d12c252022-06-13 21:42:45 +0100136 $(VIMPROG) -u NONE $(COMMON_ARGS) -S runtest.vim $*.vim
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100137 @del vimcmd
138
139test_gui_init.res: test_gui_init.vim
Bram Moolenaar4635e112017-10-07 21:05:18 +0200140 @echo $(VIMPROG) > vimcmd
Bram Moolenaar87748452017-03-12 17:10:33 +0100141 $(VIMPROG) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $*.vim
Bram Moolenaar5b4a3762016-08-06 20:36:34 +0200142 @del vimcmd
Bram Moolenaar65408f72017-03-07 21:31:27 +0100143
Bram Moolenaard9b0d832019-09-14 15:46:32 +0200144opt_test.vim: ../optiondefs.h gen_opt_test.vim
145 $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../optiondefs.h
Bram Moolenaarb96a32e2020-08-13 18:59:55 +0200146
147test_bench_regexp.res: test_bench_regexp.vim
148 -if exist benchmark.out del benchmark.out
149 @echo $(VIMPROG) > vimcmd
Bram Moolenaar2d12c252022-06-13 21:42:45 +0100150 $(VIMPROG) -u NONE $(COMMON_ARGS) -S runtest.vim $*.vim
Bram Moolenaarb96a32e2020-08-13 18:59:55 +0200151 @del vimcmd
152 @IF EXIST benchmark.out ( type benchmark.out )