]> Cypherpunks repositories - gostls13.git/commitdiff
misc/cgo/testsanitizers: fix test of whether compiler option works
authorIan Lance Taylor <iant@golang.org>
Tue, 3 Nov 2015 15:14:22 +0000 (07:14 -0800)
committerIan Lance Taylor <iant@golang.org>
Tue, 3 Nov 2015 23:35:28 +0000 (23:35 +0000)
On older versions of GCC we need to pass a file name before GCC will
report an unrecognized option.

Fixes #13065.

Change-Id: I7ed34c01a006966a446059025f7d10235c649072
Reviewed-on: https://go-review.googlesource.com/16589
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
misc/cgo/testsanitizers/test.bash

index cc50d386e33bbfe4ef22bc724499fda2c2f53e81..88c54e61732b6e6d3bc9b6071fe6dd073e115c2e 100755 (executable)
@@ -15,10 +15,14 @@ if test "$(type -p clang)" != ""; then
 fi
 export CC
 
-if $CC -fsanitize=memory 2>&1 | grep "unrecognized" >& /dev/null; then
+TMPDIR=${TMPDIR:-/tmp}
+echo > ${TMPDIR}/testsanitizers$$.c
+if $CC -fsanitize=memory -c ${TMPDIR}/testsanitizers$$.c 2>&1 | grep "unrecognized" >& /dev/null; then
   echo "skipping msan test: -fsanitize=memory not supported"
+  rm -f ${TMPDIR}/testsanitizers$$.*
   exit 0
 fi
+rm -f ${TMPDIR}/testsanitizers$$.*
 
 # The memory sanitizer in versions of clang before 3.6 don't work with Go.
 if $CC --version | grep clang >& /dev/null; then