diff options
| -rwxr-xr-x | misc/cgo/testsanitizers/test.bash | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/misc/cgo/testsanitizers/test.bash b/misc/cgo/testsanitizers/test.bash index 5ad303a0cc..44cf529603 100755 --- a/misc/cgo/testsanitizers/test.bash +++ b/misc/cgo/testsanitizers/test.bash @@ -17,6 +17,18 @@ export CC if $CC -fsanitize=memory 2>&1 | grep "unrecognized" >& /dev/null; then echo "skipping msan test: -fsanitize=memory not supported" -else - go run msan.go + exit 0 fi + +# The memory sanitizer in versions of clang before 3.6 don't work with Go. +if $CC --version | grep clang >& /dev/null; then + ver=$($CC --version | sed -e 's/.* version \([0-9.-]*\).*/\1/') + major=$(echo $ver | sed -e 's/\([0-9]*\).*/\1/') + minor=$(echo $ver | sed -e 's/[0-9]*\.\([0-9]*\).*/\1/') + if test $major -lt 3 || test $major -eq 3 -a $minor -lt 6; then + echo "skipping msan test; clang version $major.$minor older than 3.6" + exit 0 + fi +fi + +go run msan.go |
