Makefile (2939B)
1 # Portable Makefile for running syntax tests. 2 3 # To run the test manually: 4 # ../../src/vim -u 'testdir/runtest.vim' --cmd 'breakadd func RunTest' 5 6 # Override this if needed, the default assumes Vim was built in the src dir. 7 #VIMPROG = vim 8 VIMPROG = ../../src/vim 9 10 # "runtime" relative to "runtime/syntax/testdir" 11 VIMRUNTIME = ../.. 12 13 # Uncomment this line to use valgrind for memory leaks and extra warnings. 14 # VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=45 --log-file=valgrind.$* 15 16 # Trace ruler liveness on demand. 17 # VIM_SYNTAX_TEST_LOG = `pwd`/testdir/failed/00-TRACE_LOG 18 19 # ENVVARS = LC_ALL=C VIM_SYNTAX_TEST_LOG="$(VIM_SYNTAX_TEST_LOG)" 20 # ENVVARS = LC_ALL=C LANG=C LANGUAGE=C 21 # Run the syntax tests with a C locale 22 ENVVARS = LC_ALL=C 23 24 RUN_VIMTEST = VIMRUNTIME=$(VIMRUNTIME) $(VALGRIND) $(ENVVARS) ../$(VIMPROG) -f $(GUI_FLAG) 25 26 # Uncomment this line for debugging 27 # DEBUGLOG = --log testlog 28 29 # All initial phony targets; these names may clash with file types. 30 phonies = clean executables test testclean 31 .PHONY: $(phonies) 32 33 # Run the tests that didn't run yet or failed previously. 34 # If a test succeeds a testdir/done/{name} file will be written. 35 # If a test fails a testdir/failed/{name}.dump file will be written. 36 # Progress and error messages can be found in "testdir/messages". 37 # Comment out the "> /dev/null" part to see the in-progress Vim behaviors. 38 test: 39 @# the "vimcmd" file is used by the screendump utils 40 @echo "../$(VIMPROG)" > testdir/vimcmd 41 @echo "$(RUN_VIMTEST)" >> testdir/vimcmd 42 @# Trace ruler liveness on demand. 43 @#mkdir -p testdir/failed 44 @#touch "$(VIM_SYNTAX_TEST_LOG)" 45 VIMRUNTIME=$(VIMRUNTIME) $(ENVVARS) $(VIMPROG) --clean --not-a-term $(DEBUGLOG) -u testdir/runtest.vim > /dev/null 46 @# FIXME: Temporarily show the whole file to find out what goes wrong 47 @#if [ -f testdir/messages ]; then tail -n 6 testdir/messages; fi 48 @if [ -f testdir/messages ]; then cat testdir/messages; fi 49 50 # add dependence on syntax files 51 testdir/testdeps.mk: 52 ./testdir/tools/maketestdeps $(phonies) > $@ 53 54 -include testdir/testdeps.mk 55 56 executables: 57 @! find testdir/input -type f -perm /a+x -exec echo Executable syntax test found: \{\} \; | grep : 58 59 clean testclean: 60 rm -f testdir/failed/* testdir/done/* testdir/vimcmd testdir/messages testdir/Xtestscript testdir/Xfilter testdir/testdeps.mk 61 62 # Collect all input filenames and their file types. 63 testnames != set +f; \ 64 awk 'BEGIN { \ 65 for (i = 1; i < ARGC; i++) { \ 66 split(ARGV[i], names, /\//); \ 67 split(names[3], parts, /[._]/); \ 68 types[parts[1]]; \ 69 print names[3]; \ 70 } \ 71 split("$(phonies)", scratch); \ 72 for (phony in scratch) \ 73 phonies[scratch[phony]]; \ 74 for (type in types) \ 75 print type ((type in phonies) ? "_" : ""); \ 76 }' testdir/input/*.* 77 78 .PHONY: self-testing $(testnames) 79 80 $(testnames):: 81 @echo $@ >> testdir/Xfilter 82 83 self-testing:: $(testnames) 84 @echo self-testing > testdir/Xfilter