From f80ff56a7d7044940ba85ead49215a1f0fd2af4e Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 2 Oct 2015 07:04:34 -0700 Subject: [PATCH] misc/cgo/testsanitizers: skip test for version of clang before 3.6 I've tested with clang 3.6. The builder is running 3.5, and fails. Fixes #12814. Change-Id: I087fb75c3a24bed7f7fa5e9d7a1444590a316d63 Reviewed-on: https://go-review.googlesource.com/15259 Reviewed-by: Brad Fitzpatrick --- misc/cgo/testsanitizers/test.bash | 16 ++++++++++++++-- 1 file 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 -- 2.51.0