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_PLUGIN) "+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 move $(*B).in $(*B).in.bak 48 copy $(DOSTMP)\$(*B).in $(*B).in 49 copy $(*B).ok test.ok 50 $(VIMPROG) -u dos.vim $(NO_PLUGIN) -s dotest.in $(*B).in 51 -@if exist test.out MOVE /y test.out $(DOSTMP)\$(*B).out 52 -@if exist $(*B).in.bak move /y $(*B).in.bak $(*B).in 53 -@if exist test.ok del test.ok 54 -@if exist Xdir1 rd /s /q Xdir1 55 -@if exist Xfind rd /s /q Xfind 56 -@del X* 57 -@if exist viminfo del viminfo 58 $(VIMPROG) -u dos.vim $(NO_PLUGIN) "+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 \ 62 & del $(DOSTMP)\$(*B).out \ 63 & echo $* FAILED >> test.log ) \ 64 else ( move /y test.out $*.out ) 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): $(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 lua.vim del lua.vim 89 -if exist Xdir1 rd /s /q Xdir1 90 -if exist Xfind rd /s /q Xfind 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 98nolog: 99 -if exist test.log del test.log 100 -if exist messages del messages 101 102benchmark: 103 bench_re_freeze.out 104 105bench_re_freeze.out: bench_re_freeze.vim 106 -if exist benchmark.out del benchmark.out 107 $(VIMPROG) -u dos.vim $(NO_PLUGIN) $*.in 108 @IF EXIST benchmark.out ( type benchmark.out ) 109 110# New style of tests uses Vim script with assert calls. These are easier 111# to write and a lot easier to read and debug. 112# Limitation: Only works with the +eval feature. 113 114newtests: $(NEW_TESTS) 115 116.vim.res: 117 $(VIMPROG) -u NONE $(NO_PLUGIN) -S runtest.vim $*.vim 118