Author: cbieneman Date: Thu Nov 10 13:16:17 2016 New Revision: 286490 URL: http://llvm.org/viewvc/llvm-project?rev=286490&view=rev Log: [Test-Suite] Fix all the sanitizer tests to be based on compiler capabilities
Summary: This patch reworks all the @skip... lines for sanitizer libraries to be based on whether or not the compiler actually works, rather than whether or not the compiler-rt sources are present in some magically derived directory. Reviewers: lldb-commits Subscribers: kubabrecka, tfiala Differential Revision: https://reviews.llvm.org/D26513 Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/TestTsanCPPGlobalLocation.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/global_location/TestTsanGlobalLocation.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=286490&r1=286489&r2=286490&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Thu Nov 10 13:16:17 2016 @@ -656,31 +656,6 @@ def skipIfTargetAndroid(api_levels=None, archs)) -def skipUnlessCompilerRt(func): - """Decorate the item to skip tests if testing remotely.""" - def is_compiler_rt_missing(): - compilerRtPath = os.path.join( - os.environ["LLDB_SRC"], - "..", - "..", - "..", - "llvm", - "projects", - "compiler-rt") - if not os.path.exists(compilerRtPath): - compilerRtPath = os.path.join( - os.environ["LLDB_SRC"], - "..", - "..", - "..", - "llvm", - "runtimes", - "compiler-rt") - 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.""" @@ -701,3 +676,19 @@ def skipUnlessThreadSanitizer(func): return "Compiler cannot compile with -fsanitize=thread" return None return skipTestIfFn(is_compiler_clang_with_thread_sanitizer)(func) + +def skipUnlessAddressSanitizer(func): + """Decorate the item to skip test unless Clang -fsanitize=thread is supported.""" + + def is_compiler_with_address_sanitizer(self): + compiler_path = self.getCompiler() + compiler = os.path.basename(compiler_path) + f = tempfile.NamedTemporaryFile() + cmd = "echo 'int main() {}' | %s -x c -o %s -" % (compiler_path, f.name) + if os.popen(cmd).close() is not None: + return None # The compiler cannot compile at all, let's *not* skip the test + cmd = "echo 'int main() {}' | %s -fsanitize=address -x c -o %s -" % (compiler_path, f.name) + if os.popen(cmd).close() is not None: + return "Compiler cannot compile with -fsanitize=address" + return None + return skipTestIfFn(is_compiler_with_address_sanitizer)(func) Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py?rev=286490&r1=286489&r2=286490&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py Thu Nov 10 13:16:17 2016 @@ -23,7 +23,7 @@ class AsanTestCase(TestBase): bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)") @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default @skipIfRemote - @skipUnlessCompilerRt + @skipUnlessAddressSanitizer def test(self): self.build() self.asan_tests() Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py?rev=286490&r1=286489&r2=286490&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py Thu Nov 10 13:16:17 2016 @@ -23,7 +23,7 @@ class AsanTestReportDataCase(TestBase): bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)") @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default @skipIfRemote - @skipUnlessCompilerRt + @skipUnlessAddressSanitizer @expectedFailureAll(archs=['i386'], bugnumber="rdar://28658860") def test(self): self.build() 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=286490&r1=286489&r2=286490&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 Thu Nov 10 13:16:17 2016 @@ -20,7 +20,6 @@ class TsanBasicTestCase(TestBase): bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)") @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default @skipIfRemote - @skipUnlessCompilerRt @skipUnlessThreadSanitizer def test(self): self.build() Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/TestTsanCPPGlobalLocation.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/TestTsanCPPGlobalLocation.py?rev=286490&r1=286489&r2=286490&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/TestTsanCPPGlobalLocation.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/TestTsanCPPGlobalLocation.py Thu Nov 10 13:16:17 2016 @@ -20,7 +20,6 @@ class TsanCPPGlobalLocationTestCase(Test bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)") @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default @skipIfRemote - @skipUnlessCompilerRt @skipUnlessThreadSanitizer def test(self): self.build() Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/global_location/TestTsanGlobalLocation.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/global_location/TestTsanGlobalLocation.py?rev=286490&r1=286489&r2=286490&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/global_location/TestTsanGlobalLocation.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/tsan/global_location/TestTsanGlobalLocation.py Thu Nov 10 13:16:17 2016 @@ -20,7 +20,6 @@ class TsanGlobalLocationTestCase(TestBas bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)") @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default @skipIfRemote - @skipUnlessCompilerRt @skipUnlessThreadSanitizer def test(self): self.build() 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=286490&r1=286489&r2=286490&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 Thu Nov 10 13:16:17 2016 @@ -20,7 +20,6 @@ class TsanMultipleTestCase(TestBase): bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)") @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default @skipIfRemote - @skipUnlessCompilerRt @skipUnlessThreadSanitizer def test(self): self.build() 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=286490&r1=286489&r2=286490&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 Thu Nov 10 13:16:17 2016 @@ -20,7 +20,6 @@ class TsanThreadLeakTestCase(TestBase): bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)") @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default @skipIfRemote - @skipUnlessCompilerRt @skipUnlessThreadSanitizer def test(self): self.build() 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=286490&r1=286489&r2=286490&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 Thu Nov 10 13:16:17 2016 @@ -20,7 +20,6 @@ class TsanThreadNumbersTestCase(TestBase bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)") @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default @skipIfRemote - @skipUnlessCompilerRt @skipUnlessThreadSanitizer def test(self): self.build() _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits