diff options
author | Ian Lance Taylor <iant@golang.org> | 2016-12-15 16:57:59 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2016-12-16 01:45:03 +0000 |
commit | 115e9cac8033163a6edfdce6b28a9be21475bed5 (patch) | |
tree | c2d7ccf8a04353cbe0451887616715ba3f229358 | |
parent | 29cb72154d3bb3530d8092cc89d35b3ed4f7e9c5 (diff) | |
download | go-115e9cac8033163a6edfdce6b28a9be21475bed5.tar.gz go-115e9cac8033163a6edfdce6b28a9be21475bed5.zip |
misc/cgo/testsanitizer: don't run msan tests if msan doesn't work
Confirm that a trivial executable can build and execute using
-fsanitize=memory.
Fixes #18335 (by skipping the tests when they don't work).
Change-Id: Icb7a276ba7b57ea3ce31be36f74352cc68dc89d5
Reviewed-on: https://go-review.googlesource.com/34505
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-rwxr-xr-x | misc/cgo/testsanitizers/test.bash | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/misc/cgo/testsanitizers/test.bash b/misc/cgo/testsanitizers/test.bash index 9853875c7e..dfc6d3819a 100755 --- a/misc/cgo/testsanitizers/test.bash +++ b/misc/cgo/testsanitizers/test.bash @@ -24,8 +24,14 @@ msan=yes TMPDIR=${TMPDIR:-/tmp} echo 'int main() { return 0; }' > ${TMPDIR}/testsanitizers$$.c -if $CC -fsanitize=memory -c ${TMPDIR}/testsanitizers$$.c -o ${TMPDIR}/testsanitizers$$.o 2>&1 | grep "unrecognized" >& /dev/null; then - echo "skipping msan tests: -fsanitize=memory not supported" +if $CC -fsanitize=memory -o ${TMPDIR}/testsanitizers$$ ${TMPDIR}/testsanitizers$$.c 2>&1 | grep "unrecognized" >& /dev/null; then + echo "skipping msan tests: $CC -fsanitize=memory not supported" + msan=no +elif ! test -x ${TMPDIR}/testsanitizers$$; then + echo "skipping msan tests: $CC -fsanitize-memory did not generate an executable" + msan=no +elif ! ${TMPDIR}/testsanitizers$$ >/dev/null 2>&1; then + echo "skipping msan tests: $CC -fsanitize-memory generates broken executable" msan=no fi rm -f ${TMPDIR}/testsanitizers$$.* |