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# Omitted: 13# test2 "\\tmp" doesn't work. 14# test10 'errorformat' is different 15# test49 fails in various ways 16# test97 \{ and \$ are not escaped characters. 17 18SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE4) 19 20TEST_OUTFILES = $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) $(SCRIPTS_GUI) 21DOSTMP = dostmp 22DOSTMP_OUTFILES = $(TEST_OUTFILES:test=dostmp\test) 23DOSTMP_INFILES = $(DOSTMP_OUTFILES:.out=.in) 24 25.SUFFIXES: .in .out .res .vim 26 27nongui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) newtests report 28 29small: nolog report 30 31gui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) newtests report 32 33win32: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) newtests report 34 35# Copy the input files to dostmp, changing the fileformat to dos. 36$(DOSTMP_INFILES): $(*B).in 37 if not exist $(DOSTMP)\NUL md $(DOSTMP) 38 if exist $@ del $@ 39 $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=dos|f $@|wq" $(*B).in 40 41# For each input file dostmp/test99.in run the tests. 42# This moves test99.in to test99.in.bak temporarily. 43$(TEST_OUTFILES): $(DOSTMP)\$(*B).in 44 -@if exist test.out DEL test.out 45 -@if exist $(DOSTMP)\$(*B).out DEL $(DOSTMP)\$(*B).out 46 move $(*B).in $(*B).in.bak > nul 47 copy $(DOSTMP)\$(*B).in $(*B).in > nul 48 copy $(*B).ok test.ok > nul 49 $(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $(*B).in 50 -@if exist test.out MOVE /y test.out $(DOSTMP)\$(*B).out > nul 51 -@if exist $(*B).in.bak move /y $(*B).in.bak $(*B).in > nul 52 -@if exist test.ok del test.ok 53 -@if exist Xdir1 rd /s /q Xdir1 54 -@if exist Xfind rd /s /q Xfind 55 -@if exist XfakeHOME rd /s /q XfakeHOME 56 -@del X* 57 -@if exist viminfo del viminfo 58 $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=unix|f test.out|wq" \ 59 $(DOSTMP)\$(*B).out 60 @diff test.out $*.ok & if errorlevel 1 \ 61 ( move /y test.out $*.failed > nul \ 62 & del $(DOSTMP)\$(*B).out \ 63 & echo $* FAILED >> test.log ) \ 64 else ( move /y test.out $*.out > nul ) 65 66# Must run test1 first to create small.vim. 67# This rule must come after the one that copies the input files to dostmp to 68# allow for running an individual test. 69$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS_RES): $(SCRIPTS_FIRST) 70 71report: 72 @echo "" 73 @echo Test results: 74 @if exist test.log ( type test.log & echo TEST FAILURE & exit /b 1 ) \ 75 else ( echo ALL DONE ) 76 77clean: 78 -del *.out 79 -del *.failed 80 -del *.res 81 -if exist $(DOSTMP) rd /s /q $(DOSTMP) 82 -if exist test.in del test.in 83 -if exist test.ok del test.ok 84 -if exist small.vim del small.vim 85 -if exist tiny.vim del tiny.vim 86 -if exist mbyte.vim del mbyte.vim 87 -if exist mzscheme.vim del mzscheme.vim 88 -if exist Xdir1 rd /s /q Xdir1 89 -if exist Xfind rd /s /q Xfind 90 -if exist XfakeHOME rd /s /q XfakeHOME 91 -del X* 92 -for /d %i in (X*) do @rmdir /s/q %i 93 -if exist viminfo del viminfo 94 -if exist test.log del test.log 95 -if exist messages del messages 96 -if exist benchmark.out del benchmark.out 97 -if exist opt_test.vim del opt_test.vim 98 99nolog: 100 -if exist test.log del test.log 101 -if exist messages del messages 102 103benchmark: 104 bench_re_freeze.out 105 106bench_re_freeze.out: bench_re_freeze.vim 107 -if exist benchmark.out del benchmark.out 108 $(VIMPROG) -u dos.vim $(NO_INITS) $*.in 109 @IF EXIST benchmark.out ( type benchmark.out ) 110 111# New style of tests uses Vim script with assert calls. These are easier 112# to write and a lot easier to read and debug. 113# Limitation: Only works with the +eval feature. 114 115newtests: newtestssilent 116 @if exist messages (findstr "SKIPPED FAILED" messages > nul) && type messages 117 118newtestssilent: $(NEW_TESTS_RES) 119 120.vim.res: 121 @echo $(VIMPROG) > vimcmd 122 $(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 $*.vim 128 @del vimcmd 129 130test_gui_init.res: test_gui_init.vim 131 @echo $(VIMPROG) > vimcmd 132 $(VIMPROG) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $*.vim 133 @del vimcmd 134 135test_options.res test_alot.res: opt_test.vim 136 137opt_test.vim: ../optiondefs.h gen_opt_test.vim 138 $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../optiondefs.h 139