A challenge for getting LibTest working on Windows has always been CrashTest. It implements death tests similar to Google Test where a child process is cloned to invoke the expression that should abort/terminate the program. Then the exit code of the child is used by the parent test process to verify if the application correctly aborted/terminated due to invoking the expression. The problem was that finding an equivalent way to port Crash::run() to Windows was not looking very likely as publicly exposed Win32/ Native APIs have no equivalent to fork(); however, Windows actually does have native support for process cloning via undocumented NT APIs that clever people reverse engineered and published, see `NtCreateUserProcess()`. All that being said, this `EXPECT_DEATH()` implementation avoids needing to use a child process in general, allowing us to remove CrashTest in favour of a single cross-platform solution for death tests.
15 lines
459 B
CMake
15 lines
459 B
CMake
add_library(LibTestMain OBJECT TestMain.cpp AssertionHandler.cpp)
|
|
|
|
target_link_libraries(LibTestMain PUBLIC GenericClangPlugin)
|
|
|
|
add_library(JavaScriptTestRunnerMain OBJECT JavaScriptTestRunnerMain.cpp)
|
|
|
|
set(SOURCES
|
|
TestSuite.cpp
|
|
CrashTest.cpp
|
|
)
|
|
|
|
add_library(LibTest ${SOURCES})
|
|
lagom_generate_export_header(LibTest test)
|
|
target_link_libraries(LibTest PRIVATE AK LibCore LibFileSystem)
|
|
set_target_properties(LibTest PROPERTIES OUTPUT_NAME lagom-test)
|