@@ -60,6 +60,9 @@ report:
6060
6161$(SCRIPTS_TINY_OUT ) $(NEW_TESTS_RES ) : $(VIMPROG )
6262
63+ # For $ASAN_OPTIONS and $UBSAN_OPTIONS append the testname to it.
64+ # This assumes $ASAN_OPTIONS contains log_path as last part of the environment variable
65+ # For Github CI, those variables are set in .github/workflows/ci.yml
6366
6467# Execute an individual new style test, e.g.:
6568# make test_largefile
@@ -114,7 +117,11 @@ tinytests: $(SCRIPTS_TINY_OUT)
114117 @# 200 msec is sufficient, but only modern sleep supports a fraction of
115118 @# a second, fall back to a second if it fails.
116119 @-/bin/sh -c " sleep .2 > /dev/null 2>&1 || sleep 1"
117- $(RUN_VIMPROG ) $* .in $(REDIR_TEST_TO_NULL )
120+ if test -n " $$ {ASAN_OPTIONS}" ; then \
121+ ASAN_OPTIONS=" $$ {ASAN_OPTIONS}_$* " UBSAN_OPTIONS=" $$ {UBSAN_OPTIONS}_$* " $(RUN_VIMPROG ) $* .in $(REDIR_TEST_TO_NULL ) ; \
122+ else \
123+ $(RUN_VIMPROG ) $* .in $(REDIR_TEST_TO_NULL ) ; \
124+ fi
118125
119126 @# Check if the test.out file matches test.ok.
120127 @/bin/sh -c "if test -f test.out; then \
@@ -145,38 +152,63 @@ newtestssilent: $(NEW_TESTS_RES)
145152.vim.res :
146153 @echo " $( VIMPROG) " > vimcmd
147154 @echo " $( RUN_VIMTEST) " >> vimcmd
148- $(RUN_VIMTEST ) $(NO_INITS ) -S runtest.vim $* .vim $(REDIR_TEST_TO_NULL )
155+ if test -n " $$ {ASAN_OPTIONS}" ; then \
156+ ASAN_OPTIONS=" $$ {ASAN_OPTIONS}_$* " UBSAN_OPTIONS=" $$ {UBSAN_OPTIONS}_$* " $(RUN_VIMTEST ) $(NO_INITS ) -S runtest.vim $* .vim $(REDIR_TEST_TO_NULL ) ; \
157+ else \
158+ $(RUN_VIMTEST ) $(NO_INITS ) -S runtest.vim $* .vim $(REDIR_TEST_TO_NULL ) ; \
159+ fi
149160 @rm vimcmd
150161
151162test_gui.res : test_gui.vim
152163 @echo " $( VIMPROG) " > vimcmd
153164 @echo " $( RUN_GVIMTEST) " >> vimcmd
154- $(RUN_VIMTEST ) -u NONE $(NO_INITS ) -S runtest.vim $<
165+ if test -n " $$ {ASAN_OPTIONS}" ; then \
166+ ASAN_OPTIONS=" $$ {ASAN_OPTIONS}_$* " UBSAN_OPTIONS=" $$ {UBSAN_OPTIONS}_$* " $(RUN_VIMTEST ) -u NONE $(NO_INITS ) -S runtest.vim $< ; \
167+ else \
168+ $(RUN_VIMTEST ) -u NONE $(NO_INITS ) -S runtest.vim $< ; \
169+ fi
170+
155171 @rm vimcmd
156172
157173test_gui_init.res : test_gui_init.vim
158174 @echo " $( VIMPROG) " > vimcmd
159175 @echo " $( RUN_GVIMTEST_WITH_GVIMRC) " >> vimcmd
160- $(RUN_VIMTEST ) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS ) -S runtest.vim $<
176+ if test -n " $$ {ASAN_OPTIONS}" ; then \
177+ ASAN_OPTIONS=" $$ {ASAN_OPTIONS}_$* " UBSAN_OPTIONS=" $$ {UBSAN_OPTIONS}_$* " $(RUN_VIMTEST ) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS ) -S runtest.vim $< ; \
178+ else \
179+ $(RUN_VIMTEST ) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS ) -S runtest.vim $< ; \
180+ fi
161181 @rm vimcmd
162182
163183GEN_OPT_DEPS = gen_opt_test.vim ../optiondefs.h ../../runtime/doc/options.txt
164184
165185opt_test.vim : $(GEN_OPT_DEPS )
166- $(VIMPROG ) -e -s -u NONE $(NO_INITS ) --nofork --gui-dialog-file guidialog -S $(GEN_OPT_DEPS )
186+ if test -n " $$ {ASAN_OPTIONS}" ; then \
187+ ASAN_OPTIONS=" $$ {ASAN_OPTIONS}_$* " UBSAN_OPTIONS=" $$ {UBSAN_OPTIONS}_$* " $(VIMPROG ) -e -s -u NONE $(NO_INITS ) --nofork --gui-dialog-file guidialog -S $(GEN_OPT_DEPS ) ; \
188+ else \
189+ $(VIMPROG ) -e -s -u NONE $(NO_INITS ) --nofork --gui-dialog-file guidialog -S $(GEN_OPT_DEPS ) ; \
190+ fi
167191 @if test -f test.log; then \
168192 cat test.log; \
169193 exit 1; \
170194 fi
171195
172196test_xxd.res :
173- XXD=$(XXDPROG ) ; export XXD; $(RUN_VIMTEST ) $(NO_INITS ) -S runtest.vim test_xxd.vim
197+ if test -n " $$ {ASAN_OPTIONS}" ; then \
198+ XXD=$(XXDPROG ) ; export XXD; ASAN_OPTIONS=" $$ {ASAN_OPTIONS}_$* " UBSAN_OPTIONS=" $$ {UBSAN_OPTIONS}_$* " $(RUN_VIMTEST ) $(NO_INITS ) -S runtest.vim test_xxd.vim ; \
199+ else \
200+ XXD=$(XXDPROG ) ; export XXD; $(RUN_VIMTEST ) $(NO_INITS ) -S runtest.vim test_xxd.vim ; \
201+ fi
174202
175203test_bench_regexp.res : test_bench_regexp.vim
176204 -rm -rf benchmark.out $(RM_ON_RUN )
177205 @# Sleep a moment to avoid that the xterm title is messed up.
178206 @# 200 msec is sufficient, but only modern sleep supports a fraction of
179207 @# a second, fall back to a second if it fails.
180208 @-/bin/sh -c " sleep .2 > /dev/null 2>&1 || sleep 1"
181- $(RUN_VIMTEST ) $(NO_INITS ) -S runtest.vim $* .vim $(REDIR_TEST_TO_NULL )
209+ if test -n " $$ {ASAN_OPTIONS}" ; then \
210+ ASAN_OPTIONS=" $$ {ASAN_OPTIONS}_$* " UBSAN_OPTIONS=" $$ {UBSAN_OPTIONS}_$* " $(RUN_VIMTEST ) $(NO_INITS ) -S runtest.vim $* .vim $(REDIR_TEST_TO_NULL ) ; \
211+ else \
212+ $(RUN_VIMTEST ) $(NO_INITS ) -S runtest.vim $* .vim $(REDIR_TEST_TO_NULL ) ; \
213+ fi
182214 @/bin/sh -c " if test -f benchmark.out; then cat benchmark.out; fi"
0 commit comments