blob: 84d6f83dea848de4de5c3d53b358998ee271458f [file] [log] [blame]
Bram Moolenaar46acad72023-06-11 19:04:18 +01001# Portable Makefile for running syntax tests.
2
Christian Brabandt56824432024-02-28 21:24:25 +01003# To run the test manually:
4# ../../src/vim -u 'testdir/runtest.vim' --cmd 'breakadd func RunTest'
5
Bram Moolenaar1aa5f1c2023-06-22 21:57:51 +01006# Override this if needed, the default assumes Vim was build in the src dir.
7#VIMPROG = vim
8VIMPROG = ../../src/vim
Bram Moolenaar46acad72023-06-11 19:04:18 +01009
10# "runtime" relative to "runtime/syntax/testdir"
11VIMRUNTIME = ../..
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# ENVVARS = LC_ALL=C LANG=C LANGUAGE=C
Christian Brabandt627c9502024-02-10 13:02:17 +010017# Run the syntax tests with a C locale
18ENVVARS = LC_ALL=C
Bram Moolenaar46acad72023-06-11 19:04:18 +010019
K.Takatad5b952a2023-06-13 22:44:57 +010020RUN_VIMTEST = VIMRUNTIME=$(VIMRUNTIME) $(VALGRIND) $(ENVVARS) ../$(VIMPROG) -f $(GUI_FLAG)
Bram Moolenaar46acad72023-06-11 19:04:18 +010021
Bram Moolenaar1aa5f1c2023-06-22 21:57:51 +010022# Uncomment this line for debugging
23# DEBUGLOG = --log testlog
24
Bram Moolenaar46acad72023-06-11 19:04:18 +010025# Run the tests that didn't run yet or failed previously.
26# If a test succeeds a testdir/done/{name} file will be written.
27# If a test fails a testdir/failed/{name}.dump file will be written.
Bram Moolenaar1aa5f1c2023-06-22 21:57:51 +010028# Progress and error messages can be found in "testdir/messages".
Yee Cheng Chin58818282025-02-11 20:16:11 +010029# Comment out the "> /dev/null" part to see the in-progress Vim behaviors.
Bram Moolenaar46acad72023-06-11 19:04:18 +010030test:
31 @# the "vimcmd" file is used by the screendump utils
K.Takatad5b952a2023-06-13 22:44:57 +010032 @echo "../$(VIMPROG)" > testdir/vimcmd
Bram Moolenaar46acad72023-06-11 19:04:18 +010033 @echo "$(RUN_VIMTEST)" >> testdir/vimcmd
Yee Cheng Chin58818282025-02-11 20:16:11 +010034 VIMRUNTIME=$(VIMRUNTIME) $(ENVVARS) $(VIMPROG) --clean --not-a-term $(DEBUGLOG) -u testdir/runtest.vim > /dev/null
Aliaksei Budaveiec022942024-10-06 16:57:33 +020035 @rm -f testdir/Xfilter
Bram Moolenaar10c1dbc2023-06-23 19:37:19 +010036 @# FIXME: Temporarily show the whole file to find out what goes wrong
Dominique Pellé99c38492023-09-24 16:09:31 +020037 @#if [ -f testdir/messages ]; then tail -n 6 testdir/messages; fi
38 @if [ -f testdir/messages ]; then cat testdir/messages; fi
Bram Moolenaar46acad72023-06-11 19:04:18 +010039
40
41clean testclean:
Aliaksei Budaveiec022942024-10-06 16:57:33 +020042 rm -f testdir/failed/* testdir/done/* testdir/vimcmd testdir/messages testdir/Xtestscript testdir/Xfilter
43
44# All initial phony targets; these names may clash with file extensions.
45phonies = clean test testclean
46
47# Collect all input filenames and their file extensions.
48testnames != set +f; \
49awk 'BEGIN { \
50 for (i = 1; i < ARGC; i++) { \
51 split(ARGV[i], names, /\//); \
52 split(names[3], parts, /\./); \
53 exts[parts[2]]; \
54 print names[3]; \
55 } \
56 split("$(phonies)", scratch); \
57 for (phony in scratch) \
58 phonies[scratch[phony]]; \
59 for (ext in exts) \
60 print ext ((ext in phonies) ? "_" : ""); \
61}' testdir/input/*.*
62
63.PHONY: self-testing $(testnames)
64
65$(testnames)::
66 @echo $@ >> testdir/Xfilter
67
68self-testing:: $(testnames)
69 @echo self-testing > testdir/Xfilter