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): $(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 87.in.out: 88 -@if exist $*.ok $(CP) $*.ok test.ok 89 $(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $*.in 90 @diff test.out $*.ok 91 -@if exist $*.out $(DEL) $*.out 92 @$(MV) test.out $*.out 93 -@if exist Xdir1 $(DELDIR) Xdir1 94 -@if exist Xfind $(DELDIR) Xfind 95 -@if exist XfakeHOME $(DELDIR) XfakeHOME 96 -@if exist X* $(DEL) X* 97 -@if exist test.ok $(DEL) test.ok 98 -@if exist viminfo $(DEL) viminfo 99 100nolog: 101 -@if exist test.log $(DEL) test.log 102 -@if exist messages $(DEL) messages 103 104bench_re_freeze.out: bench_re_freeze.vim 105 -$(DEL) benchmark.out 106 $(VIMPROG) -u dos.vim $(NO_INITS) $*.in 107 $(CAT) benchmark.out 108 109# New style of tests uses Vim script with assert calls. These are easier 110# to write and a lot easier to read and debug. 111# Limitation: Only works with the +eval feature. 112 113newtests: $(NEW_TESTS) 114 115.vim.res: 116 @echo $(VIMPROG) > vimcmd 117 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim 118 @$(DEL) vimcmd 119 120test_gui.res: test_gui.vim 121 @echo $(VIMPROG) > vimcmd 122 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $< 123 @$(DEL) vimcmd 124 125test_gui_init.res: test_gui_init.vim 126 @echo $(VIMPROG) > vimcmd 127 $(VIMPROG) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $< 128 @$(DEL) vimcmd 129 130opt_test.vim: ../option.c gen_opt_test.vim 131 $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../option.c 132