Skip to content

Commit ce35ee8

Browse files
committed
patch 9.1.0816: tests: not clear what tests cause asan failures
Problem: tests: not clear what tests cause asan failures Solution: append testname to $ASAN_OPTIONS Mention what test causes ASAN failures by appending the testname to log_path in $ASAN_OPTIONS/$UBSAN_OPTIONS. This assumes 'log_path' is always the last sub-option in $ASAN_OPTIONS. While at it, also make the CI run with `-O0` instead of `-O1` when ASAN is enable since this causes line numbers to disappear. closes: #15927 Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 912fbaf commit ce35ee8

3 files changed

Lines changed: 45 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ jobs:
194194
echo "TEST=unittests"
195195
fi
196196
if ${{ contains(matrix.extra, 'asan') }}; then
197-
echo "SANITIZER_CFLAGS=-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
198-
echo "ASAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/asan"
199-
echo "UBSAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/ubsan"
197+
echo "SANITIZER_CFLAGS=-g -O0 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
198+
echo "ASAN_OPTIONS=print_stacktrace=1:log_path=${LOG_DIR}/asan"
199+
echo "UBSAN_OPTIONS=print_stacktrace=1:log_path=${LOG_DIR}/ubsan"
200200
echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/src/testdir/lsan-suppress.txt"
201201
fi
202202
if ${{ contains(matrix.extra, 'vimtags') }}; then
@@ -304,6 +304,7 @@ jobs:
304304
if: contains(matrix.extra, 'asan') && !cancelled()
305305
run: |
306306
for f in $(grep -lR '#[[:digit:]]* *0x[[:xdigit:]]*' "${LOG_DIR}"); do
307+
echo "$f"
307308
asan_symbolize -l "$f"
308309
false # in order to fail a job
309310
done

src/testdir/Makefile

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

151162
test_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

157173
test_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

163183
GEN_OPT_DEPS = gen_opt_test.vim ../optiondefs.h ../../runtime/doc/options.txt
164184

165185
opt_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

172196
test_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

175203
test_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"

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
816,
707709
/**/
708710
815,
709711
/**/

0 commit comments

Comments
 (0)