[Lldb-commits] [PATCH] Skip AsanTestCase and AsanTestReportDataCase on Darwin

Ilia K ki.stfu at gmail.com
Wed Mar 11 06:27:34 PDT 2015


Add @skipUnlessCompilerRt decorator


http://reviews.llvm.org/D7958

Files:
  test/functionalities/asan/TestMemoryHistory.py
  test/functionalities/asan/TestReportData.py
  test/lldbtest.py

Index: test/functionalities/asan/TestMemoryHistory.py
===================================================================
--- test/functionalities/asan/TestMemoryHistory.py
+++ test/functionalities/asan/TestMemoryHistory.py
@@ -16,18 +16,20 @@
     # 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)
Index: test/functionalities/asan/TestReportData.py
===================================================================
--- test/functionalities/asan/TestReportData.py
+++ test/functionalities/asan/TestReportData.py
@@ -17,18 +17,20 @@
     # 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)
Index: test/lldbtest.py
===================================================================
--- test/lldbtest.py
+++ test/lldbtest.py
@@ -772,6 +772,21 @@
             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."""
@@ -1526,6 +1541,11 @@
             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"]

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7958.21696.patch
Type: text/x-patch
Size: 3917 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150311/aa646bdf/attachment.bin>


More information about the lldb-commits mailing list