From f4b4df36a5eb526178131329fcc5d2696f115584 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Mon, 13 Jul 2020 13:09:53 -0700 Subject: [PATCH 1/2] Add a decorator to skip tests when running under Rosetta This allows skipping a test when running the testsuite on macOS under the Rosetta translation layer. Differential Revision: https://reviews.llvm.org/D83600 (cherry picked from commit 341ec564182161861ec4415cdee1f4f3a0527e97) --- lldb/packages/Python/lldbsuite/test/decorators.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index 2e44ee318dac0..abd8fbf77819a 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -551,6 +551,14 @@ def are_sb_headers_missing(): return skipTestIfFn(are_sb_headers_missing)(func) +def skipIfRosetta(func, bugnumber=None): + """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 False + return platform.uname()[5] == "arm" and self.getArchitecture() == "x86_64" + return skipTestIfFn(is_running_rosetta, bugnumber)(func) + def skipIfiOSSimulator(func): """Decorate the item to skip tests that should be skipped on the iOS Simulator.""" def is_ios_simulator(): From a06b3649d9fb0a7c5f06e41fabcfea8e0f172742 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Tue, 14 Jul 2020 18:12:19 -0700 Subject: [PATCH 2/2] Fix the skipIfRosetta decorator the form that takes func as an argument isn't compatible with the optional bugnumber argument. This means that only correct for to use it is now @skipIfRosetta(bugnumber='url') (cherry picked from commit 74c8d01aff80a7371ea2ff16fbe84858a266711a) --- lldb/packages/Python/lldbsuite/test/decorators.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index abd8fbf77819a..36d800b61a95f 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -551,13 +551,15 @@ def are_sb_headers_missing(): return skipTestIfFn(are_sb_headers_missing)(func) -def skipIfRosetta(func, bugnumber=None): +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 False - return platform.uname()[5] == "arm" and self.getArchitecture() == "x86_64" - return skipTestIfFn(is_running_rosetta, bugnumber)(func) + return "not on macOS" + if (platform.uname()[5] == "arm") and (self.getArchitecture() == "x86_64"): + return "skipped under Rosetta" + return None + return skipTestIfFn(is_running_rosetta) def skipIfiOSSimulator(func): """Decorate the item to skip tests that should be skipped on the iOS Simulator."""