Skip to content

Commit 2e9756d

Browse files
committed
fix(runtest.py): Improve error handling and logging for module file operations
1 parent ff10b86 commit 2e9756d

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,7 +1500,15 @@ def test_assert_with_exception(form, wast_tempfile, wasm_tempfile, aot_tempfile,
15001500
name_new =re.split('\"',re.search('\".*\"',form).group(0))[1]
15011501
if name_new:
15021502
new_module = os.path.join(tempfile.gettempdir(), name_new + ".wasm")
1503-
shutil.copyfile(temp_module_table.get(name_new, wasm_tempfile), new_module)
1503+
if not name_new in temp_module_table:
1504+
print(f"can not find module name {name_new} from the register")
1505+
1506+
just_generated = temp_module_table.get(name_new, wasm_tempfile)
1507+
if not os.path.exists(just_generated):
1508+
raise Exception("can not find file %s" % just_generated)
1509+
1510+
print("f{just_generated} is copied to {new_module}")
1511+
shutil.copyfile(just_generated, new_module)
15041512

15051513
# add new_module copied from the old into temp_file_repo[]
15061514
temp_file_repo.append(new_module)
@@ -1511,7 +1519,7 @@ def test_assert_with_exception(form, wast_tempfile, wasm_tempfile, aot_tempfile,
15111519
try:
15121520
assert_prompt(r, ['Compile success'], opts.start_timeout, True)
15131521
except:
1514-
raise Exception("compile wasm to aot failed")
1522+
raise Exception(f"compile wasm to aot failed {r.buf}")
15151523
# add aot module into temp_file_repo[]
15161524
temp_file_repo.append(new_module_aot)
15171525
else:

0 commit comments

Comments
 (0)