summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite
diff options
context:
space:
mode:
authorKuba Brecka <kuba.brecka@gmail.com>2016-04-27 15:26:27 +0000
committerKuba Brecka <kuba.brecka@gmail.com>2016-04-27 15:26:27 +0000
commit3f61a183a81cdc879ea6a435811765ae315846de (patch)
treed8060edc81da0d81ec406e423b12757c9f1bca70 /lldb/packages/Python/lldbsuite
parente5dfb08fcb8040ebd39b2098ca74bc809cf8e914 (diff)
downloadbcm5719-llvm-3f61a183a81cdc879ea6a435811765ae315846de.tar.gz
bcm5719-llvm-3f61a183a81cdc879ea6a435811765ae315846de.zip
Decorate TSan tests with "@skipUnlessThreadSanitizer" which skips the tests if the selected compiler can't compile with "-fsanitize=thread".
llvm-svn: 267726
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
-rw-r--r--lldb/packages/Python/lldbsuite/test/decorators.py18
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py1
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/tsan/multiple/TestTsanMultiple.py1
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py1
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py1
5 files changed, 22 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py
index f5d194f6a46..d33a849ed23 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -7,6 +7,7 @@ from functools import wraps
import os
import re
import sys
+import tempfile
# Third-party modules
import six
@@ -505,6 +506,23 @@ def skipUnlessCompilerRt(func):
return "compiler-rt not found" if not os.path.exists(compilerRtPath) else None
return skipTestIfFn(is_compiler_rt_missing)(func)
+def skipUnlessThreadSanitizer(func):
+ """Decorate the item to skip test unless Clang -fsanitize=thread is supported."""
+ def is_compiler_clang_with_thread_sanitizer(self):
+ compiler_path = self.getCompiler()
+ compiler = os.path.basename(compiler_path)
+ if not compiler.startswith("clang"):
+ return "Test requires clang as compiler"
+ f = tempfile.NamedTemporaryFile()
+ cmd = "echo 'int main() {}' | %s -x c -o %s -" % (compiler_path, f.name)
+ if os.popen(cmd).close() != None:
+ return None # The compiler cannot compile at all, let's *not* skip the test
+ cmd = "echo 'int main() {}' | %s -fsanitize=thread -x c -o %s -" % (compiler_path, f.name)
+ if os.popen(cmd).close() != None:
+ return "Compiler cannot compile with -fsanitize=thread"
+ return None
+ return skipTestIfFn(is_compiler_clang_with_thread_sanitizer)(func)
+
def skipUnlessClangModules():
"""Decorate the item to skip test unless Clang -gmodules flag is supported."""
def is_compiler_clang_with_gmodules(self):
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py b/lldb/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py
index 12cd13b03f3..44fa9cedc86 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py
@@ -17,6 +17,7 @@ class TsanBasicTestCase(TestBase):
@skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
@skipIfRemote
@skipUnlessCompilerRt
+ @skipUnlessThreadSanitizer
def test (self):
self.build ()
self.tsan_tests ()
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/tsan/multiple/TestTsanMultiple.py b/lldb/packages/Python/lldbsuite/test/functionalities/tsan/multiple/TestTsanMultiple.py
index ae36291787a..9878d629c97 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/tsan/multiple/TestTsanMultiple.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/tsan/multiple/TestTsanMultiple.py
@@ -17,6 +17,7 @@ class TsanMultipleTestCase(TestBase):
@skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
@skipIfRemote
@skipUnlessCompilerRt
+ @skipUnlessThreadSanitizer
def test (self):
self.build ()
self.tsan_tests ()
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py b/lldb/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py
index 14a0d03358e..ed620093c1f 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py
@@ -17,6 +17,7 @@ class TsanThreadLeakTestCase(TestBase):
@skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
@skipIfRemote
@skipUnlessCompilerRt
+ @skipUnlessThreadSanitizer
def test (self):
self.build ()
self.tsan_tests ()
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py b/lldb/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py
index 18ebaa08f8a..c7905bcb1c1 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py
@@ -17,6 +17,7 @@ class TsanThreadNumbersTestCase(TestBase):
@skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
@skipIfRemote
@skipUnlessCompilerRt
+ @skipUnlessThreadSanitizer
def test (self):
self.build ()
self.tsan_tests ()
OpenPOWER on IntegriCloud