Problem: CI intermittently fails when a required-file download hiccups; e.g., the WASM spec test suite fetch failed on both its primary URL and the Web Archive fallback on the same run — breaking configure under CI. Cause: download_file_multisource was trying each source only once — so a single transient HTTP error could break the whole build. The WASM spec test tarball was also being fetched fresh every run — rather than from the shared download cache — so each build was exposed to that flakiness. Fix: Retry each fetch a few times across all sources — for every config- time download: the WASM spec tests, HSTS preload list, and public-suffix list. Cache the WASM spec test tarball across CI runs — keyed by commit, so it’s (re)fetched only once per commit bump.
37 lines
2 KiB
CMake
37 lines
2 KiB
CMake
#
|
|
# Download and compile the WebAssembly testsuite into the WebAssembly binary format
|
|
#
|
|
|
|
if(INCLUDE_WASM_SPEC_TESTS)
|
|
set(WASM_SPEC_TEST_COMMIT 4b24564c844e3d34bf46dfcb3c774ee5163e31cc) # 2025-09-10
|
|
set(WASM_SPEC_TEST_GZ_URL https://github.com/WebAssembly/testsuite/archive/${WASM_SPEC_TEST_COMMIT}.tar.gz)
|
|
set(WASM_SPEC_TEST_GZ_PATH ${LADYBIRD_CACHE_DIR}/WasmSpecTests/wasm-spec-testsuite-${WASM_SPEC_TEST_COMMIT}.tar.gz CACHE PATH "")
|
|
set(WASM_SPEC_TEST_PATH ${CMAKE_CURRENT_BINARY_DIR}/Tests/Fixtures/SpecTests CACHE PATH "")
|
|
|
|
download_file(${WASM_SPEC_TEST_GZ_URL} ${WASM_SPEC_TEST_GZ_PATH})
|
|
|
|
set(SKIP_PRETTIER false)
|
|
if (WASM_SPEC_TEST_SKIP_FORMATTING)
|
|
set(SKIP_PRETTIER true)
|
|
endif()
|
|
|
|
find_program(WASMTOOLS wasm-tools REQUIRED)
|
|
find_program(PRETTIER prettier OPTIONAL)
|
|
if (NOT SKIP_PRETTIER AND PRETTIER EQUAL "PRETTIER-NOTFOUND")
|
|
message(FATAL_ERROR "Prettier required to format Wasm spec tests! Install prettier or set WASM_SPEC_TEST_SKIP_FORMATTING to ON")
|
|
endif()
|
|
|
|
if(EXISTS ${WASM_SPEC_TEST_GZ_PATH} AND NOT EXISTS ${WASM_SPEC_TEST_PATH}/const_0.wasm)
|
|
message(STATUS "Extracting the WebAssembly testsuite from ${WASM_SPEC_TEST_GZ_PATH}...")
|
|
extract_path("${CMAKE_CURRENT_BINARY_DIR}" "${WASM_SPEC_TEST_GZ_PATH}" "testsuite-${WASM_SPEC_TEST_COMMIT}/*.wast" "${WASM_SPEC_TEST_PATH}")
|
|
file(MAKE_DIRECTORY ${WASM_SPEC_TEST_PATH})
|
|
file(GLOB WASM_TESTS "${CMAKE_CURRENT_BINARY_DIR}/testsuite-${WASM_SPEC_TEST_COMMIT}/*.wast")
|
|
foreach(PATH ${WASM_TESTS})
|
|
get_filename_component(NAME ${PATH} NAME_WLE)
|
|
message(STATUS "Generating test cases for WebAssembly test ${NAME}...")
|
|
execute_process(
|
|
COMMAND env SKIP_PRETTIER=${SKIP_PRETTIER} bash ${LADYBIRD_SOURCE_DIR}/Meta/Generators/generate_libwasm_spec_test.sh "${PATH}" "${CMAKE_CURRENT_BINARY_DIR}/Tests/Spec" "${NAME}" "${WASM_SPEC_TEST_PATH}")
|
|
endforeach()
|
|
file(REMOVE testsuite-${WASM_SPEC_TEST_COMMIT})
|
|
endif()
|
|
endif()
|