wasm: Make sure emrun.bat is used when running autotests on windows

The test system tried to run emrun (No .bat). This failed with a
file-not-found error on windows.

Also there was a test for (WIN32) when deciding to use cmd /c.
This test has been updated to (CMAKE_HOST_WIN32)

Also the aforementioned cmd /c was not present in the test run
output. It has been added.

Fixes: QTBUG-121996
Change-Id: Ib3c053949865038ad43abd479402f5e8e3c015ac
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Even Oscar Andersen 2024-02-07 10:13:21 +01:00
parent 53eb8dd06d
commit 5c05f5cd7f
2 changed files with 7 additions and 3 deletions

View File

@ -64,7 +64,7 @@ is not specified")
#Escaping environment variables before expand them by file GENERATE #Escaping environment variables before expand them by file GENERATE
string(REPLACE "\\" "\\\\" environment_extras "${environment_extras}") string(REPLACE "\\" "\\\\" environment_extras "${environment_extras}")
if(WIN32) if(CMAKE_HOST_WIN32)
# It's necessary to call actual test inside 'cmd.exe', because 'execute_process' uses # It's necessary to call actual test inside 'cmd.exe', because 'execute_process' uses
# SW_HIDE to avoid showing a console window, it affects other GUI as well. # SW_HIDE to avoid showing a console window, it affects other GUI as well.
# See https://gitlab.kitware.com/cmake/cmake/-/issues/17690 for details. # See https://gitlab.kitware.com/cmake/cmake/-/issues/17690 for details.
@ -97,7 +97,7 @@ execute_process(COMMAND ${extra_runner} ${arg_COMMAND}
) )
${post_run} ${post_run}
if(NOT result EQUAL 0) if(NOT result EQUAL 0)
string(JOIN \" \" full_command ${arg_COMMAND}) string(JOIN \" \" full_command ${extra_runner} ${arg_COMMAND})
message(FATAL_ERROR \"\${full_command} execution failed with exit code \${result}.\") message(FATAL_ERROR \"\${full_command} execution failed with exit code \${result}.\")
endif()" endif()"
) )

View File

@ -676,7 +676,11 @@ function(qt_internal_add_test name)
# This tells cmake to run the tests with this script, since wasm files can't be # This tells cmake to run the tests with this script, since wasm files can't be
# executed directly # executed directly
set_property(TARGET "${name}" PROPERTY CROSSCOMPILING_EMULATOR "emrun") if (CMAKE_HOST_WIN32)
set_property(TARGET "${name}" PROPERTY CROSSCOMPILING_EMULATOR "emrun.bat")
else()
set_property(TARGET "${name}" PROPERTY CROSSCOMPILING_EMULATOR "emrun")
endif()
else() else()
if(arg_QMLTEST AND NOT arg_SOURCES) if(arg_QMLTEST AND NOT arg_SOURCES)
set(test_working_dir "${CMAKE_CURRENT_SOURCE_DIR}") set(test_working_dir "${CMAKE_CURRENT_SOURCE_DIR}")