1# 2# Makefile to run all tests for Vim, on Dos-like machines. 3# 4# Requires a set of Unix tools: echo, diff, etc. 5 6VIMPROG = ..\\vim 7 8default: nongui 9 10!include Make_all.mak 11 12# Explicit dependencies. 13test_options.res test_alot.res: opt_test.vim 14 15TEST_OUTFILES = $(SCRIPTS_TINY_OUT) 16DOSTMP = dostmp 17DOSTMP_OUTFILES = $(TEST_OUTFILES:test=dostmp\test) 18DOSTMP_INFILES = $(DOSTMP_OUTFILES:.out=.in) 19 20.SUFFIXES: .in .out .res .vim 21 22nongui: nolog tinytests newtests report 23 24gui: nolog tinytests newtests report 25 26tiny: nolog tinytests report 27 28benchmark: $(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 [email protected] del [email protected] 46 -if exist test.log del test.log 47 -if exist messages del messages 48 @$(MAKE) -nologo -f Make_dos.mak [email protected] 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 Xdir1 rd /s /q Xdir1 63 -if exist Xfind rd /s /q Xfind 64 -if exist XfakeHOME rd /s /q XfakeHOME 65 -if exist X* del X* 66 -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) 82 83# 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 $@ 87 $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=dos|f $@|wq" $(*B).in 88 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 93 -@if exist $(DOSTMP)\$(*B).out DEL $(DOSTMP)\$(*B).out 94 move $(*B).in $(*B).in.bak > nul 95 copy $(DOSTMP)\$(*B).in $(*B).in > nul 96 copy $(*B).ok test.ok > nul 97 $(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $(*B).in 98 -@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 100 -@if exist test.ok del test.ok 101 -@if exist Xdir1 rd /s /q Xdir1 102 -@if exist Xfind rd /s /q Xfind 103 -@if exist XfakeHOME rd /s /q XfakeHOME 104 -@del X* 105 -@if exist viminfo del viminfo 106 $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=unix|f test.out|wq" \ 107 $(DOSTMP)\$(*B).out 108 @diff test.out $*.ok & if errorlevel 1 \ 109 ( move /y test.out $*.failed > nul \ 110 & del $(DOSTMP)\$(*B).out \ 111 & echo $* FAILED >> test.log ) \ 112 else ( move /y test.out $*.out > nul ) 113 114 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 119newtests: newtestssilent 120 @if exist messages type messages 121 122newtestssilent: $(NEW_TESTS_RES) 123 124.vim.res: 125 @echo $(VIMPROG) > vimcmd 126 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim 127 @del vimcmd 128 129test_gui.res: test_gui.vim 130 @echo $(VIMPROG) > vimcmd 131 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim 132 @del vimcmd 133 134test_gui_init.res: test_gui_init.vim 135 @echo $(VIMPROG) > vimcmd 136 $(VIMPROG) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $*.vim 137 @del vimcmd 138 139opt_test.vim: ../optiondefs.h gen_opt_test.vim 140 $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../optiondefs.h 141 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 ) 148