diff options
author | Brad King <brad.king@kitware.com> | 2024-01-26 20:06:55 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-01-27 16:34:35 (GMT) |
commit | b440e0af3f2b5bcc12ed38c499102532250aa4be (patch) | |
tree | 236e0eb1ce25f2616ae3ad1dbea2327606c4d882 /Tests | |
parent | 54edf3471e470595dd18e9dcc8d0bc59bab75559 (diff) | |
download | CMake-b440e0af3f2b5bcc12ed38c499102532250aa4be.zip CMake-b440e0af3f2b5bcc12ed38c499102532250aa4be.tar.gz CMake-b440e0af3f2b5bcc12ed38c499102532250aa4be.tar.bz2 |
Tests: Improve RunCMake.CrosscompilingEmulator coverage
Verify that ctest actually runs the test command lines as expected.
Diffstat (limited to 'Tests')
6 files changed, 172 insertions, 5 deletions
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-test-stdout.txt b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-test-stdout.txt new file mode 100644 index 0000000..a43c2f0 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-test-stdout.txt @@ -0,0 +1,46 @@ +test 1 + Start 1: DoesNotUseEmulator + +1: Test command: "?[^ +]*[/\]cmake(\.exe)?"? "-E" "echo" "Hi" +1: Working Directory: [^ +]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-build +1: Test timeout computed to be: [0-9]+ +1: Hi +1/5 Test #1: DoesNotUseEmulator [.]* +Passed +[0-9.]+ sec +test 2 + Start 2: ShouldNotUseEmulator + +2: Test command: "?[^ +]*[/\]Tests[/\]RunCMake[/\]CrosscompilingEmulator[/\]AddTest-CMP0158-NEW-build([/\]Debug)?[/\]exe(\.exe)?"? +2: Working Directory: [^ +]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-build +2: Test timeout computed to be: [0-9]+ +2/5 Test #2: ShouldNotUseEmulator [.]* +Passed +[0-9.]+ sec +test 3 + Start 3: DoesNotUseEmulatorWithGenex + +3: Test command: "?[^ +]*[/\]Tests[/\]RunCMake[/\]CrosscompilingEmulator[/\]AddTest-CMP0158-NEW-build([/\]Debug)?[/\]exe(\.exe)?"? +3: Working Directory: [^ +]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-build +3: Test timeout computed to be: [0-9]+ +3/5 Test #3: DoesNotUseEmulatorWithGenex [.]* +Passed +[0-9.]+ sec +test 4 + Start 4: ShouldNotUseEmulatorWithExecTargetFromSubdirAddedWithoutGenex + +4: Test command: "?[^ +]*[/\]Tests[/\]RunCMake[/\]CrosscompilingEmulator[/\]AddTest-CMP0158-NEW-build[/\]AddTest([/\]Debug)?[/\]subdir_exe_no_genex(\.exe)?"? +4: Working Directory: [^ +]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-build +4: Test timeout computed to be: [0-9]+ +4/5 Test #4: ShouldNotUseEmulatorWithExecTargetFromSubdirAddedWithoutGenex [.]* +Passed +[0-9.]+ sec +test 5 + Start 5: DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex + +5: Test command: "?[^ +]*[/\]Tests[/\]RunCMake[/\]CrosscompilingEmulator[/\]AddTest-CMP0158-NEW-build[/\]AddTest([/\]Debug)?[/\]subdir_exe_with_genex(\.exe)?"? +5: Working Directory: [^ +]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-build +5: Test timeout computed to be: [0-9]+ +5/5 Test #5: DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [.]* +Passed +[0-9.]+ sec diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-test-stdout.txt b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-test-stdout.txt new file mode 100644 index 0000000..683a866 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-test-stdout.txt @@ -0,0 +1,48 @@ +test 1 + Start 1: DoesNotUseEmulator + +1: Test command: "?[^ +]*[/\]cmake(\.exe)?"? "-E" "echo" "Hi" +1: Working Directory: [^ +]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-build +1: Test timeout computed to be: [0-9]+ +1: Hi +1/5 Test #1: DoesNotUseEmulator [.]* +Passed +[0-9.]+ sec +test 2 + Start 2: UsesEmulator + +2: Test command: "?[^ +]*[/\]Tests[/\]RunCMake([/\][^/\]+)?[/\]pseudo_emulator(\.exe)?"? "[^"]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-build(/Debug)?/exe(\.exe)?" +2: Working Directory: [^ +]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-build +2: Test timeout computed to be: [0-9]+ +2: Command: "[^"]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-build(/Debug)?/exe(\.exe)?" +2/5 Test #2: UsesEmulator [.]* +Passed +[0-9.]+ sec +test 3 + Start 3: DoesNotUseEmulatorWithGenex + +3: Test command: "?[^ +]*[/\]Tests[/\]RunCMake[/\]CrosscompilingEmulator[/\]AddTest-CMP0158-OLD-build([/\]Debug)?[/\]exe(\.exe)?"? +3: Working Directory: [^ +]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-build +3: Test timeout computed to be: [0-9]+ +3/5 Test #3: DoesNotUseEmulatorWithGenex [.]* +Passed +[0-9.]+ sec +test 4 + Start 4: UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex + +4: Test command: "?[^ +]*[/\]Tests[/\]RunCMake([/\][^/\]+)?[/\]pseudo_emulator(\.exe)?"? "[^"]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-build/AddTest(/Debug)?/subdir_exe_no_genex(\.exe)?" +4: Working Directory: [^ +]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-build +4: Test timeout computed to be: [0-9]+ +4: Command: "[^"]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-build/AddTest(/Debug)?/subdir_exe_no_genex(\.exe)?" +4/5 Test #4: UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex [.]* +Passed +[0-9.]+ sec +test 5 + Start 5: DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex + +5: Test command: "?[^ +]*[/\]Tests[/\]RunCMake[/\]CrosscompilingEmulator[/\]AddTest-CMP0158-OLD-build[/\]AddTest([/\]Debug)?[/\]subdir_exe_with_genex(\.exe)?"? +5: Working Directory: [^ +]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-build +5: Test timeout computed to be: [0-9]+ +5/5 Test #5: DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [.]* +Passed +[0-9.]+ sec diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake index 81b145b..bd2c8bf 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake @@ -33,7 +33,7 @@ if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSub return() endif() -if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncherAndEmulator[^\n]+pseudo_test_launcher.*pseudo_emulator[^\n]+\n") +if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncherAndEmulator[^\n]+pseudo_emulator[^\n]+pseudo_emulator[^\n]+\n") set(RunCMake_TEST_FAILED "Did not use test launcher and emulator when they should be used. ${error_details}") return() endif() diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest-test-stdout.txt b/Tests/RunCMake/CrosscompilingEmulator/AddTest-test-stdout.txt new file mode 100644 index 0000000..214870e --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-test-stdout.txt @@ -0,0 +1,58 @@ +test 1 + Start 1: DoesNotUseEmulator + +1: Test command: "?[^ +]*[/\]cmake(\.exe)?"? "-E" "echo" "Hi" +1: Working Directory: [^ +]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build +1: Test timeout computed to be: [0-9]+ +1: Hi +1/6 Test #1: DoesNotUseEmulator [.]* +Passed +[0-9.]+ sec +test 2 + Start 2: UsesEmulator + +2: Test command: "?[^ +]*[/\]Tests[/\]RunCMake([/\][^/\]+)?[/\]pseudo_emulator(\.exe)?"? "[^"]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build(/Debug)?/exe(\.exe)?" +2: Working Directory: [^ +]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build +2: Test timeout computed to be: [0-9]+ +2: Command: "[^"]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build(/Debug)?/exe(\.exe)?" +2/6 Test #2: UsesEmulator [.]* +Passed +[0-9.]+ sec +test 3 + Start 3: DoesNotUseEmulatorWithGenex + +3: Test command: "?[^ +]*[/\]Tests[/\]RunCMake[/\]CrosscompilingEmulator[/\]AddTest-build([/\]Debug)?[/\]exe(\.exe)?"? +3: Working Directory: [^ +]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build +3: Test timeout computed to be: [0-9]+ +3/6 Test #3: DoesNotUseEmulatorWithGenex [.]* +Passed +[0-9.]+ sec +test 4 + Start 4: UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex + +4: Test command: "?[^ +]*[/\]Tests[/\]RunCMake([/\][^/\]+)?[/\]pseudo_emulator(\.exe)?"? "[^"]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build/AddTest(/Debug)?/subdir_exe_no_genex(\.exe)?" +4: Working Directory: [^ +]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build +4: Test timeout computed to be: [0-9]+ +4: Command: "[^"]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build/AddTest(/Debug)?/subdir_exe_no_genex(\.exe)?" +4/6 Test #4: UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex [.]* +Passed +[0-9.]+ sec +test 5 + Start 5: DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex + +5: Test command: "?[^ +]*[/\]Tests[/\]RunCMake[/\]CrosscompilingEmulator[/\]AddTest-build[/\]AddTest([/\]Debug)?[/\]subdir_exe_with_genex(\.exe)?"? +5: Working Directory: [^ +]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build +5: Test timeout computed to be: [0-9]+ +5/6 Test #5: DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [.]* +Passed +[0-9.]+ sec +test 6 + Start 6: UsesTestLauncherAndEmulator + +6: Test command: "?[^ +]*[/\]Tests[/\]RunCMake([/\][^/\]+)?[/\]pseudo_emulator(\.exe)?"? "[^"]*/Tests/RunCMake(/[^/]+)?/pseudo_emulator(\.exe)?" "[^"]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build(/Debug)?/exe_test_launcher(\.exe)?" +6: Working Directory: [^ +]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build +6: Test timeout computed to be: [0-9]+ +6: Command: "[^"]*/Tests/RunCMake(/[^/]+)?/pseudo_emulator(\.exe)?" "[^"]*/Tests/RunCMake/CrosscompilingEmulator/AddTest-build(/Debug)?/exe_test_launcher(\.exe)?" +6/6 Test #6: UsesTestLauncherAndEmulator [.]* +Passed +[0-9.]+ sec diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake index 15ec4ff..e021d87 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake @@ -21,8 +21,8 @@ add_test(NAME UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex add_test(NAME DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex COMMAND $<TARGET_FILE:subdir_exe_with_genex>) +set(CMAKE_TEST_LAUNCHER ${CMAKE_CROSSCOMPILING_EMULATOR}) add_executable(exe_test_launcher main.c) -set_property(TARGET exe_test_launcher PROPERTY TEST_LAUNCHER "pseudo_test_launcher") add_test(NAME UsesTestLauncherAndEmulator COMMAND exe_test_launcher) diff --git a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake index c595f1a..f32099f 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake @@ -5,9 +5,24 @@ set(RunCMake_TEST_OPTIONS run_cmake(CrosscompilingEmulatorProperty) run_cmake(TryRun) -run_cmake(AddTest) -run_cmake(AddTest-CMP0158-OLD) -run_cmake(AddTest-CMP0158-NEW) + +function(run_AddTest case) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build) + + run_cmake(${case}) + unset(RunCMake_TEST_OPTIONS) + + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(${case}-build ${CMAKE_COMMAND} --build . --config Debug) + unset(RunCMake_TEST_OUTPUT_MERGE) + + run_cmake_command(${case}-test ${CMAKE_CTEST_COMMAND} -C Debug -V) +endfunction() + +run_AddTest(AddTest) +run_AddTest(AddTest-CMP0158-OLD) +run_AddTest(AddTest-CMP0158-NEW) function(CustomCommandGenerator_run_and_build case) # Use a single build tree for a few tests without cleaning. |