mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 15:55:07 +00:00

We have seen some cases where the build fails for folks, and they are missing unzip/tar/gzip etc. We can catch some of these in CMake itself, so lets make sure to handle that uniformly across the build system. The REQUIRED flag to `find_program` was only added on in CMake 3.18 and above, so we can't rely on that to actually halt the program execution.
42 lines
2.1 KiB
CMake
42 lines
2.1 KiB
CMake
if(INCLUDE_WASM_SPEC_TESTS)
|
|
if (CMAKE_PROJECT_NAME STREQUAL "SerenityOS")
|
|
set(SOURCE_DIR "${SerenityOS_SOURCE_DIR}")
|
|
else()
|
|
set(SOURCE_DIR "${SERENITY_PROJECT_ROOT}")
|
|
endif()
|
|
set(WASM_SPEC_TEST_GZ_URL https://github.com/WebAssembly/testsuite/archive/refs/heads/main.tar.gz)
|
|
set(WASM_SPEC_TEST_GZ_PATH ${CMAKE_BINARY_DIR}/wasm-spec-testsuite.tar.gz)
|
|
set(WASM_SPEC_TEST_TAR_PATH ${CMAKE_BINARY_DIR}/wasm-spec-testsuite.tar)
|
|
set(WASM_SPEC_TEST_PATH ${SOURCE_DIR}/Userland/Libraries/LibWasm/Tests/Fixtures/SpecTests)
|
|
|
|
if(NOT EXISTS ${WASM_SPEC_TEST_GZ_PATH})
|
|
message(STATUS "Downloading the WebAssembly testsuite from ${WASM_SPEC_TEST_GZ_URL}...")
|
|
file(DOWNLOAD ${WASM_SPEC_TEST_GZ_URL} ${WASM_SPEC_TEST_GZ_PATH} INACTIVITY_TIMEOUT 10)
|
|
endif()
|
|
|
|
set(SKIP_PRETTIER false)
|
|
if (WASM_SPEC_TEST_SKIP_FORMATTING)
|
|
set(SKIP_PRETTIER true)
|
|
endif()
|
|
|
|
if(EXISTS ${WASM_SPEC_TEST_GZ_PATH} AND NOT EXISTS ${WASM_SPEC_TEST_PATH})
|
|
message(STATUS "Extracting the WebAssembly testsuite from ${WASM_SPEC_TEST_GZ_PATH}...")
|
|
file(MAKE_DIRECTORY ${WASM_SPEC_TEST_PATH})
|
|
execute_process(COMMAND "${GZIP_TOOL}" -k -d ${WASM_SPEC_TEST_GZ_PATH})
|
|
execute_process(COMMAND "${TAR_TOOL}" -xf ${WASM_SPEC_TEST_TAR_PATH})
|
|
execute_process(COMMAND rm ${WASM_SPEC_TEST_TAR_PATH})
|
|
file(GLOB WASM_TESTS "${CMAKE_BINARY_DIR}/testsuite-main/*.wast")
|
|
foreach(PATH ${WASM_TESTS})
|
|
get_filename_component(NAME ${PATH} NAME_WLE)
|
|
message(STATUS "Generating test cases for WebAssembly test ${NAME}...")
|
|
# FIXME: GH 8668. loop_0.wasm causes CI timeout
|
|
if (NAME STREQUAL "loop")
|
|
message(STATUS "Skipping generation of ${NAME} test due to timeouts")
|
|
continue()
|
|
endif()
|
|
execute_process(
|
|
COMMAND env SKIP_PRETTIER=${SKIP_PRETTIER} bash ${SOURCE_DIR}/Meta/generate-libwasm-spec-test.sh "${PATH}" "${SOURCE_DIR}/Userland/Libraries/LibWasm/Tests/Spec" "${NAME}" "${WASM_SPEC_TEST_PATH}")
|
|
endforeach()
|
|
file(REMOVE testsuite-main)
|
|
endif()
|
|
endif()
|