This revision was automatically updated to reflect the committed changes.
Closed by commit rG47dd1f642846: [lldb] Skip TestAppleSimulatorOSType if json 
parsing fails (authored by augusto2112).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109336/new/

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


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
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
  • [Lldb-commits] [PATCH] D1... Augusto Noronha via Phabricator via lldb-commits
    • [Lldb-commits] [PATC... Augusto Noronha via Phabricator via lldb-commits

Reply via email to