From 26a8e8502b5943cc13177bea48841491dadfef9b Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Thu, 5 Nov 2020 15:32:03 +0100 Subject: [PATCH] [lldb] Add Apple simulator platforms to lldbplatform.py This just adds the simulator platforms to the lldbplatform enumerations and the respective test decorator. The platform names for the simulator are just the SDK names since D85537, so that's why we are not using LLDB's usual platform names here (e.g., SDK = "iphonesimulator" vs LLDB platform ="ios-simulator"). Also removes the duplicate platform enumaration in lldbplatformutil.py. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D89694 --- lldb/packages/Python/lldbsuite/test/decorators.py | 14 ++++++++++---- lldb/packages/Python/lldbsuite/test/lldbplatform.py | 19 ++++++++++++------- .../Python/lldbsuite/test/lldbplatformutil.py | 3 +-- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index 1775c07..358005d 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -551,16 +551,16 @@ def skipIfiOSSimulator(func): return skipTestIfFn(is_ios_simulator)(func) def skipIfiOS(func): - return skipIfPlatform(["ios"])(func) + return skipIfPlatform(lldbplatform.translate(lldbplatform.ios))(func) def skipIftvOS(func): - return skipIfPlatform(["tvos"])(func) + return skipIfPlatform(lldbplatform.translate(lldbplatform.tvos))(func) def skipIfwatchOS(func): - return skipIfPlatform(["watchos"])(func) + return skipIfPlatform(lldbplatform.translate(lldbplatform.watchos))(func) def skipIfbridgeOS(func): - return skipIfPlatform(["bridgeos"])(func) + return skipIfPlatform(lldbplatform.translate(lldbplatform.bridgeos))(func) def skipIfDarwinEmbedded(func): """Decorate the item to skip tests that should be skipped on Darwin armv7/arm64 targets.""" @@ -568,6 +568,12 @@ def skipIfDarwinEmbedded(func): lldbplatform.translate( lldbplatform.darwin_embedded))(func) +def skipIfDarwinSimulator(func): + """Decorate the item to skip tests that should be skipped on Darwin simulator targets.""" + return skipIfPlatform( + lldbplatform.translate( + lldbplatform.darwin_simulator))(func) + def skipIfFreeBSD(func): """Decorate the item to skip tests that should be skipped on FreeBSD.""" return skipIfPlatform(["freebsd"])(func) diff --git a/lldb/packages/Python/lldbsuite/test/lldbplatform.py b/lldb/packages/Python/lldbsuite/test/lldbplatform.py index 365c752..18a4fe5 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbplatform.py +++ b/lldb/packages/Python/lldbsuite/test/lldbplatform.py @@ -11,20 +11,25 @@ import six # LLDB modules import lldb -windows, linux, macosx, darwin, ios, tvos, watchos, bridgeos, darwin_all, darwin_embedded, freebsd, netbsd, bsd_all, android = range( - 14) +windows, linux, macosx, darwin, ios, tvos, watchos, bridgeos, darwin_all, \ + darwin_embedded, darwin_simulator, freebsd, netbsd, bsd_all, android \ + = range(15) + +__darwin_embedded = ["ios", "tvos", "watchos", "bridgeos"] +__darwin_simulators = ["iphonesimulator", "watchsimulator", "appletvsimulator"] __name_lookup = { windows: ["windows"], linux: ["linux"], macosx: ["macosx"], darwin: ["darwin"], - ios: ["ios"], - tvos: ["tvos"], - watchos: ["watchos"], + ios: ["ios", "iphonesimulator"], + tvos: ["tvos", "appletvsimulator"], + watchos: ["watchos", "watchsimulator"], bridgeos: ["bridgeos"], - darwin_all: ["macosx", "darwin", "ios", "tvos", "watchos", "bridgeos"], - darwin_embedded: ["ios", "tvos", "watchos", "bridgeos"], + darwin_all: ["macosx", "darwin"] + __darwin_embedded + __darwin_simulators, + darwin_embedded: __darwin_embedded + __darwin_simulators, + darwin_simulator: __darwin_simulators, freebsd: ["freebsd"], netbsd: ["netbsd"], bsd_all: ["freebsd", "netbsd"], diff --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py index cc21865..3d6402c 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py @@ -124,8 +124,7 @@ def getHostPlatform(): def getDarwinOSTriples(): - return ['darwin', 'macosx', 'ios', 'watchos', 'tvos', 'bridgeos'] - + return lldbplatform.translate(lldbplatform.darwin_all) def getPlatform(): """Returns the target platform which the tests are running on.""" -- 2.7.4