Plug the WASM batched test runner into the build system

The new batched test runner is now used for running the tests instead
of the wasm shell, which runs for single test cases.

Change-Id: I7b7e6dd7993ba7937124c5843356b6891301b893
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Mikolaj Boc 2022-08-24 09:33:26 +02:00
parent cd4a3a1dc7
commit 619cb795b2
3 changed files with 40 additions and 11 deletions

View File

@ -39,11 +39,6 @@ function(qt_internal_add_executable name)
PROPERTY EXCLUDE_FROM_ALL "$<NOT:$<CONFIG:${QT_MULTI_CONFIG_FIRST_CONFIG}>>")
endif()
if(WASM)
qt_internal_wasm_add_finalizers("${name}")
_qt_internal_wasm_add_target_helpers("${name}")
endif()
if (arg_VERSION)
if(arg_VERSION MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+")
# nothing to do
@ -143,6 +138,11 @@ function(qt_internal_add_executable name)
qt_internal_set_exceptions_flags("${name}" ${arg_EXCEPTIONS})
if(WASM)
qt_internal_wasm_add_finalizers("${name}")
_qt_internal_wasm_add_target_helpers("${name}")
endif()
# Check if target needs to be excluded from all target. Also affects qt_install.
# Set by qt_exclude_tool_directories_from_default_target.
set(exclude_from_all FALSE)

View File

@ -14,12 +14,25 @@ function(_qt_internal_wasm_add_target_helpers target)
set(WASM_BUILD_DIR "${QT_BUILD_DIR}")
endif()
configure_file("${WASM_BUILD_DIR}/plugins/platforms/wasm_shell.html"
"${target}.html")
configure_file("${WASM_BUILD_DIR}/plugins/platforms/qtloader.js"
qtloader.js COPYONLY)
configure_file("${WASM_BUILD_DIR}/plugins/platforms/qtlogo.svg"
qtlogo.svg COPYONLY)
_qt_internal_test_batch_target_name(test_batch_target_name)
if(QT_BUILD_TESTS_BATCHED AND target STREQUAL test_batch_target_name)
get_target_property(batch_output_dir ${target} RUNTIME_OUTPUT_DIRECTORY)
configure_file("${WASM_BUILD_DIR}/libexec/batchedtestrunner.html"
"${batch_output_dir}/batchedtestrunner.html" COPYONLY)
configure_file("${WASM_BUILD_DIR}/libexec/batchedtestrunner.js"
"${batch_output_dir}/batchedtestrunner.js" COPYONLY)
configure_file("${WASM_BUILD_DIR}/libexec/qwasmjsruntime.js"
"${batch_output_dir}/qwasmjsruntime.js" COPYONLY)
configure_file("${WASM_BUILD_DIR}/libexec/util.js"
"${batch_output_dir}/util.js" COPYONLY)
else()
configure_file("${WASM_BUILD_DIR}/plugins/platforms/wasm_shell.html"
"${target}.html")
configure_file("${WASM_BUILD_DIR}/plugins/platforms/qtloader.js"
qtloader.js COPYONLY)
configure_file("${WASM_BUILD_DIR}/plugins/platforms/qtlogo.svg"
qtlogo.svg COPYONLY)
endif()
if(QT_FEATURE_thread)
set(POOL_SIZE 4)

View File

@ -164,3 +164,19 @@ qt_internal_apply_testlib_coverage_options(Test)
if(QT_FEATURE_private_tests)
add_subdirectory(doc/snippets/code)
endif()
if(QT_FEATURE_batch_test_support AND WASM)
set(wasm_support_libexec_files)
list(APPEND wasm_support_libexec_files
${QtBase_SOURCE_DIR}/util/wasm/batchedtestrunner/batchedtestrunner.html)
list(APPEND wasm_support_libexec_files
${QtBase_SOURCE_DIR}/util/wasm/batchedtestrunner/batchedtestrunner.js)
list(APPEND wasm_support_libexec_files
${QtBase_SOURCE_DIR}/util/wasm/batchedtestrunner/qwasmjsruntime.js)
list(APPEND wasm_support_libexec_files
${QtBase_SOURCE_DIR}/util/wasm/batchedtestrunner/util.js)
qt_path_join(libexec_dir ${QT_INSTALL_DIR} ${INSTALL_LIBEXECDIR})
qt_copy_or_install(FILES ${wasm_support_libexec_files}
DESTINATION "${libexec_dir}")
endif()