From 73b33bdf1aa7699fff78c3e7764c8b1dbfe448d7 Mon Sep 17 00:00:00 2001 From: Gabriel Ferreira Date: Sat, 21 Oct 2023 17:30:58 -0300 Subject: [PATCH] tests: Try-catch opening of possibly non-existent output file --- test.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test.py b/test.py index 4c4eab5cb..0562e0a4c 100755 --- a/test.py +++ b/test.py @@ -2002,9 +2002,15 @@ def run_tests(): post = contents.find("") contents = contents[:pre] + "VALGR" + contents[post:] f_to.write(contents) - et = ET.parse(job.tmp_file_name) - if et.find("Result").text in ["PASS", "SKIP"]: - failed_jobs.pop() + # When running with sanitizers, the program may + # crash before ever writing the expected xml + # output file + try: + et = ET.parse(job.tmp_file_name) + if et.find("Result").text in ["PASS", "SKIP"]: + failed_jobs.pop() + except: + pass else: with open(xml_results_file, "a", encoding="utf-8") as f: f.write("\n")