Adjust installing and running wasm-testrunner

Added a small helper function that also installs the script to
prefix builds. Additionally, leveraging the cmake option
CROSSCOMPILING_EMULATOR for the testrunner fits neatly in the rest
of our cmake code.

Change-Id: I75288e97c81b250ac3997f2e7a22bc7bd82b7b69
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
David Skoland 2022-05-13 20:28:03 +02:00
parent e3757df526
commit 1a0eb4fa01
2 changed files with 17 additions and 4 deletions

View File

@ -387,6 +387,12 @@ elseif(IOS)
cmake/ios/LaunchScreen.storyboard
DESTINATION "${__GlobalConfig_install_dir}/ios"
)
elseif(WASM)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/util/wasm/wasmtestrunner/qt-wasmtestrunner.py"
"${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/qt-wasmtestrunner.py" @ONLY)
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/qt-wasmtestrunner.py"
DESTINATION "${INSTALL_LIBEXECDIR}")
endif()
# Install CI support files to libexec.
@ -395,5 +401,3 @@ qt_copy_or_install(FILES coin/instructions/qmake/ensure_pro_file.cmake
DESTINATION "${__qt_libexec_install_dir}")
qt_copy_or_install(PROGRAMS "util/testrunner/qt-testrunner.py"
DESTINATION "${__qt_libexec_install_dir}")
qt_copy_or_install(PROGRAMS "util/wasm/wasmtestrunner/qt-wasmtestrunner.py"
DESTINATION "${__qt_libexec_install_dir}")

View File

@ -332,8 +332,17 @@ function(qt_internal_add_test name)
set(test_working_dir "")
set(test_executable "${name}")
elseif(WASM)
set(test_executable "${__qt_libexec_dir_absolute}/qt-wasmtestrunner.py")
list(APPEND extra_test_args "${name}.html")
# Test script expects html file
set(test_executable "${name}.html")
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()
# 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}")
else()
if(arg_QMLTEST AND NOT arg_SOURCES)
set(test_working_dir "${CMAKE_CURRENT_SOURCE_DIR}")