summaryrefslogtreecommitdiff
path: root/cmake/QtTestHelpers.cmake
diff options
context:
space:
mode:
authorMikolaj Boc <mikolaj.boc@qt.io>2022-09-14 19:40:07 +0200
committerMikolaj Boc <mikolaj.boc@qt.io>2022-09-19 08:54:02 +0200
commitbb582f7fd5073b11987f9d61511606422cf4e7c3 (patch)
tree210559e9e8f5cb6276edd4da596d1afb96304a39 /cmake/QtTestHelpers.cmake
parent38049164c370dd424afe0c4574b458f7bd79083b (diff)
downloadqtbase-bb582f7fd5073b11987f9d61511606422cf4e7c3.tar.gz
Use the js test runner for all tests on wasm
Make cmake changes that have ctest run the emrun test runner for all tests that are build for wasm. Change-Id: I8c07068d79cfd0d745dbcc3d3f025c7c48fe1069 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtTestHelpers.cmake')
-rw-r--r--cmake/QtTestHelpers.cmake27
1 files changed, 15 insertions, 12 deletions
diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake
index 657bb160de..988d45ca16 100644
--- a/cmake/QtTestHelpers.cmake
+++ b/cmake/QtTestHelpers.cmake
@@ -382,15 +382,19 @@ function(qt_internal_is_in_test_batch out name)
endif()
endfunction()
-function(qt_internal_get_batched_test_argument out testname)
+function(qt_internal_get_batched_test_arguments out testname)
if(WASM)
# Add a query string to the runner document, so that the script therein
# knows which test to run in response to launching the testcase by ctest.
- set(${out} "--batched_test=${testname}" PARENT_SCOPE)
+ list(APPEND args "qbatchedtest")
+ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+ list(APPEND args "qvisualoutput")
+ endif()
else()
# Simply add the test name in case of standard executables.
- set(${out} "${testname}" PARENT_SCOPE)
+ list(APPEND args "${testname}")
endif()
+ set(${out} ${args} PARENT_SCOPE)
endfunction()
# This function creates a CMake test target with the specified name for use with CTest.
@@ -543,19 +547,18 @@ function(qt_internal_add_test name)
# version specialized for running batches has to be supplied.
if(setting_up_batched_test)
get_target_property(batch_output_dir ${name} RUNTIME_OUTPUT_DIRECTORY)
- set(test_executable "${batch_output_dir}/batchedtestrunner.html")
+ set(test_executable "${batch_output_dir}/${name}.html")
else()
set(test_executable "${name}.html")
endif()
- if(QT6_INSTALL_PREFIX)
- set(QT_WASM_TESTRUNNER "${QT6_INSTALL_PREFIX}/${INSTALL_LIBEXECDIR}/qt-wasmtestrunner.py")
- elseif(QT_BUILD_DIR)
- set(QT_WASM_TESTRUNNER "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/qt-wasmtestrunner.py")
- endif()
+ list(APPEND extra_test_args "quseemrun")
+ list(APPEND extra_test_args "qtestname=${testname}")
+ list(APPEND extra_test_args "--silence_timeout=60")
+
# This tells cmake to run the tests with this script, since wasm files can't be
# executed directly
- set_property(TARGET "${name}" PROPERTY CROSSCOMPILING_EMULATOR "${QT_WASM_TESTRUNNER}")
+ set_property(TARGET "${name}" PROPERTY CROSSCOMPILING_EMULATOR "emrun")
else()
if(arg_QMLTEST AND NOT arg_SOURCES)
set(test_working_dir "${CMAKE_CURRENT_SOURCE_DIR}")
@@ -573,8 +576,8 @@ function(qt_internal_add_test name)
endif()
if(setting_up_batched_test)
- qt_internal_get_batched_test_argument(batched_test_argument ${testname})
- list(APPEND extra_test_args ${batched_test_argument})
+ qt_internal_get_batched_test_arguments(batched_test_args ${testname})
+ list(PREPEND extra_test_args ${batched_test_args})
endif()
qt_internal_collect_command_environment(test_env_path test_env_plugin_path)