wasm: Enable asyncify for tests

Since a good number of tests use exec and friends, we want to use
asyncify for them. Asyncify is still possible to enable universally
with device options.

Change-Id: I0916f55328c98f2ba179cda3757eeee9d27f3e47
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
David Skoland 2022-11-07 18:47:12 +01:00
parent 770c849a31
commit ef7d17ed15
2 changed files with 5 additions and 1 deletions

View File

@ -558,6 +558,11 @@ function(qt_internal_add_test name)
# TODO: Add functionality to specify browser # TODO: Add functionality to specify browser
list(APPEND extra_test_args "--browser=chrome") list(APPEND extra_test_args "--browser=chrome")
# We always want to enable asyncify for tests, as some of them use exec
# Optimize for size (-Os), since asyncify tends to make the resulting
# binary very large
target_link_options("${name}" PRIVATE "SHELL:-s ASYNCIFY" "-Os")
# 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") set_property(TARGET "${name}" PROPERTY CROSSCOMPILING_EMULATOR "emrun")

View File

@ -70,7 +70,6 @@ function (qt_internal_setup_wasm_target_properties wasmTarget)
# target_link_options("${wasmTarget}" INTERFACE "SHELL:-s SOCKET_DEBUG") # print out socket,network data transfer # target_link_options("${wasmTarget}" INTERFACE "SHELL:-s SOCKET_DEBUG") # print out socket,network data transfer
if ("QT_EMSCRIPTEN_ASYNCIFY=1" IN_LIST QT_QMAKE_DEVICE_OPTIONS) if ("QT_EMSCRIPTEN_ASYNCIFY=1" IN_LIST QT_QMAKE_DEVICE_OPTIONS)
# Emscripten recommends building with optimizations when using asyncify # Emscripten recommends building with optimizations when using asyncify
# in order to reduce wasm file size, and may also generate broken wasm # in order to reduce wasm file size, and may also generate broken wasm
# (with "wasm validation error: too many locals" type errors) if optimizations # (with "wasm validation error: too many locals" type errors) if optimizations