Skip to content

Commit 341ec56

Browse files
committed
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
1 parent 340c376 commit 341ec56

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,14 @@ def are_sb_headers_missing():
552552
return skipTestIfFn(are_sb_headers_missing)(func)
553553

554554

555+
def skipIfRosetta(func, bugnumber=None):
556+
"""Skip a test when running the testsuite on macOS under the Rosetta translation layer."""
557+
def is_running_rosetta(self):
558+
if not lldbplatformutil.getPlatform() in ['darwin', 'macosx']:
559+
return False
560+
return platform.uname()[5] == "arm" and self.getArchitecture() == "x86_64"
561+
return skipTestIfFn(is_running_rosetta, bugnumber)(func)
562+
555563
def skipIfiOSSimulator(func):
556564
"""Decorate the item to skip tests that should be skipped on the iOS Simulator."""
557565
def is_ios_simulator():

0 commit comments

Comments
 (0)