[Lldb-commits] [PATCH] D109336: [lldb] Skip TestAppleSimulatorOSType if json parsing fails
Augusto Noronha via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Sep 6 13:07:29 PDT 2021
augusto2112 created this revision.
augusto2112 added reviewers: teemperor, aprantl.
augusto2112 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
xcodebuild, which is invoked by the apple_simulator_test decorator, may
may return a successful status even if it was unable to run due to the
authorization agent denying it. This causes the TestAppleSimulatorOSType
to run when it shouldn't, and throw an excpection when parsing the JSON
that lists the simulators available. Wrap the json parsing in a
try/except block and if it fails, skip the ttest.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D109336
Files:
lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py
Index: lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py
===================================================================
--- lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py
+++ lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py
@@ -20,7 +20,16 @@
cmd = ['xcrun', 'simctl', 'list', '-j', 'devices']
self.trace(' '.join(cmd))
sim_devices_str = subprocess.check_output(cmd).decode("utf-8")
- sim_devices = json.loads(sim_devices_str)['devices']
+
+ # xcodebuild, which is invoked by the apple_simulator_test decorator,
+ # may return a successful status even if it was unable to run due to
+ # the authorization agent denying it. Try to parse the json that lists
+ # the simulators but if that fails skip the test.
+ try:
+ sim_devices = json.loads(sim_devices_str)['devices']
+ except json.decoder.JSONDecodeError:
+ self.skipTest("Could not parse JSON of simulators available")
+
# Find an available simulator for the requested platform
deviceUDID = None
deviceRuntime = None
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109336.370966.patch
Type: text/x-patch
Size: 1137 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210906/e86bbf6e/attachment.bin>
More information about the lldb-commits
mailing list