// -asan option must use a compatible version of ASan library, which requires that
// the gcc version is not less than 7 and the clang version is not less than 9,
// otherwise a segmentation fault will occur.
- if !compilerRequiredAsanVersion() {
- t.Skipf("skipping: too old version of compiler")
+ if !compilerRequiredAsanVersion(goos, goarch) {
+ t.Skipf("skipping on %s/%s: too old version of compiler", goos, goarch)
}
t.Parallel()
}
}
+// compilerRequiredTsanVersion reports whether the compiler is the version required by Tsan.
+// Only restrictions for ppc64le are known; otherwise return true.
+func compilerRequiredTsanVersion(goos, goarch string) bool {
+ compiler, err := compilerVersion()
+ if err != nil {
+ return false
+ }
+ if compiler.name == "gcc" && goarch == "ppc64le" {
+ return compiler.major >= 9
+ }
+ return true
+}
+
// compilerRequiredAsanVersion reports whether the compiler is the version required by Asan.
-func compilerRequiredAsanVersion() bool {
+func compilerRequiredAsanVersion(goos, goarch string) bool {
compiler, err := compilerVersion()
if err != nil {
return false
}
switch compiler.name {
case "gcc":
+ if goarch == "ppc64le" {
+ return compiler.major >= 9
+ }
return compiler.major >= 7
case "clang":
return compiler.major >= 9
t.Logf("skipping %s test on %s/%s; -msan option is not supported.", name, GOOS, GOARCH)
continue
}
+ if tc.sanitizer == "thread" && !compilerRequiredTsanVersion(GOOS, GOARCH) {
+ t.Logf("skipping %s test on %s/%s; compiler version too old for -tsan.", name, GOOS, GOARCH)
+ continue
+ }
+
t.Run(name, func(t *testing.T) {
t.Parallel()
config := configure(tc.sanitizer)
)
func TestTSAN(t *testing.T) {
+ goos, err := goEnv("GOOS")
+ if err != nil {
+ t.Fatal(err)
+ }
+ goarch, err := goEnv("GOARCH")
+ if err != nil {
+ t.Fatal(err)
+ }
+ // The msan tests require support for the -msan option.
+ if !compilerRequiredTsanVersion(goos, goarch) {
+ t.Skipf("skipping on %s/%s; compiler version for -tsan option is too old.", goos, goarch)
+ }
+
t.Parallel()
requireOvercommit(t)
config := configure("thread")