Skip to content

Commit 06ea960

Browse files
authored
fix(runtest.py): A workaround to bypass errors that occur when deleting temporary files (#4093)
- Replace sys.exit with exceptions for better error handling in test assertions - Update exception handling in compile_wast_to_wasm to catch all exceptions - Improve error messages and logging - Use `--ignore-whitespace` option for git apply in spec_test function - Use raw string notation for regex patterns. *The "SyntaxWarning: invalid escape sequence" in Python The warning has been upgraded to SyntaxWarning since Python 3.12, and it is expected to become a SyntaxError in future versions.* - Add early return for non-loadable AOT compilation to prevent unnecessary assertions - Redirect stderr to stdout in test_case for unified output - Update `create_tmpfiles()` to improve clarity and handling of temporary files
1 parent 1f14f4e commit 06ea960

File tree

5 files changed

+194
-154
lines changed

5 files changed

+194
-154
lines changed

ci/coding_guidelines_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def run_clang_format_diff(root: Path, commits: str) -> bool:
145145
found = False
146146
for summary in [x for x in diff_content if x.startswith("diff --git")]:
147147
# b/path/to/file -> path/to/file
148-
with_invalid_format = re.split("\s+", summary)[-1][2:]
148+
with_invalid_format = re.split(r"\s+", summary)[-1][2:]
149149
if not is_excluded(with_invalid_format):
150150
print(f"--- {with_invalid_format} failed on code style checking.")
151151
found = True

test-tools/addr2line/addr2line.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def get_line_info_from_function_addr_sourcemapping(
206206
if not line:
207207
continue
208208

209-
m = re.match("(.*):(\d+):(\d+)", line)
209+
m = re.match(r"(.*):(\d+):(\d+)", line)
210210
if m:
211211
function_file, function_line, function_column = m.groups()
212212
continue

tests/wamr-test-suites/spec-test-script/all.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def test_case(
247247
CMD,
248248
bufsize=1,
249249
stdout=subprocess.PIPE,
250-
stderr=subprocess.PIPE,
250+
stderr=subprocess.STDOUT,
251251
universal_newlines=True,
252252
) as p:
253253
try:
@@ -285,7 +285,9 @@ def test_case(
285285
except subprocess.TimeoutExpired:
286286
print("failed with TimeoutExpired")
287287
raise Exception(case_name)
288-
288+
except Exception as e:
289+
print(f"An unexpected error occurred: {e}")
290+
raise e
289291

290292
def test_suite(
291293
target,

0 commit comments

Comments
 (0)