Files
CMake/Tests/RunCMake/GoogleTest/launcher_test.c
Ralf Habacker f875c479f5 GoogleTest: Honor TEST_LAUNCHER in gtest_discover_tests
We run test executables to discover tests.  Use the same launchers that
are used to run the tests.  We already handle `CROSSCOMPILING_EMULATOR`.
Update the logic to account for the `TEST_LAUNCHER` property added by
commit 1ec0372ed4 (add_test: Optionally use a launcher for tests running
in-project targets, 2023-11-11), and for the `CROSSCOMPILING_EMULATOR`
behavior change in commit ca5a300d7f (add_test: Honor
CROSSCOMPILING_EMULATOR only when cross-compiling, 2023-11-02).

Fixes: #25603
Co-authored-by: Brad King <brad.king@kitware.com>
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2024-01-31 08:33:15 -05:00

25 lines
694 B
C

#include <stdio.h>
#include <string.h>
/* Having this as comment lets gtest_add_tests recognizes the test we fake
here without requiring googletest
TEST_F( launcher_test, test1 )
{
}
*/
int main(int argc, char** argv)
{
/* Note: GoogleTest.cmake doesn't actually depend on Google Test as such;
* it only requires that we produces output in the expected format when
* invoked with --gtest_list_tests. Thus, we fake that here. This allows us
* to test the module without actually needing Google Test. */
if (argc > 1 && strcmp(argv[1], "--gtest_list_tests") == 0) {
printf("launcher_test.\n");
printf(" test1\n");
}
printf("launcher_test.test1\n");
return 0;
}