mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-08 20:56:13 +00:00
wamr-test-suites: Save .wasm/.aot file to the report dir if test failed (#1937)
This commit is contained in:
parent
42ced88424
commit
2c8375ee67
|
@ -111,6 +111,7 @@ def test_case(
|
||||||
verbose_flag=True,
|
verbose_flag=True,
|
||||||
qemu_flag=False,
|
qemu_flag=False,
|
||||||
qemu_firmware='',
|
qemu_firmware='',
|
||||||
|
log='',
|
||||||
):
|
):
|
||||||
case_path = pathlib.Path(case_path).resolve()
|
case_path = pathlib.Path(case_path).resolve()
|
||||||
case_name = case_path.stem
|
case_name = case_path.stem
|
||||||
|
@ -170,6 +171,10 @@ def test_case(
|
||||||
if not clean_up_flag:
|
if not clean_up_flag:
|
||||||
CMD.append("--no_cleanup")
|
CMD.append("--no_cleanup")
|
||||||
|
|
||||||
|
if log != '':
|
||||||
|
CMD.append("--log-dir")
|
||||||
|
CMD.append(log)
|
||||||
|
|
||||||
CMD.append(case_path)
|
CMD.append(case_path)
|
||||||
print(f"============> run {case_name} ", end="")
|
print(f"============> run {case_name} ", end="")
|
||||||
with subprocess.Popen(
|
with subprocess.Popen(
|
||||||
|
@ -228,7 +233,8 @@ def test_suite(
|
||||||
verbose_flag=True,
|
verbose_flag=True,
|
||||||
parl_flag=False,
|
parl_flag=False,
|
||||||
qemu_flag=False,
|
qemu_flag=False,
|
||||||
qemu_firmware=''
|
qemu_firmware='',
|
||||||
|
log='',
|
||||||
):
|
):
|
||||||
suite_path = pathlib.Path(SPEC_TEST_DIR).resolve()
|
suite_path = pathlib.Path(SPEC_TEST_DIR).resolve()
|
||||||
if not suite_path.exists():
|
if not suite_path.exists():
|
||||||
|
@ -264,6 +270,7 @@ def test_suite(
|
||||||
verbose_flag,
|
verbose_flag,
|
||||||
qemu_flag,
|
qemu_flag,
|
||||||
qemu_firmware,
|
qemu_firmware,
|
||||||
|
log,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -299,6 +306,7 @@ def test_suite(
|
||||||
verbose_flag,
|
verbose_flag,
|
||||||
qemu_flag,
|
qemu_flag,
|
||||||
qemu_firmware,
|
qemu_firmware,
|
||||||
|
log,
|
||||||
)
|
)
|
||||||
successful_case += 1
|
successful_case += 1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -393,6 +401,12 @@ def main():
|
||||||
dest="qemu_firmware",
|
dest="qemu_firmware",
|
||||||
help="Firmware required by qemu",
|
help="Firmware required by qemu",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--log",
|
||||||
|
default='',
|
||||||
|
dest="log",
|
||||||
|
help="Log directory",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--quiet",
|
"--quiet",
|
||||||
action="store_false",
|
action="store_false",
|
||||||
|
@ -435,6 +449,7 @@ def main():
|
||||||
options.parl_flag,
|
options.parl_flag,
|
||||||
options.qemu_flag,
|
options.qemu_flag,
|
||||||
options.qemu_firmware,
|
options.qemu_firmware,
|
||||||
|
options.log,
|
||||||
)
|
)
|
||||||
end = time.time_ns()
|
end = time.time_ns()
|
||||||
print(
|
print(
|
||||||
|
@ -455,7 +470,8 @@ def main():
|
||||||
options.clean_up_flag,
|
options.clean_up_flag,
|
||||||
options.verbose_flag,
|
options.verbose_flag,
|
||||||
options.qemu_flag,
|
options.qemu_flag,
|
||||||
options.qemu_firmware
|
options.qemu_firmware,
|
||||||
|
options.log
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
ret = True
|
ret = True
|
||||||
|
|
|
@ -200,6 +200,8 @@ parser.add_argument('--no-pty', action='store_true',
|
||||||
help="Use direct pipes instead of pseudo-tty")
|
help="Use direct pipes instead of pseudo-tty")
|
||||||
parser.add_argument('--log-file', type=str,
|
parser.add_argument('--log-file', type=str,
|
||||||
help="Write messages to the named file in addition the screen")
|
help="Write messages to the named file in addition the screen")
|
||||||
|
parser.add_argument('--log-dir', type=str,
|
||||||
|
help="The log directory to save the case file if test failed")
|
||||||
parser.add_argument('--debug-file', type=str,
|
parser.add_argument('--debug-file', type=str,
|
||||||
help="Write all test interaction the named file")
|
help="Write all test interaction the named file")
|
||||||
|
|
||||||
|
@ -1092,6 +1094,7 @@ def test_assert_with_exception(form, wast_tempfile, wasm_tempfile, aot_tempfile,
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
opts = parser.parse_args(sys.argv[1:])
|
opts = parser.parse_args(sys.argv[1:])
|
||||||
|
print('Input param :',opts)
|
||||||
|
|
||||||
if opts.aot: test_aot = True
|
if opts.aot: test_aot = True
|
||||||
# default x86_64
|
# default x86_64
|
||||||
|
@ -1271,12 +1274,16 @@ if __name__ == "__main__":
|
||||||
print("THE FINAL EXCEPTION IS {}".format(e))
|
print("THE FINAL EXCEPTION IS {}".format(e))
|
||||||
ret_code = 101
|
ret_code = 101
|
||||||
|
|
||||||
|
shutil.copyfile(wasm_tempfile, os.path.join(opts.log_dir, os.path.basename(wasm_tempfile)))
|
||||||
|
|
||||||
if opts.aot or opts.xip:
|
if opts.aot or opts.xip:
|
||||||
|
shutil.copyfile(aot_tempfile, os.path.join(opts.log_dir,os.path.basename(aot_tempfile)))
|
||||||
if "indirect-mode" in str(e):
|
if "indirect-mode" in str(e):
|
||||||
compile_wasm_to_aot(wasm_tempfile, aot_tempfile, None, opts, None, "object")
|
compile_wasm_to_aot(wasm_tempfile, aot_tempfile, None, opts, None, "object")
|
||||||
|
shutil.copyfile(aot_tempfile, os.path.join(opts.log_dir,os.path.basename(aot_tempfile)+'.o'))
|
||||||
subprocess.check_call(["llvm-objdump", "-r", aot_tempfile])
|
subprocess.check_call(["llvm-objdump", "-r", aot_tempfile])
|
||||||
compile_wasm_to_aot(wasm_tempfile, aot_tempfile, None, opts, None, "ir")
|
compile_wasm_to_aot(wasm_tempfile, aot_tempfile, None, opts, None, "ir")
|
||||||
subprocess.check_call(["cat", aot_tempfile])
|
shutil.copyfile(aot_tempfile, os.path.join(opts.log_dir,os.path.basename(aot_tempfile)+".ir"))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
ret_code = 0
|
ret_code = 0
|
||||||
|
|
|
@ -442,9 +442,12 @@ function spec_test()
|
||||||
|
|
||||||
if [[ ${ENABLE_QEMU} == 1 ]]; then
|
if [[ ${ENABLE_QEMU} == 1 ]]; then
|
||||||
ARGS_FOR_SPEC_TEST+="--qemu "
|
ARGS_FOR_SPEC_TEST+="--qemu "
|
||||||
ARGS_FOR_SPEC_TEST+="--qemu-firmware ${QEMU_FIRMWARE}"
|
ARGS_FOR_SPEC_TEST+="--qemu-firmware ${QEMU_FIRMWARE} "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# set log directory
|
||||||
|
ARGS_FOR_SPEC_TEST+="--log ${REPORT_DIR}"
|
||||||
|
|
||||||
cd ${WORK_DIR}
|
cd ${WORK_DIR}
|
||||||
echo "python3 ./all.py ${ARGS_FOR_SPEC_TEST} | tee -a ${REPORT_DIR}/spec_test_report.txt"
|
echo "python3 ./all.py ${ARGS_FOR_SPEC_TEST} | tee -a ${REPORT_DIR}/spec_test_report.txt"
|
||||||
python3 ./all.py ${ARGS_FOR_SPEC_TEST} | tee -a ${REPORT_DIR}/spec_test_report.txt
|
python3 ./all.py ${ARGS_FOR_SPEC_TEST} | tee -a ${REPORT_DIR}/spec_test_report.txt
|
||||||
|
|
Loading…
Reference in New Issue
Block a user