Skip to content

Commit f4b4df3

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 (cherry picked from commit 341ec56)
1 parent d4a4309 commit f4b4df3

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
@@ -551,6 +551,14 @@ def are_sb_headers_missing():
551551
return skipTestIfFn(are_sb_headers_missing)(func)
552552

553553

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

0 commit comments

Comments
 (0)