1# 2# Makefile to run all tests for Vim, on Dos-like machines 3# with sh.exe or zsh.exe in the path or not. 4# 5# Author: Bill McCarthy 6# 7# Requires a set of Unix tools: echo, diff, etc. 8 9ifneq (sh.exe, $(SHELL)) 10DEL = rm -f 11DELDIR = rm -rf 12MV = mv 13CP = cp 14CAT = cat 15DIRSLASH = / 16else 17DEL = del 18DELDIR = rd /s /q 19MV = rename 20CP = copy 21CAT = type 22DIRSLASH = \\ 23endif 24 25VIMPROG = ..$(DIRSLASH)vim 26 27default: vimall 28 29include Make_all.mak 30 31# Omitted: 32# test2 "\\tmp" doesn't work. 33# test10 'errorformat' is different 34# test97 \{ and \$ are not escaped characters 35 36SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE4) $(SCRIPTS_WIN32) 37 38SCRIPTS_BENCH = bench_re_freeze.out 39 40# Must run test1 first to create small.vim. 41$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS_RES): $(SCRIPTS_FIRST) 42 43.SUFFIXES: .in .out .res .vim 44 45vimall: fixff $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) newtests 46 @echo ALL DONE 47 48nongui: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) newtests 49 @echo ALL DONE 50 51benchmark: $(SCRIPTS_BENCH) 52 53small: nolog 54 @echo ALL DONE 55 56gui: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) newtests 57 @echo ALL DONE 58 59win32: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) newtests 60 @echo ALL DONE 61 62# TODO: find a way to avoid changing the distributed files. 63fixff: 64 -$(VIMPROG) -u dos.vim $(NO_INITS) "+argdo set ff=dos|upd" +q *.in *.ok 65 -$(VIMPROG) -u dos.vim $(NO_INITS) "+argdo set ff=unix|upd" +q \ 66 dotest.in 67 68clean: 69 -@if exist *.out $(DEL) *.out 70 -@if exist *.failed $(DEL) *.failed 71 -@if exist *.res $(DEL) *.res 72 -@if exist test.in $(DEL) test.in 73 -@if exist test.ok $(DEL) test.ok 74 -@if exist small.vim $(DEL) small.vim 75 -@if exist tiny.vim $(DEL) tiny.vim 76 -@if exist mbyte.vim $(DEL) mbyte.vim 77 -@if exist mzscheme.vim $(DEL) mzscheme.vim 78 -@if exist Xdir1 $(DELDIR) Xdir1 79 -@if exist Xfind $(DELDIR) Xfind 80 -@if exist XfakeHOME $(DELDIR) XfakeHOME 81 -@if exist X* $(DEL) X* 82 -@if exist viminfo $(DEL) viminfo 83 -@if exist test.log $(DEL) test.log 84 -@if exist messages $(DEL) messages 85 -@if exist opt_test.vim $(DEL) opt_test.vim 86 87test1.out: test1.in 88 -@if exist wrongtermsize $(DEL) wrongtermsize 89 $(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in test1.in 90 -@if exist wrongtermsize ( \ 91 echo Vim window too small- must be 80x25 or larger && exit 1 \ 92 ) 93 -@if exist test.out $(DEL) test.out 94 -@if exist viminfo $(DEL) viminfo 95 96.in.out: 97 -@if exist $*.ok $(CP) $*.ok test.ok 98 $(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $*.in 99 @diff test.out $*.ok 100 -@if exist $*.out $(DEL) $*.out 101 @$(MV) test.out $*.out 102 -@if exist Xdir1 $(DELDIR) Xdir1 103 -@if exist Xfind $(DELDIR) Xfind 104 -@if exist XfakeHOME $(DELDIR) XfakeHOME 105 -@if exist X* $(DEL) X* 106 -@if exist test.ok $(DEL) test.ok 107 -@if exist viminfo $(DEL) viminfo 108 109nolog: 110 -@if exist test.log $(DEL) test.log 111 -@if exist messages $(DEL) messages 112 113bench_re_freeze.out: bench_re_freeze.vim 114 -$(DEL) benchmark.out 115 $(VIMPROG) -u dos.vim $(NO_INITS) $*.in 116 $(CAT) benchmark.out 117 118# New style of tests uses Vim script with assert calls. These are easier 119# to write and a lot easier to read and debug. 120# Limitation: Only works with the +eval feature. 121 122newtests: $(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 $< 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 $< 137 @$(DEL) vimcmd 138 139test_options.res test_alot.res: opt_test.vim 140 141opt_test.vim: ../optiondefs.h gen_opt_test.vim 142 $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../optiondefs.h 143