[Lldb-commits] [lldb] r232016 - Skip AsanTestCase and AsanTestReportDataCase on Darwin

Ilia K ki.stfu at gmail.com
Thu Mar 12 00:19:41 PDT 2015


Author: ki.stfu
Date: Thu Mar 12 02:19:41 2015
New Revision: 232016

URL: http://llvm.org/viewvc/llvm-project?rev=232016&view=rev
Log:
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

Modified:
    lldb/trunk/test/functionalities/asan/TestMemoryHistory.py
    lldb/trunk/test/functionalities/asan/TestReportData.py
    lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/functionalities/asan/TestMemoryHistory.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/asan/TestMemoryHistory.py?rev=232016&r1=232015&r2=232016&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/asan/TestMemoryHistory.py (original)
+++ lldb/trunk/test/functionalities/asan/TestMemoryHistory.py Thu Mar 12 02:19:41 2015
@@ -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)

Modified: lldb/trunk/test/functionalities/asan/TestReportData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/asan/TestReportData.py?rev=232016&r1=232015&r2=232016&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/asan/TestReportData.py (original)
+++ lldb/trunk/test/functionalities/asan/TestReportData.py Thu Mar 12 02:19:41 2015
@@ -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)

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=232016&r1=232015&r2=232016&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Thu Mar 12 02:19:41 2015
@@ -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"]
 





More information about the lldb-commits mailing list