Files
CMake/Tests/RunCMake/GoogleTest/launcher_test.c
Craig Scott fc7aa3cd69 tests: Preserve empty arguments in test command lines
This will now preserve empty values in the TEST_LAUNCHER and
CROSSCOMPILING_EMULATOR target properties for tests added by:

- The add_test() command.
- The ExternalData_Add_Test() command from the ExternalData module.
- The gtest_add_tests() or gtest_discover_tests() commands from the
  GoogleTest module.

For the gtest_add_tests() and gtest_discover_tests() commands,
empty elements in the values passed after the EXTRA_ARGS keyword
are also now preserved.

Policy CMP0178 is added to provide backward compatibility with the
old behavior where empty values were silently discarded from the
above cases.

Fixes: #26337
2024-10-02 10:09:11 +10:00

25 lines
692 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: Launcher.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;
}