From d9953052e392d7dfbdf64699271feb02c9cf18a7 Mon Sep 17 00:00:00 2001 From: Ilia K Date: Thu, 12 Mar 2015 07:19:41 +0000 Subject: [PATCH] Skip AsanTestCase and AsanTestReportDataCase on Darwin Summary: This patch skips tests which cause the following error: ``` 1: test_with_dsym (TestMemoryHistory.AsanTestCase) ... os command: make clean ; make MAKE_DSYM=YES ARCH=x86_64 CC="/Users/IliaK/p/llvm/build_ninja/bin/clang" with pid: 9475 stdout: rm -f "a.out" main.o main.d main.d.tmp rm -f -r "a.out.dSYM" /Users/IliaK/p/llvm/build_ninja/bin/clang -fsanitize=address -fsanitize-address-field-padding=1 -g -arch x86_64 -I/Users/IliaK/p/llvm/tools/lldb/test/make/../../include -c -o main.o main.c /Users/IliaK/p/llvm/build_ninja/bin/clang main.o -fsanitize=address -fsanitize-address-field-padding=1 -g -arch x86_64 -I/Users/IliaK/p/llvm/tools/lldb/test/make/../../include -o "a.out" stderr: clang: error: unknown argument: '-fsanitize-address-field-padding=1' clang: error: unsupported argument 'address' to option 'fsanitize=' ld: file not found: /Users/IliaK/p/llvm/build_ninja/bin/../lib/clang/3.7.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib clang-3.7: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [a.out] Error 1 retcode: 2 ERROR os command: make clean with pid: 9521 stdout: rm -f "a.out" main.o main.d main.d.tmp rm -f -r "a.out.dSYM" stderr: retcode: 0 Restore dir to: /Users/IliaK/p/llvm/tools/lldb ====================================================================== ERROR: test_with_dsym (TestMemoryHistory.AsanTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 612, in wrapper func(*args, **kwargs) File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 456, in wrapper return func(self, *args, **kwargs) File "/Users/IliaK/p/llvm/tools/lldb/test/functionalities/asan/TestMemoryHistory.py", line 24, in test_with_dsym self.buildDsym (None, compiler) File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 1496, in buildDsym if not module.buildDsym(self, architecture, compiler, dictionary, clean): File "/Users/IliaK/p/llvm/tools/lldb/test/plugins/builder_darwin.py", line 16, in buildDsym lldbtest.system(commands, sender=sender) File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 370, in system raise CalledProcessError(retcode, cmd) CalledProcessError: Command 'make clean ; make MAKE_DSYM=YES ARCH=x86_64 CC="/Users/IliaK/p/llvm/build_ninja/bin/clang" ' returned non-zero exit status 2 Config=x86_64-clang ---------------------------------------------------------------------- ``` Also this patch fixes findBuiltClang() by looking a clang in the build folder. BTW, another patch was made in October 2014, but it wasn't committed: http://reviews.llvm.org/D6272. Reviewers: abidh, zturner, emaste, jingham, jasonmolenda, granata.enrico, DougSnyder, clayborg Reviewed By: clayborg Subscribers: lldb-commits, DougSnyder, granata.enrico, jasonmolenda, jingham, emaste, zturner, abidh, clayborg Differential Revision: http://reviews.llvm.org/D7958 llvm-svn: 232016 --- lldb/test/functionalities/asan/TestMemoryHistory.py | 10 ++++++---- lldb/test/functionalities/asan/TestReportData.py | 10 ++++++---- lldb/test/lldbtest.py | 20 ++++++++++++++++++++ 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/lldb/test/functionalities/asan/TestMemoryHistory.py b/lldb/test/functionalities/asan/TestMemoryHistory.py index 03c9d0c..c63b70e 100644 --- a/lldb/test/functionalities/asan/TestMemoryHistory.py +++ b/lldb/test/functionalities/asan/TestMemoryHistory.py @@ -16,18 +16,20 @@ class AsanTestCase(TestBase): # may not have the debugging API which was recently added, so we're calling # self.useBuiltClang() to use clang from the llvm-build directory instead - @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") - @skipIfRemote @dsym_test + @skipIfRemote + @skipUnlessCompilerRt + @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") def test_with_dsym (self): compiler = self.findBuiltClang () self.buildDsym (None, compiler) self.asan_tests () + @dwarf_test + @expectedFailureLinux # non-core functionality, need to reenable and fix later (DES 2014.11.07) @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default @skipIfRemote - @expectedFailureLinux # non-core functionality, need to reenable and fix later (DES 2014.11.07) - @dwarf_test + @skipUnlessCompilerRt def test_with_dwarf (self): compiler = self.findBuiltClang () self.buildDwarf (None, compiler) diff --git a/lldb/test/functionalities/asan/TestReportData.py b/lldb/test/functionalities/asan/TestReportData.py index a051f1b..3ec992c 100644 --- a/lldb/test/functionalities/asan/TestReportData.py +++ b/lldb/test/functionalities/asan/TestReportData.py @@ -17,18 +17,20 @@ class AsanTestReportDataCase(TestBase): # may not have the debugging API which was recently added, so we're calling # self.useBuiltClang() to use clang from the llvm-build directory instead - @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") - @skipIfRemote @dsym_test + @skipIfRemote + @skipUnlessCompilerRt + @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") def test_with_dsym (self): compiler = self.findBuiltClang () self.buildDsym (None, compiler) self.asan_tests () + @dwarf_test + @expectedFailureLinux # non-core functionality, need to reenable and fix later (DES 2014.11.07) @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default @skipIfRemote - @expectedFailureLinux # non-core functionality, need to reenable and fix later (DES 2014.11.07) - @dwarf_test + @skipUnlessCompilerRt def test_with_dwarf (self): compiler = self.findBuiltClang () self.buildDwarf (None, compiler) diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py index 3ff8a3b..21b409d 100644 --- a/lldb/test/lldbtest.py +++ b/lldb/test/lldbtest.py @@ -778,6 +778,21 @@ def skipIfi386(func): func(*args, **kwargs) return wrapper +def skipUnlessCompilerRt(func): + """Decorate the item to skip tests if testing remotely.""" + if isinstance(func, type) and issubclass(func, unittest2.TestCase): + raise Exception("@skipUnless can only be used to decorate a test method") + @wraps(func) + def wrapper(*args, **kwargs): + from unittest2 import case + import os.path + compilerRtPath = os.path.join(os.path.dirname(__file__), "..", "..", "..", "projects", "compiler-rt") + if not os.path.exists(compilerRtPath): + self = args[0] + self.skipTest("skip if compiler-rt not found") + else: + func(*args, **kwargs) + return wrapper class _PlatformContext(object): """Value object class which contains platform-specific options.""" @@ -1532,6 +1547,11 @@ class Base(unittest2.TestCase): path = os.path.join(lldb_root_path, p) if os.path.exists(path): return path + + # Tries to find clang at the same folder as the lldb + path = os.path.join(os.path.dirname(self.lldbExec), "clang") + if os.path.exists(path): + return path return os.environ["CC"] -- 2.7.4