You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GTEST_DEATH_TEST et. al. are not defined under Emscripten. If you configure with emcmake cmake and run the tests with ctest, there are a number of failures (I tried to run the tests with bazel under emscripten, but couldn't figure out how to do that). The one I care about is the first one:
Start 1: googletest-death-test-test
Process not started
/Users/dave/src/googletest/.build/googletest/googletest-death-test-test.js
[permission denied]
1/45 Test #1: googletest-death-test-test .................***Not Run 0.00 sec
I realize that the wasm environment might not support the clone() or fork() calls needed to catch death tests in the generated test executable. If that is the obstacle, there's another way: when building with emscripten, create individual ctest death tests that check for the death of commands that launch a single death test from the test executable. Presumably bazel has its own test driver that could be leveraged in the same way.
For example, I use this CMake function when targeting emscripten:
# Turns all tests discovered in <test_executable> by# gtest_discover_tests that are named with the "DeathTest" convention# into CMake WILL_FAIL tests.## It is expected that under emscripten, these tests are actually# compiled as non-death tests; i.e. they simply execute the code that# is expected to die. There is no support for checking that the exit# code or output meets expectations.function(handle_emscripten_death_tests test_executable)
set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${test_executable}_death.cmake")
file(WRITE"${ctest_include_file}""set(death_tests \"\${${test_executable}_TESTS}}\")\n""list(FILTER death_tests INCLUDE REGEX \"DeathTest\")\n""set_tests_properties(\${death_tests} PROPERTIES WILL_FAIL YES)\n"
)
set_property(DIRECTORYAPPENDPROPERTY TEST_INCLUDE_FILES "${ctest_include_file}"
)
endfunction()
Describe the issue
GTEST_DEATH_TEST
et. al. are not defined under Emscripten. If you configure withemcmake cmake
and run the tests with ctest, there are a number of failures (I tried to run the tests with bazel under emscripten, but couldn't figure out how to do that). The one I care about is the first one:I realize that the wasm environment might not support the
clone()
orfork()
calls needed to catch death tests in the generated test executable. If that is the obstacle, there's another way: when building with emscripten, create individualctest
death tests that check for the death of commands that launch a single death test from the test executable. Presumably bazel has its own test driver that could be leveraged in the same way.For example, I use this CMake function when targeting emscripten:
Steps to reproduce the problem
What version of GoogleTest are you using?
ff233bd
What operating system and version are you using?
MacOS Sonoma 14.5 (23F79)
What compiler and version are you using?
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.64-git
clang version 19.0.0git
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/emscripten/3.1.64/libexec/llvm/bin
What build system are you using?
cmake version 3.30.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
Additional context
No response
The text was updated successfully, but these errors were encountered: