diff options
author | Brad King <brad.king@kitware.com> | 2024-01-26 20:16:46 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-01-29 15:30:24 (GMT) |
commit | 13ece67a58a4755807a2e9001e245fdafe9e52e2 (patch) | |
tree | f5d29e88f5d54106e84bd68ad84a85a1984f83fc /Tests/RunCMake/add_test | |
parent | b9ad73fcb2ddbdd53eff6c3ba635b96f5ed0c87b (diff) | |
download | CMake-13ece67a58a4755807a2e9001e245fdafe9e52e2.zip CMake-13ece67a58a4755807a2e9001e245fdafe9e52e2.tar.gz CMake-13ece67a58a4755807a2e9001e245fdafe9e52e2.tar.bz2 |
Add genex support to TEST_LAUNCHER and CROSSCOMPILING_EMULATOR
Evaluate generator expressions in these properties, as they apply to
`add_test`, `add_custom_command`, and `add_custom_target`.
The `CMAKE_CROSSCOMPILING_EMULATOR` variable's `try_run` behavior occurs
at configure time and so cannot support generator expressions.
Diffstat (limited to 'Tests/RunCMake/add_test')
-rw-r--r-- | Tests/RunCMake/add_test/TestLauncher-check.cmake | 14 | ||||
-rw-r--r-- | Tests/RunCMake/add_test/TestLauncher-test-stdout.txt | 20 | ||||
-rw-r--r-- | Tests/RunCMake/add_test/TestLauncher.cmake | 7 |
3 files changed, 31 insertions, 10 deletions
diff --git a/Tests/RunCMake/add_test/TestLauncher-check.cmake b/Tests/RunCMake/add_test/TestLauncher-check.cmake index add1105..d1396c2 100644 --- a/Tests/RunCMake/add_test/TestLauncher-check.cmake +++ b/Tests/RunCMake/add_test/TestLauncher-check.cmake @@ -8,27 +8,31 @@ endif() set(error_details "There is a problem with generated test file:\n ${testfile}") -if(testfile_contents MATCHES "add_test[(]DoesNotUseTestLauncher [^\n]+pseudo_emulator[^\n]+\n") +if(testfile_contents MATCHES "add_test[(]DoesNotUseTestLauncher [^$<>\n]+pseudo_emulator[^$<>\n]+\n") set(RunCMake_TEST_FAILED "Used test launcher when it should not be used. ${error_details}") return() endif() -if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncher [^\n]+pseudo_emulator[^\n]+\n") +if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncher [^$<>\n]+pseudo_emulator[^$<>\n]+\n") set(RunCMake_TEST_FAILED "Did not use test launcher when it should be used. ${error_details}") return() endif() -if(testfile_contents MATCHES "add_test[(]DoesNotUseTestLauncherWithGenex [^\n]+pseudo_emulator[^\n]+\n") +if(testfile_contents MATCHES "add_test[(]DoesNotUseTestLauncherWithGenex [^$<>\n]+pseudo_emulator[^$<>\n]+\n") set(RunCMake_TEST_FAILED "Used test launcher when it should not be used. ${error_details}") return() endif() -if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncherWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_emulator[^\n]+\n") +if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncherWithExecTargetFromSubdirAddedWithoutGenex [^$<>\n]+pseudo_emulator[^$<>\n]+\n") set(RunCMake_TEST_FAILED "Did not use test launcher when it should be used. ${error_details}") return() endif() -if(testfile_contents MATCHES "add_test[(]DoesNotUseTestLauncherWithExecTargetFromSubdirAddedWithGenex [^\n]+pseudo_emulator[^\n]+\n") +if(testfile_contents MATCHES "add_test[(]DoesNotUseTestLauncherWithExecTargetFromSubdirAddedWithGenex [^$<>\n]+pseudo_emulator[^$<>\n]+\n") set(RunCMake_TEST_FAILED "Used test launcher when it should not be used. ${error_details}") return() endif() + +if(NOT testfile_contents MATCHES "add_test[(]UsesLocalLauncher [^$<>\n]+local_launcher[^$<>\n]+use_launcher_local[^$<>\n]+\n") + message(SEND_ERROR "Did not use local test launcher when it should be used. ${error_details}") +endif() diff --git a/Tests/RunCMake/add_test/TestLauncher-test-stdout.txt b/Tests/RunCMake/add_test/TestLauncher-test-stdout.txt index 10d79d4..a028f42 100644 --- a/Tests/RunCMake/add_test/TestLauncher-test-stdout.txt +++ b/Tests/RunCMake/add_test/TestLauncher-test-stdout.txt @@ -7,7 +7,7 @@ test 1 ]*/Tests/RunCMake/add_test/TestLauncher-build 1: Test timeout computed to be: [0-9]+ 1: Hi -1/5 Test #1: DoesNotUseLauncher [.]* +Passed +[0-9.]+ sec +1/6 Test #1: DoesNotUseLauncher [.]* +Passed +[0-9.]+ sec test 2 Start 2: UsesTestLauncher + @@ -17,7 +17,7 @@ test 2 ]*Tests/RunCMake/add_test/TestLauncher-build 2: Test timeout computed to be: [0-9]+ 2: Command: "[^"]*/Tests/RunCMake/add_test/TestLauncher-build(/Debug)?/exe(\.exe)?" -2/5 Test #2: UsesTestLauncher [.]* +Passed +[0-9.]+ sec +2/6 Test #2: UsesTestLauncher [.]* +Passed +[0-9.]+ sec test 3 Start 3: DoesNotUseTestLauncherWithGenex + @@ -26,7 +26,7 @@ test 3 3: Working Directory: [^ ]*Tests/RunCMake/add_test/TestLauncher-build 3: Test timeout computed to be: [0-9]+ -3/5 Test #3: DoesNotUseTestLauncherWithGenex [.]* +Passed +[0-9.]+ sec +3/6 Test #3: DoesNotUseTestLauncherWithGenex [.]* +Passed +[0-9.]+ sec test 4 Start 4: UsesTestLauncherWithExecTargetFromSubdirAddedWithoutGenex + @@ -36,7 +36,7 @@ test 4 ]*Tests/RunCMake/add_test/TestLauncher-build 4: Test timeout computed to be: [0-9]+ 4: Command: "[^"]*/Tests/RunCMake/add_test/TestLauncher-build/TestLauncher(/Debug)?/subdir_exe_no_genex(\.exe)?" -4/5 Test #4: UsesTestLauncherWithExecTargetFromSubdirAddedWithoutGenex [.]* +Passed +[0-9.]+ sec +4/6 Test #4: UsesTestLauncherWithExecTargetFromSubdirAddedWithoutGenex [.]* +Passed +[0-9.]+ sec test 5 Start 5: DoesNotUseTestLauncherWithExecTargetFromSubdirAddedWithGenex + @@ -45,4 +45,14 @@ test 5 5: Working Directory: [^ ]*Tests/RunCMake/add_test/TestLauncher-build 5: Test timeout computed to be: [0-9]+ -5/5 Test #5: DoesNotUseTestLauncherWithExecTargetFromSubdirAddedWithGenex [.]* +Passed +[0-9.]+ sec +5/6 Test #5: DoesNotUseTestLauncherWithExecTargetFromSubdirAddedWithGenex [.]* +Passed +[0-9.]+ sec +test 6 + Start 6: UsesLocalLauncher + +6: Test command: "?[^ +]*[/\]Tests[/\]RunCMake[/\]add_test[/\]TestLauncher-build([/\]Debug)?[/\]local_launcher(\.exe)?"? "[^"]*/Tests/RunCMake/add_test/TestLauncher-build(/Debug)?/use_launcher_local(\.exe)?" +6: Working Directory: [^ +]*/Tests/RunCMake/add_test/TestLauncher-build +6: Test timeout computed to be: [0-9]+ +6: Command: "[^"]*/Tests/RunCMake/add_test/TestLauncher-build(/Debug)?/use_launcher_local(\.exe)?" +6/6 Test #6: UsesLocalLauncher [.]* +Passed +[0-9.]+ sec diff --git a/Tests/RunCMake/add_test/TestLauncher.cmake b/Tests/RunCMake/add_test/TestLauncher.cmake index 023b663..bef441d 100644 --- a/Tests/RunCMake/add_test/TestLauncher.cmake +++ b/Tests/RunCMake/add_test/TestLauncher.cmake @@ -5,6 +5,8 @@ add_test(NAME DoesNotUseLauncher COMMAND ${CMAKE_COMMAND} -E echo "Hi") add_executable(exe main.c) +get_property(test_launcher TARGET exe PROPERTY TEST_LAUNCHER) +set_property(TARGET exe PROPERTY TEST_LAUNCHER "$<1:${test_launcher}>") add_test(NAME UsesTestLauncher COMMAND exe) @@ -19,3 +21,8 @@ add_test(NAME UsesTestLauncherWithExecTargetFromSubdirAddedWithoutGenex add_test(NAME DoesNotUseTestLauncherWithExecTargetFromSubdirAddedWithGenex COMMAND $<TARGET_FILE:subdir_exe_with_genex>) + +add_executable(local_launcher ../pseudo_emulator.c) +add_executable(use_launcher_local main.c) +set_property(TARGET use_launcher_local PROPERTY TEST_LAUNCHER "$<TARGET_FILE:local_launcher>") +add_test(NAME UsesLocalLauncher COMMAND use_launcher_local) |