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
This commit is contained in:
liang.he
2025-03-20 14:25:13 +08:00
committed by GitHub
parent 1f14f4ec0a
commit 06ea960e76
5 changed files with 191 additions and 151 deletions

View File

@ -448,9 +448,9 @@ function spec_test()
# May 31, 2012 [interpreter] implement atomic.wait and atomic.notify (#194)
git reset --hard 09f2831349bf409187abb6f7868482a8079f2264
git apply ../../spec-test-script/thread_proposal_ignore_cases.patch || exit 1
git apply ../../spec-test-script/thread_proposal_fix_atomic_case.patch || exit 1
git apply ../../spec-test-script/thread_proposal_remove_memory64_flag_case.patch
git apply --ignore-whitespace ../../spec-test-script/thread_proposal_ignore_cases.patch || exit 1
git apply --ignore-whitespace ../../spec-test-script/thread_proposal_fix_atomic_case.patch || exit 1
git apply --ignore-whitespace ../../spec-test-script/thread_proposal_remove_memory64_flag_case.patch
elif [ ${ENABLE_EH} == 1 ]; then
echo "checkout exception-handling test cases"
@ -459,7 +459,7 @@ function spec_test()
# Jun 6, 2023 Merge branch 'upstream' into merge-upstream
git reset --hard 51c721661b671bb7dc4b3a3acb9e079b49778d36
git apply ../../spec-test-script/exception_handling.patch || exit 1
git apply --ignore-whitespace ../../spec-test-script/exception_handling.patch || exit 1
elif [[ ${ENABLE_GC} == 1 ]]; then
echo "checkout spec for GC proposal"
@ -469,12 +469,12 @@ function spec_test()
# Dec 9, 2024. Merge branch 'funcref'
git reset --hard 756060f5816c7e2159f4817fbdee76cf52f9c923
git apply ../../spec-test-script/gc_ignore_cases.patch || exit 1
git apply --ignore-whitespace ../../spec-test-script/gc_ignore_cases.patch || exit 1
if [[ ${ENABLE_QEMU} == 1 ]]; then
# Decrease the recursive count for tail call cases as nuttx qemu's
# native stack size is much smaller
git apply ../../spec-test-script/gc_nuttx_tail_call.patch || exit 1
git apply --ignore-whitespace ../../spec-test-script/gc_nuttx_tail_call.patch || exit 1
fi
# As of version 1.0.36, wabt is still unable to correctly handle the GC proposal.
@ -497,7 +497,7 @@ function spec_test()
git checkout 044d0d2e77bdcbe891f7e0b9dd2ac01d56435f0b -- test/core/elem.wast test/core/data.wast
# Patch table64 extension
git checkout 940398cd4823522a9b36bec4984be4b153dedb81 -- test/core/call_indirect.wast test/core/table.wast test/core/table_copy.wast test/core/table_copy_mixed.wast test/core/table_fill.wast test/core/table_get.wast test/core/table_grow.wast test/core/table_init.wast test/core/table_set.wast test/core/table_size.wast
git apply ../../spec-test-script/memory64_ignore_cases.patch || exit 1
git apply --ignore-whitespace ../../spec-test-script/memory64_ignore_cases.patch || exit 1
elif [[ ${ENABLE_MULTI_MEMORY} == 1 ]]; then
echo "checkout spec for multi memory proposal"
@ -508,9 +508,9 @@ function spec_test()
# Reset to commit: "Merge pull request #48 from backes/specify-memcpy-immediate-order"
git reset --hard fbc99efd7a788db300aec3dd62a14577ec404f1b
git checkout 044d0d2e77bdcbe891f7e0b9dd2ac01d56435f0b -- test/core/elem.wast
git apply ../../spec-test-script/multi_memory_ignore_cases.patch || exit 1
git apply --ignore-whitespace ../../spec-test-script/multi_memory_ignore_cases.patch || exit 1
if [[ ${RUNNING_MODE} == "aot" ]]; then
git apply ../../spec-test-script/multi_module_aot_ignore_cases.patch || exit 1
git apply --ignore-whitespace ../../spec-test-script/multi_module_aot_ignore_cases.patch || exit 1
fi
else
echo "checkout spec for default proposal"
@ -520,15 +520,15 @@ function spec_test()
# Dec 20, 2024. Use WPT version of test harness for HTML core test conversion (#1859)
git reset --hard f3a0e06235d2d84bb0f3b5014da4370613886965
git apply ../../spec-test-script/ignore_cases.patch || exit 1
git apply --ignore-whitespace ../../spec-test-script/ignore_cases.patch || exit 1
if [[ ${ENABLE_SIMD} == 1 ]]; then
git apply ../../spec-test-script/simd_ignore_cases.patch || exit 1
git apply --ignore-whitespace ../../spec-test-script/simd_ignore_cases.patch || exit 1
fi
if [[ ${ENABLE_MULTI_MODULE} == 1 ]]; then
git apply ../../spec-test-script/multi_module_ignore_cases.patch || exit 1
git apply --ignore-whitespace ../../spec-test-script/multi_module_ignore_cases.patch || exit 1
if [[ ${RUNNING_MODE} == "aot" ]]; then
git apply ../../spec-test-script/multi_module_aot_ignore_cases.patch || exit 1
git apply --ignore-whitespace ../../spec-test-script/multi_module_aot_ignore_cases.patch || exit 1
fi
fi
fi