diff options
Diffstat (limited to 'src/testdir/Makefile')
-rw-r--r-- | src/testdir/Makefile | 65 |
1 files changed, 37 insertions, 28 deletions
diff --git a/src/testdir/Makefile b/src/testdir/Makefile index 0d51fde3e..42eb7f556 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -12,7 +12,7 @@ SCRIPTSOURCE = ../../runtime # Comment out this line to see the verbose output of tests. # # Catches SwapExists to avoid hanging at the ATTENTION prompt. -REDIR_TEST_TO_NULL = --cmd 'au SwapExists * let v:swapchoice = "e"' > /dev/null +#REDIR_TEST_TO_NULL = --cmd 'au SwapExists * let v:swapchoice = "e"' > /dev/null # Uncomment this line to use valgrind for memory leaks and extra warnings. # The output goes into a file "valgrind.testN" @@ -23,19 +23,19 @@ REDIR_TEST_TO_NULL = --cmd 'au SwapExists * let v:swapchoice = "e"' > /dev/null default: nongui # The list of tests is common to all systems. -# This defines SCRIPTS_FIRST, NEW_TESTS and NEW_TESTS_RES +# This defines SCRIPTS_TINY_OUT, NEW_TESTS and NEW_TESTS_RES. include Make_all.mak # Explicit dependencies. test_options.res test_alot.res: opt_test.vim -SCRIPTS_BENCH = test_bench_regexp.res - .SUFFIXES: .in .out .res .vim -nongui: nolog $(SCRIPTS_FIRST) newtests report +nongui: nolog tinytests newtests report + +gui: nolog tinytests newtests report -gui: nolog $(SCRIPTS_FIRST) newtests report +tiny: nolog tinytests report benchmark: $(SCRIPTS_BENCH) @@ -54,10 +54,7 @@ report: else echo ALL DONE; \ fi" -$(SCRIPTS_FIRST) $(NEW_TESTS_RES): $(VIMPROG) - -# Must run test1 first to create small.vim. -$(NEW_TESTS_RES): $(SCRIPTS_FIRST) +$(SCRIPTS_TINY_OUT) $(NEW_TESTS_RES): $(VIMPROG) # Execute an individual new style test, e.g.: @@ -81,7 +78,7 @@ test_vim9: fi RM_ON_RUN = test.out X* viminfo -RM_ON_START = tiny.vim small.vim mbyte.vim mzscheme.vim test.ok benchmark.out +RM_ON_START = test.ok benchmark.out RUN_VIM = VIMRUNTIME=$(SCRIPTSOURCE) $(VALGRIND) $(VIMPROG) -f $(GUI_FLAG) -u unix.vim $(NO_INITS) -s dotest.in # Delete files that may interfere with running tests. This includes some files @@ -93,22 +90,34 @@ clean: -rm -f valgrind.* -rm -f asan.* -test1.out: test1.in - -rm -rf $*.failed $(RM_ON_RUN) $(RM_ON_START) wrongtermsize +nolog: + -rm -f test.log test_result.log messages + + +# Tiny tests. Works even without the +eval feature. +tinytests: $(SCRIPTS_TINY_OUT) + +.in.out: + -rm -rf $*.failed test.ok $(RM_ON_RUN) + cp $*.ok test.ok + @# Sleep a moment to avoid that the xterm title is messed up. + @# 200 msec is sufficient, but only modern sleep supports a fraction of + @# a second, fall back to a second if it fails. + @-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1" $(RUN_VIM) $*.in $(REDIR_TEST_TO_NULL) - @/bin/sh -c "if test -f wrongtermsize; \ - then echo; \ - echo test1 FAILED - terminal size must be 80x24 or larger; \ - echo; exit 1; \ - elif diff test.out $*.ok; \ - then mv -f test.out $*.out; \ - else echo; \ - echo test1 FAILED - Something basic is wrong; \ - echo; exit 1; fi" - -rm -rf X* viminfo -nolog: - -rm -f test.log messages + @# Check if the test.out file matches test.ok. + @/bin/sh -c "if test -f test.out; then \ + if diff test.out $*.ok; \ + then mv -f test.out $*.out; \ + else echo $* FAILED >>test.log; mv -f test.out $*.failed; \ + fi \ + else echo $* NO OUTPUT >>test.log; \ + fi" + @/bin/sh -c "if test -f valgrind; then\ + mv -f valgrind valgrind.$*; \ + fi" + -rm -rf X* test.ok viminfo # New style of tests uses Vim script with assert calls. These are easier @@ -148,9 +157,9 @@ test_xxd.res: test_bench_regexp.res: test_bench_regexp.vim -rm -rf benchmark.out $(RM_ON_RUN) - # Sleep a moment to avoid that the xterm title is messed up. - # 200 msec is sufficient, but only modern sleep supports a fraction of - # a second, fall back to a second if it fails. + @# Sleep a moment to avoid that the xterm title is messed up. + @# 200 msec is sufficient, but only modern sleep supports a fraction of + @# a second, fall back to a second if it fails. @-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1" $(RUN_VIMTEST) $(NO_INITS) -S runtest.vim $*.vim $(REDIR_TEST_TO_NULL) @/bin/sh -c "if test -f benchmark.out; then cat benchmark.out; fi" |