Author: Jonas Devlieghere Date: 2022-05-24T17:17:26-07:00 New Revision: 436eaf8d32fa8d5db6782f4da30d0b5b7c2690e8
URL: https://github.com/llvm/llvm-project/commit/436eaf8d32fa8d5db6782f4da30d0b5b7c2690e8 DIFF: https://github.com/llvm/llvm-project/commit/436eaf8d32fa8d5db6782f4da30d0b5b7c2690e8.diff LOG: [lldb] Improve TestAppleSimulatorOSType.py error message This was inspired by D109336 which got reverted because we didn't want the test to fail silently. This patch prints a more informative error message when we fail to parse the simctl output while still failing the test. Differential revision: https://reviews.llvm.org/D126217 Added: Modified: lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py Removed: ################################################################################ diff --git a/lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py b/lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py index 31fe282c7d910..840e970410121 100644 --- a/lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py +++ b/lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py @@ -17,9 +17,13 @@ class TestAppleSimulatorOSType(gdbremote_testcase.GdbRemoteTestCaseBase): def check_simulator_ostype(self, sdk, platform_name, arch=platform.machine()): cmd = ['xcrun', 'simctl', 'list', '-j', 'devices'] - self.trace(' '.join(cmd)) + cmd_str = ' '.join(cmd) + self.trace(cmd_str) sim_devices_str = subprocess.check_output(cmd).decode("utf-8") - sim_devices = json.loads(sim_devices_str)['devices'] + try: + sim_devices = json.loads(sim_devices_str)['devices'] + except json.decoder.JSONDecodeError: + self.fail("Could not parse '{}' output. Authorization denied?".format(cmd_str)) # 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