[Lldb-commits] [PATCH] [lldb] Add @skipIfAddressSanitizerUnsupported test decorator

Ed Maste emaste at freebsd.org
Fri Nov 14 11:28:45 PST 2014


================
Comment at: functionalities/asan/TestMemoryHistory.py:23
@@ -26,3 +22,3 @@
 
     @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
     @skipIfRemote
----------------
remove this

================
Comment at: functionalities/asan/TestReportData.py:24
@@ -27,3 +23,3 @@
 
     @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
     @skipIfRemote
----------------
remove this

================
Comment at: lldbtest.py:672-687
@@ -671,2 +671,18 @@
 
+def skipIfAddressSanitizerUnsupported(func):
+    """
+    Decorate the item to skip tests that should skipped when the compiler we're using doesn't
+    support compiling with AddressSanitizer.
+    """
+    if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+        raise Exception("@skipIfAddressSanitizerUnsupported can only be used to decorate a test method")
+    @wraps(func)
+    def wrapper(*args, **kwargs):
+        from unittest2 import case
+        self = args[0]
+        if not self.compilerSupportsAddressSanitizer():
+            self.skipTest("skipping because compiler doesn't support AddressSanitizer")
+        else:
+            func(*args, **kwargs)
+    return wrapper
 
----------------
Can we change this to the way expectedFail is now done, i.e. add a `skipIf(skip_fn)`, and then implement asan unsupported as something like

```
def skipIfAddressSanitizerUnsupported():
    def fn(self):
        return self.compilerSupportsAddressSanitizer()
    return skipIf(fn)
````

with the intent of moving the other skipIf conditions over later too

http://reviews.llvm.org/D6272






More information about the lldb-commits mailing list