2004-06-13 20:20:40 +00:00
|
|
|
#
|
2007-07-26 20:58:42 +00:00
|
|
|
# Makefile to run all tests for Vim
|
2004-06-13 20:20:40 +00:00
|
|
|
#
|
|
|
|
|
|
2015-12-05 20:56:57 +01:00
|
|
|
# Use console or GUI.
|
2004-06-13 20:20:40 +00:00
|
|
|
VIMPROG = ../vim
|
2018-04-10 19:20:31 +02:00
|
|
|
XXDPROG = ../xxd/xxd
|
2015-12-05 20:56:57 +01:00
|
|
|
# VIMPROG = ../gvim
|
|
|
|
|
|
2014-04-01 14:08:28 +02:00
|
|
|
SCRIPTSOURCE = ../../runtime
|
2004-06-13 20:20:40 +00:00
|
|
|
|
2018-10-07 15:42:07 +02:00
|
|
|
# Comment out this line to see the verbose output of tests.
|
|
|
|
|
#
|
|
|
|
|
# Catches SwapExists to avoid hanging at the ATTENTION prompt.
|
2019-06-06 14:38:06 +02:00
|
|
|
REDIR_TEST_TO_NULL = --cmd 'au SwapExists * let v:swapchoice = "e"' > /dev/null
|
2018-09-21 16:37:25 +02:00
|
|
|
|
2009-06-24 16:08:18 +00:00
|
|
|
# Uncomment this line to use valgrind for memory leaks and extra warnings.
|
|
|
|
|
# The output goes into a file "valgrind.testN"
|
|
|
|
|
# Vim should be compiled with EXITFREE to avoid false warnings.
|
|
|
|
|
# This will make testing about 10 times as slow.
|
2019-02-18 17:40:18 +01:00
|
|
|
# VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=25 --log-file=valgrind.$*
|
2007-08-14 15:29:16 +00:00
|
|
|
|
2015-12-28 22:24:41 +01:00
|
|
|
default: nongui
|
2010-10-20 17:44:42 +02:00
|
|
|
|
2015-12-28 16:01:26 +01:00
|
|
|
# The list of tests is common to all systems.
|
2019-01-11 17:30:16 +01:00
|
|
|
# This defines NEW_TESTS, NEW_TESTS_RES, SCRIPTS_ALL, SCRIPTS_MORE* and
|
|
|
|
|
# SCRIPTS_GUI.
|
2015-12-28 16:01:26 +01:00
|
|
|
include Make_all.mak
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SCRIPTS = $(SCRIPTS_ALL) \
|
|
|
|
|
$(SCRIPTS_MORE1) \
|
|
|
|
|
$(SCRIPTS_MORE2) \
|
|
|
|
|
$(SCRIPTS_MORE4)
|
2004-06-13 20:20:40 +00:00
|
|
|
|
2019-01-11 19:19:44 +01:00
|
|
|
# Explicit dependencies.
|
|
|
|
|
test49.out: test49.vim
|
|
|
|
|
|
|
|
|
|
test_options.res test_alot.res: opt_test.vim
|
|
|
|
|
|
2014-11-05 14:27:36 +01:00
|
|
|
SCRIPTS_BENCH = bench_re_freeze.out
|
|
|
|
|
|
2015-11-29 17:35:35 +01:00
|
|
|
.SUFFIXES: .in .out .res .vim
|
2004-06-13 20:20:40 +00:00
|
|
|
|
2015-12-28 16:26:45 +01:00
|
|
|
nongui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) newtests report
|
2008-09-10 16:26:04 +00:00
|
|
|
|
2015-12-28 16:26:45 +01:00
|
|
|
gui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) newtests report
|
2004-06-13 20:20:40 +00:00
|
|
|
|
2014-11-05 14:27:36 +01:00
|
|
|
benchmark: $(SCRIPTS_BENCH)
|
|
|
|
|
|
2008-09-10 16:26:04 +00:00
|
|
|
report:
|
2019-06-06 14:28:54 +02:00
|
|
|
# without the +eval feature test_result.log is a copy of test.log
|
|
|
|
|
@/bin/sh -c "if test -f test.log; \
|
|
|
|
|
then cp test.log test_result.log; \
|
|
|
|
|
else echo No failures reported > test_result.log; \
|
|
|
|
|
fi"
|
2019-11-05 22:37:20 +01:00
|
|
|
$(VIMPROG) -u NONE $(NO_INITS) -S summarize.vim messages $(REDIR_TEST_TO_NULL)
|
2004-06-13 20:20:40 +00:00
|
|
|
@echo
|
2008-09-10 16:26:04 +00:00
|
|
|
@echo 'Test results:'
|
2019-06-06 13:38:15 +02:00
|
|
|
@cat test_result.log
|
2008-09-10 16:26:04 +00:00
|
|
|
@/bin/sh -c "if test -f test.log; \
|
2019-06-06 13:38:15 +02:00
|
|
|
then echo TEST FAILURE; exit 1; \
|
2008-09-10 16:26:04 +00:00
|
|
|
else echo ALL DONE; \
|
|
|
|
|
fi"
|
2004-06-13 20:20:40 +00:00
|
|
|
|
2019-01-11 17:30:16 +01:00
|
|
|
$(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) $(NEW_TESTS_RES): $(VIMPROG)
|
2015-12-28 16:26:45 +01:00
|
|
|
|
|
|
|
|
# Must run test1 first to create small.vim.
|
2019-01-11 17:30:16 +01:00
|
|
|
$(SCRIPTS) $(SCRIPTS_GUI) $(NEW_TESTS_RES): $(SCRIPTS_FIRST)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Execute an individual new style test, e.g.:
|
|
|
|
|
# make test_largefile
|
|
|
|
|
$(NEW_TESTS):
|
|
|
|
|
rm -f $@.res test.log messages
|
2019-10-19 18:56:58 +02:00
|
|
|
@MAKEFLAGS=--no-print-directory $(MAKE) -f Makefile $@.res
|
|
|
|
|
@cat messages
|
2019-01-11 17:30:16 +01:00
|
|
|
@if test -f test.log; then \
|
2019-06-07 22:40:25 +02:00
|
|
|
exit 1; \
|
2019-01-11 17:30:16 +01:00
|
|
|
fi
|
2004-06-13 20:20:40 +00:00
|
|
|
|
2012-12-05 18:21:32 +01:00
|
|
|
RM_ON_RUN = test.out X* viminfo
|
2018-07-14 21:48:46 +02:00
|
|
|
RM_ON_START = tiny.vim small.vim mbyte.vim mzscheme.vim test.ok benchmark.out
|
2019-07-14 21:54:26 +02:00
|
|
|
RUN_VIM = VIMRUNTIME=$(SCRIPTSOURCE) $(VALGRIND) $(VIMPROG) -f $(GUI_FLAG) -u unix.vim $(NO_INITS) -s dotest.in
|
2012-12-05 18:21:32 +01:00
|
|
|
|
2019-09-14 15:46:32 +02:00
|
|
|
# Delete files that may interfere with running tests. This includes some files
|
|
|
|
|
# that may result from working on the tests, not only from running them.
|
2004-06-13 20:20:40 +00:00
|
|
|
clean:
|
2019-07-05 20:43:52 +02:00
|
|
|
-rm -rf *.out *.failed *.res *.rej *.orig XfakeHOME Xdir1 Xfind
|
2019-06-09 14:39:13 +02:00
|
|
|
-rm -f opt_test.vim test.log test_result.log messages
|
|
|
|
|
-rm -f $(RM_ON_RUN) $(RM_ON_START)
|
|
|
|
|
-rm -f valgrind.*
|
2004-06-13 20:20:40 +00:00
|
|
|
|
|
|
|
|
test1.out: test1.in
|
2013-09-22 15:03:38 +02:00
|
|
|
-rm -rf $*.failed $(RM_ON_RUN) $(RM_ON_START) wrongtermsize
|
2018-09-21 16:37:25 +02:00
|
|
|
$(RUN_VIM) $*.in $(REDIR_TEST_TO_NULL)
|
2014-03-12 15:50:22 +01:00
|
|
|
@/bin/sh -c "if test -f wrongtermsize; \
|
2013-09-22 15:03:38 +02:00
|
|
|
then echo; \
|
|
|
|
|
echo test1 FAILED - terminal size must be 80x24 or larger; \
|
|
|
|
|
echo; exit 1; \
|
|
|
|
|
elif diff test.out $*.ok; \
|
2004-06-13 20:20:40 +00:00
|
|
|
then mv -f test.out $*.out; \
|
|
|
|
|
else echo; \
|
|
|
|
|
echo test1 FAILED - Something basic is wrong; \
|
|
|
|
|
echo; exit 1; fi"
|
|
|
|
|
-rm -rf X* viminfo
|
|
|
|
|
|
|
|
|
|
.in.out:
|
2012-12-05 18:21:32 +01:00
|
|
|
-rm -rf $*.failed test.ok $(RM_ON_RUN)
|
2004-06-13 20:20:40 +00:00
|
|
|
cp $*.ok test.ok
|
2013-04-24 12:56:19 +02:00
|
|
|
# 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"
|
2018-09-21 16:37:25 +02:00
|
|
|
$(RUN_VIM) $*.in $(REDIR_TEST_TO_NULL)
|
2012-12-05 18:21:32 +01:00
|
|
|
|
2016-07-31 14:17:27 +02:00
|
|
|
# For flaky tests retry one time. No tests at the moment.
|
|
|
|
|
#@/bin/sh -c "if test -f test.out -a $* = test61; then \
|
|
|
|
|
# if diff test.out $*.ok; \
|
|
|
|
|
# then echo flaky test ok first time; \
|
|
|
|
|
# else rm -rf $*.failed $(RM_ON_RUN); \
|
|
|
|
|
# $(RUN_VIM) $*.in; \
|
|
|
|
|
# fi \
|
|
|
|
|
# fi"
|
2012-12-05 18:21:32 +01:00
|
|
|
|
|
|
|
|
# Check if the test.out file matches test.ok.
|
2013-05-19 19:40:29 +02:00
|
|
|
@/bin/sh -c "if test -f test.out; then \
|
2005-02-22 08:56:13 +00:00
|
|
|
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; \
|
2004-06-13 20:20:40 +00:00
|
|
|
fi"
|
2013-05-19 19:40:29 +02:00
|
|
|
@/bin/sh -c "if test -f valgrind; then\
|
|
|
|
|
mv -f valgrind valgrind.$*; \
|
|
|
|
|
fi"
|
2012-10-06 19:10:35 +02:00
|
|
|
-rm -rf X* test.ok viminfo
|
2004-06-13 20:20:40 +00:00
|
|
|
|
2014-11-05 14:27:36 +01:00
|
|
|
bench_re_freeze.out: bench_re_freeze.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.
|
|
|
|
|
@-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1"
|
2018-09-21 16:37:25 +02:00
|
|
|
$(RUN_VIM) $*.in $(REDIR_TEST_TO_NULL)
|
2014-11-05 14:27:36 +01:00
|
|
|
@/bin/sh -c "if test -f benchmark.out; then cat benchmark.out; fi"
|
|
|
|
|
|
2004-06-13 20:20:40 +00:00
|
|
|
nolog:
|
2015-12-29 14:26:57 +01:00
|
|
|
-rm -f test.log messages
|
2015-11-29 17:35:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# New style of tests uses Vim script with assert calls. These are easier
|
|
|
|
|
# to write and a lot easier to read and debug.
|
|
|
|
|
# Limitation: Only works with the +eval feature.
|
2019-07-14 21:54:26 +02:00
|
|
|
RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE) $(VALGRIND) $(VIMPROG) -f $(GUI_FLAG) -u unix.vim
|
2015-11-29 17:35:35 +01:00
|
|
|
|
2016-01-06 21:23:56 +01:00
|
|
|
newtests: newtestssilent
|
2018-09-20 21:39:33 +02:00
|
|
|
@/bin/sh -c "if test -f messages && grep -q 'SKIPPED\|FAILED' messages; then cat messages; fi"
|
2016-01-06 21:23:56 +01:00
|
|
|
|
2019-01-11 17:30:16 +01:00
|
|
|
newtestssilent: $(NEW_TESTS_RES)
|
2016-01-06 21:23:56 +01:00
|
|
|
|
2015-11-29 17:35:35 +01:00
|
|
|
|
2019-02-21 21:50:46 +01:00
|
|
|
.vim.res:
|
2017-10-07 20:03:23 +02:00
|
|
|
@echo "$(VIMPROG)" > vimcmd
|
|
|
|
|
@echo "$(RUN_VIMTEST)" >> vimcmd
|
2018-09-21 16:37:25 +02:00
|
|
|
$(RUN_VIMTEST) $(NO_INITS) -S runtest.vim $*.vim $(REDIR_TEST_TO_NULL)
|
2017-02-23 19:32:47 +01:00
|
|
|
@rm vimcmd
|
|
|
|
|
|
|
|
|
|
test_gui.res: test_gui.vim
|
2017-10-07 20:03:23 +02:00
|
|
|
@echo "$(VIMPROG)" > vimcmd
|
|
|
|
|
@echo "$(RUN_GVIMTEST)" >> vimcmd
|
2017-02-23 19:32:47 +01:00
|
|
|
$(RUN_VIMTEST) -u NONE $(NO_INITS) -S runtest.vim $<
|
|
|
|
|
@rm vimcmd
|
|
|
|
|
|
|
|
|
|
test_gui_init.res: test_gui_init.vim
|
2017-10-07 20:03:23 +02:00
|
|
|
@echo "$(VIMPROG)" > vimcmd
|
|
|
|
|
@echo "$(RUN_GVIMTEST_WITH_GVIMRC)" >> vimcmd
|
2017-03-12 17:10:33 +01:00
|
|
|
$(RUN_VIMTEST) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $<
|
2016-08-06 19:01:55 +02:00
|
|
|
@rm vimcmd
|
2017-03-07 21:31:27 +01:00
|
|
|
|
2019-09-14 15:46:32 +02:00
|
|
|
opt_test.vim: ../optiondefs.h gen_opt_test.vim
|
|
|
|
|
$(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../optiondefs.h
|
2018-04-10 19:20:31 +02:00
|
|
|
|
|
|
|
|
test_xxd.res:
|
|
|
|
|
XXD=$(XXDPROG); export XXD; $(RUN_VIMTEST) $(NO_INITS) -S runtest.vim test_xxd.vim
|