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