mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-20 06:00:30 -06:00
Tests: Improve RunCMake.CrosscompilingEmulator coverage
Verify that ctest actually runs the test command lines as expected.
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user