From 4ba7adbb906031ffc70504bc83b3f7cf2a2f34cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 4 Oct 2022 11:44:54 +0300 Subject: [PATCH] run-tests: Check for the error messages from ssp routines Since using the ssp routines from mingw-w64 instead of those from GCC's libssp, these messages are included in the piped output of the process, so we can check for the right messages. --- test/Makefile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/Makefile b/test/Makefile index af3c451..bdd9885 100644 --- a/test/Makefile +++ b/test/Makefile @@ -275,10 +275,6 @@ $(TEST_TARGETS): .tested.%$(EXEEXT): %$(EXEEXT) .copied.%$(EXEEXT) $(LOCAL_RUNTI $(DO_RUN)$< $(TOUCH_TARGET) -# GNU libssp writes the error messages directly to the console, and it can't be -# redirected, so we can't check for the presence of those messages. -# grep -q "stack smashing detected" $$OUT || exit 1 -# grep -q "buffer overflow detected" $$OUT || exit 1 $(FAILURE_TEST_TARGETS): .failtested.%$(EXEEXT): %$(EXEEXT) .copied.%$(EXEEXT) $(LOCAL_RUNTIMES) @echo $(DO_RUN)$< trigger; \ OUT=log1-$*; \ @@ -300,8 +296,10 @@ $(FAILURE_TEST_TARGETS): .failtested.%$(EXEEXT): %$(EXEEXT) .copied.%$(EXEEXT) $ grep -q "signed integer overflow" $$OUT || exit 1; \ ;; \ stacksmash) \ + grep -q "stack smashing detected" $$OUT || exit 1; \ ;; \ bufferoverflow-*) \ + grep -q "buffer overflow detected" $$OUT || exit 1; \ ;; \ *) \ echo Unhandled failure test $*; \ @@ -312,7 +310,6 @@ $(FAILURE_TEST_TARGETS): .failtested.%$(EXEEXT): %$(EXEEXT) .copied.%$(EXEEXT) $ fi @touch $@ -# grep -q "buffer overflow detected" $$OUT || exit 1 .customtest1.%$(EXEEXT): %$(EXEEXT) .copied.%$(EXEEXT) $(LOCAL_RUNTIMES) @i=0; while [ $$i -le 10 ]; do \ OUT=log2-$*; \ @@ -327,6 +324,7 @@ $(FAILURE_TEST_TARGETS): .failtested.%$(EXEEXT): %$(EXEEXT) .copied.%$(EXEEXT) $ ret=$$?; \ cat $$OUT; \ echo OK: $* $$i failed expectedly, returned $$ret; \ + grep -q "buffer overflow detected" $$OUT || exit 1; \ rm -f $$OUT; \ fi; \ i=$$(($$i+1)); \