Author: kuba.brecka Date: Wed Apr 27 10:26:27 2016 New Revision: 267726 URL: http://llvm.org/viewvc/llvm-project?rev=267726&view=rev Log: Decorate TSan tests with "@skipUnlessThreadSanitizer" which skips the tests if the selected compiler can't compile with "-fsanitize=thread".
Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/multiple/TestTsanMultiple.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/decorators.py?rev=267726&r1=267725&r2=267726&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Wed Apr 27 10:26:27 2016 @@ -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): Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py?rev=267726&r1=267725&r2=267726&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py Wed Apr 27 10:26:27 2016 @@ -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 () Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/multiple/TestTsanMultiple.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/multiple/TestTsanMultiple.py?rev=267726&r1=267725&r2=267726&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/multiple/TestTsanMultiple.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/multiple/TestTsanMultiple.py Wed Apr 27 10:26:27 2016 @@ -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 () Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py?rev=267726&r1=267725&r2=267726&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py Wed Apr 27 10:26:27 2016 @@ -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 () Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py?rev=267726&r1=267725&r2=267726&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py Wed Apr 27 10:26:27 2016 @@ -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 () _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits