[lldb] Fix bug in skipIfRosetta decorator
authorJonas Devlieghere <jonas@devlieghere.com>
Thu, 6 Aug 2020 03:49:29 +0000 (20:49 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Thu, 6 Aug 2020 03:51:07 +0000 (20:51 -0700)
Currently, the skipIfRosetta decorator will skip tests with the message
"not on macOS" on all platforms that are not `darwin` or `macosx`.
Instead, it should only check the platform and architecture when running
on these platforms.

This triggers for example when running the test suite on device.

Differential revision: https://reviews.llvm.org/D85388

lldb/packages/Python/lldbsuite/test/decorators.py

index a472e1c..bdfe6ff 100644 (file)
@@ -538,10 +538,9 @@ def skipIfNoSBHeaders(func):
 def skipIfRosetta(bugnumber):
     """Skip a test when running the testsuite on macOS under the Rosetta translation layer."""
     def is_running_rosetta(self):
-        if not lldbplatformutil.getPlatform() in ['darwin', 'macosx']:
-            return "not on macOS"
-        if (platform.uname()[5] == "arm") and (self.getArchitecture() == "x86_64"):
-            return "skipped under Rosetta"
+        if lldbplatformutil.getPlatform() in ['darwin', 'macosx']:
+            if (platform.uname()[5] == "arm") and (self.getArchitecture() == "x86_64"):
+                return "skipped under Rosetta"
         return None
     return skipTestIfFn(is_running_rosetta)