From fa7b431b1056ff46bfc2388da34dd54967ef3449 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Mon, 15 May 2023 13:56:41 -0700 Subject: [PATCH 1/2] add try and except --- testing/run_tests.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/testing/run_tests.py b/testing/run_tests.py index daaf6bdb65a91..f24049f2f784e 100755 --- a/testing/run_tests.py +++ b/testing/run_tests.py @@ -774,22 +774,23 @@ def run_objc_tests(ios_variant='ios_debug_sim_unopt', test_filter=None): ] if test_filter is not None: test_command[0] = test_command[0] + ' -only-testing:%s' % test_filter - run_cmd(test_command, cwd=ios_unit_test_dir, shell=True) - - # except: - # The LUCI environment may provide a variable containing a directory path - # for additional output files that will be uploaded to cloud storage. - # Upload the xcresult when the tests fail. - luci_test_outputs_path = os.environ.get('FLUTTER_TEST_OUTPUTS_DIR') - xcresult_bundle = os.path.join( - result_bundle_temp, 'ios_embedding.xcresult' - ) - if luci_test_outputs_path and os.path.exists(xcresult_bundle): - dump_path = os.path.join( - luci_test_outputs_path, 'ios_embedding.xcresult' + try: + run_cmd(test_command, cwd=ios_unit_test_dir, shell=True) + + except: + # The LUCI environment may provide a variable containing a directory path + # for additional output files that will be uploaded to cloud storage. + # Upload the xcresult when the tests fail. + luci_test_outputs_path = os.environ.get('FLUTTER_TEST_OUTPUTS_DIR') + xcresult_bundle = os.path.join( + result_bundle_temp, 'ios_embedding.xcresult' ) - # xcresults contain many little files. Archive the bundle before upload. - shutil.make_archive(dump_path, 'zip', root_dir=xcresult_bundle) + if luci_test_outputs_path and os.path.exists(xcresult_bundle): + dump_path = os.path.join( + luci_test_outputs_path, 'ios_embedding.xcresult' + ) + # xcresults contain many little files. Archive the bundle before upload. + shutil.make_archive(dump_path, 'zip', root_dir=xcresult_bundle) finally: delete_simulator(new_simulator_name) From e0e6ad273e9f7615a6cb868f477b660cf9c074c3 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Mon, 15 May 2023 13:59:33 -0700 Subject: [PATCH 2/2] add raise --- testing/run_tests.py | 1 + 1 file changed, 1 insertion(+) diff --git a/testing/run_tests.py b/testing/run_tests.py index f24049f2f784e..74ea48c41d467 100755 --- a/testing/run_tests.py +++ b/testing/run_tests.py @@ -791,6 +791,7 @@ def run_objc_tests(ios_variant='ios_debug_sim_unopt', test_filter=None): ) # xcresults contain many little files. Archive the bundle before upload. shutil.make_archive(dump_path, 'zip', root_dir=xcresult_bundle) + raise finally: delete_simulator(new_simulator_name)