summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Tests/RunCMake/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand-build-check.cmake3
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake5
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg-build-check.cmake3
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg.cmake3
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget.cmake5
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddCustomTargetWithArg.cmake3
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-check.cmake20
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-test-stdout.txt46
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW.cmake14
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-check.cmake20
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-test-stdout.txt48
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD.cmake15
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake25
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddTest-test-stdout.txt58
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake20
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddTest/CMakeLists.txt7
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/CrosscompilingEmulatorProperty.cmake8
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake21
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/TryRun.cmake7
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/emulator_unexpected.c (renamed from Tests/RunCMake/CrosscompilingEmulator/generated_exe_emulator_unexpected.cxx)3
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/main.c4
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/simple_src_exiterror.c4
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/simple_src_exiterror.cxx4
-rw-r--r--Tests/RunCMake/add_test/RunCMakeTest.cmake19
-rw-r--r--Tests/RunCMake/add_test/TestLauncher-check.cmake30
-rw-r--r--Tests/RunCMake/add_test/TestLauncher-test-stdout.txt48
-rw-r--r--Tests/RunCMake/add_test/TestLauncher.cmake15
-rw-r--r--Tests/RunCMake/add_test/TestLauncher/CMakeLists.txt11
-rw-r--r--Tests/RunCMake/add_test/TestLauncherProperty.cmake17
-rw-r--r--Tests/RunCMake/add_test/main.c4
-rw-r--r--Tests/RunCMake/add_test/simple_src_exiterror.cxx4
-rw-r--r--Tests/RunCMake/pseudo_emulator.c12
34 files changed, 389 insertions, 121 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 4aad417..f1baf92 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -490,7 +490,7 @@ add_RunCMake_test(add_dependencies)
add_RunCMake_test(add_executable)
add_RunCMake_test(add_library)
add_RunCMake_test(add_subdirectory -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER})
-add_RunCMake_test(add_test)
+add_RunCMake_test(add_test -DPSEUDO_EMULATOR=$<TARGET_FILE:pseudo_emulator>)
add_RunCMake_test(build_command)
add_executable(exit_code exit_code.c)
set(execute_process_ARGS
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand-build-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand-build-check.cmake
index e10b161..67fe8ec 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand-build-check.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand-build-check.cmake
@@ -1,5 +1,6 @@
foreach(output IN ITEMS output1 output2 output3 output4)
if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/${output}")
- message(FATAL_ERROR "Failed to create output: ${RunCMake_TEST_BINARY_DIR}/${output}")
+ set(RunCMake_TEST_FAILED "Failed to create output:\n ${RunCMake_TEST_BINARY_DIR}/${output}")
+ return()
endif()
endforeach()
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake
index 9fcc5bc..30cbbe3 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommand.cmake
@@ -1,10 +1,11 @@
+enable_language(C)
set(CMAKE_CROSSCOMPILING 1)
# Executable: Return error code different from 0
-add_executable(generated_exe_emulator_expected simple_src_exiterror.cxx)
+add_executable(generated_exe_emulator_expected simple_src_exiterror.c)
# Executable: Return error code equal to 0
-add_executable(generated_exe_emulator_unexpected generated_exe_emulator_unexpected.cxx)
+add_executable(generated_exe_emulator_unexpected emulator_unexpected.c)
# Place the executable in a predictable location.
set_property(TARGET generated_exe_emulator_unexpected PROPERTY RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_BINARY_DIR}>)
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg-build-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg-build-check.cmake
index 9ca6106..691191d 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg-build-check.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg-build-check.cmake
@@ -1,3 +1,4 @@
if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/output")
- message(FATAL_ERROR "Failed to create output: ${RunCMake_TEST_BINARY_DIR}/output")
+ set(RunCMake_TEST_FAILED "Failed to create output:\n ${RunCMake_TEST_BINARY_DIR}/output")
+ return()
endif()
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg.cmake
index d9059ca..be30dbc 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomCommandWithArg.cmake
@@ -1,7 +1,8 @@
+enable_language(C)
set(CMAKE_CROSSCOMPILING 1)
# Executable: Return error code different from 0
-add_executable(generated_exe_emulator_expected simple_src_exiterror.cxx)
+add_executable(generated_exe_emulator_expected simple_src_exiterror.c)
add_custom_command(OUTPUT output
COMMAND generated_exe_emulator_expected
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget.cmake
index 5b01abc..3682577 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomTarget.cmake
@@ -1,10 +1,11 @@
+enable_language(C)
set(CMAKE_CROSSCOMPILING 1)
# Executable: Return error code different from 0
-add_executable(generated_exe_emulator_expected simple_src_exiterror.cxx)
+add_executable(generated_exe_emulator_expected simple_src_exiterror.c)
# Executable: Return error code equal to 0
-add_executable(generated_exe_emulator_unexpected generated_exe_emulator_unexpected.cxx)
+add_executable(generated_exe_emulator_unexpected emulator_unexpected.c)
# Place the executable in a predictable location.
set_property(TARGET generated_exe_emulator_unexpected PROPERTY RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_BINARY_DIR}>)
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddCustomTargetWithArg.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddCustomTargetWithArg.cmake
index dcd80d5..e98c66f 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddCustomTargetWithArg.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddCustomTargetWithArg.cmake
@@ -1,7 +1,8 @@
+enable_language(C)
set(CMAKE_CROSSCOMPILING 1)
# Executable: Return error code different from 0
-add_executable(generated_exe_emulator_expected simple_src_exiterror.cxx)
+add_executable(generated_exe_emulator_expected simple_src_exiterror.c)
add_custom_target(generate_output ALL
generated_exe_emulator_expected
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-check.cmake
index 8a6a702..6d5128a 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-check.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW-check.cmake
@@ -2,27 +2,33 @@ set(testfile "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake")
if(EXISTS "${testfile}")
file(READ "${testfile}" testfile_contents)
else()
- message(FATAL_ERROR "Could not find expected CTestTestfile.cmake.")
+ set(RunCMake_TEST_FAILED "Could not find expected CTestTestfile.cmake.")
+ return()
endif()
-set(error_details "There is a problem with generated test file: ${testfile}")
+set(error_details "There is a problem with generated test file:\n ${testfile}")
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator [^\n]+pseudo_emulator[^\n]+\n")
- message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
+ set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
+ return()
endif()
if(testfile_contents MATCHES "add_test[(]ShouldNotUseEmulator [^\n]+pseudo_emulator[^\n]+\n")
- message(SEND_ERROR "Used emulator when it should be used. ${error_details}")
+ set(RunCMake_TEST_FAILED "Used emulator when it should be used. ${error_details}")
+ return()
endif()
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithGenex [^\n]+pseudo_emulator[^\n]+\n")
- message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
+ set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
+ return()
endif()
if(testfile_contents MATCHES "add_test[(]ShouldNotUseEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_emulator[^\n]+\n")
- message(SEND_ERROR "Used emulator when it should be used. ${error_details}")
+ set(RunCMake_TEST_FAILED "Used emulator when it should be used. ${error_details}")
+ return()
endif()
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [^\n]+pseudo_emulator[^\n]+\n")
- message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
+ set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
+ return()
endif()
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-NEW.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW.cmake
index 9f9547c..5550b91 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-NEW.cmake
@@ -1,5 +1,7 @@
+enable_language(C)
+enable_testing()
if(CMAKE_CROSSCOMPILING)
- message(FATAL_ERROR "cross compiling")
+ message(FATAL_ERROR "cross compiling")
endif()
cmake_policy(SET CMP0158 NEW)
@@ -8,18 +10,18 @@ enable_testing()
add_test(NAME DoesNotUseEmulator
COMMAND ${CMAKE_COMMAND} -E echo "Hi")
-add_executable(generated_exe simple_src_exiterror.cxx)
+add_executable(exe main.c)
add_test(NAME ShouldNotUseEmulator
- COMMAND generated_exe)
+ COMMAND exe)
add_test(NAME DoesNotUseEmulatorWithGenex
- COMMAND $<TARGET_FILE:generated_exe>)
+ COMMAND $<TARGET_FILE:exe>)
add_subdirectory(AddTest)
add_test(NAME ShouldNotUseEmulatorWithExecTargetFromSubdirAddedWithoutGenex
- COMMAND generated_exe_in_subdir_added_to_test_without_genex)
+ COMMAND subdir_exe_no_genex)
add_test(NAME DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex
- COMMAND $<TARGET_FILE:generated_exe_in_subdir_added_to_test_with_genex>)
+ COMMAND $<TARGET_FILE:subdir_exe_with_genex>)
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-check.cmake
index 588b77b..079e45c 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-check.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD-check.cmake
@@ -2,27 +2,33 @@ set(testfile "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake")
if(EXISTS "${testfile}")
file(READ "${testfile}" testfile_contents)
else()
- message(FATAL_ERROR "Could not find expected CTestTestfile.cmake.")
+ set(RunCMake_TEST_FAILED "Could not find expected CTestTestfile.cmake.")
+ return()
endif()
-set(error_details "There is a problem with generated test file: ${testfile}")
+set(error_details "There is a problem with generated test file:\n ${testfile}")
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator [^\n]+pseudo_emulator[^\n]+\n")
- message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
+ set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
+ return()
endif()
if(NOT testfile_contents MATCHES "add_test[(]UsesEmulator [^\n]+pseudo_emulator[^\n]+\n")
- message(SEND_ERROR "Did not use emulator when it should be used. ${error_details}")
+ set(RunCMake_TEST_FAILED "Did not use emulator when it should be used. ${error_details}")
+ return()
endif()
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithGenex [^\n]+pseudo_emulator[^\n]+\n")
- message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
+ set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
+ return()
endif()
if(NOT testfile_contents MATCHES "add_test[(]UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_emulator[^\n]+\n")
- message(SEND_ERROR "Did not use emulator when it should be used. ${error_details}")
+ set(RunCMake_TEST_FAILED "Did not use emulator when it should be used. ${error_details}")
+ return()
endif()
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [^\n]+pseudo_emulator[^\n]+\n")
- message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
+ set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
+ return()
endif()
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-CMP0158-OLD.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD.cmake
index 910f1b4..e85fd40 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-CMP0158-OLD.cmake
@@ -1,25 +1,26 @@
+enable_language(C)
+enable_testing()
if(CMAKE_CROSSCOMPILING)
- message(FATAL_ERROR "cross compiling")
+ message(FATAL_ERROR "cross compiling")
endif()
cmake_policy(SET CMP0158 OLD)
-enable_testing()
add_test(NAME DoesNotUseEmulator
COMMAND ${CMAKE_COMMAND} -E echo "Hi")
-add_executable(generated_exe simple_src_exiterror.cxx)
+add_executable(exe main.c)
add_test(NAME UsesEmulator
- COMMAND generated_exe)
+ COMMAND exe)
add_test(NAME DoesNotUseEmulatorWithGenex
- COMMAND $<TARGET_FILE:generated_exe>)
+ COMMAND $<TARGET_FILE:exe>)
add_subdirectory(AddTest)
add_test(NAME UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex
- COMMAND generated_exe_in_subdir_added_to_test_without_genex)
+ COMMAND subdir_exe_no_genex)
add_test(NAME DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex
- COMMAND $<TARGET_FILE:generated_exe_in_subdir_added_to_test_with_genex>)
+ COMMAND $<TARGET_FILE:subdir_exe_with_genex>)
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake
index 459e922..bd2c8bf 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake
@@ -2,31 +2,38 @@ set(testfile "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake")
if(EXISTS "${testfile}")
file(READ "${testfile}" testfile_contents)
else()
- message(FATAL_ERROR "Could not find expected CTestTestfile.cmake.")
+ set(RunCMake_TEST_FAILED "Could not find expected CTestTestfile.cmake.")
+ return()
endif()
-set(error_details "There is a problem with generated test file: ${testfile}")
+set(error_details "There is a problem with generated test file:\n ${testfile}")
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator [^\n]+pseudo_emulator[^\n]+\n")
- message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
+ set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
+ return()
endif()
if(NOT testfile_contents MATCHES "add_test[(]UsesEmulator [^\n]+pseudo_emulator[^\n]+\n")
- message(SEND_ERROR "Did not use emulator when it should be used. ${error_details}")
+ set(RunCMake_TEST_FAILED "Did not use emulator when it should be used. ${error_details}")
+ return()
endif()
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithGenex [^\n]+pseudo_emulator[^\n]+\n")
- message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
+ set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
+ return()
endif()
if(NOT testfile_contents MATCHES "add_test[(]UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_emulator[^\n]+\n")
- message(SEND_ERROR "Did not use emulator when it should be used. ${error_details}")
+ set(RunCMake_TEST_FAILED "Did not use emulator when it should be used. ${error_details}")
+ return()
endif()
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [^\n]+pseudo_emulator[^\n]+\n")
- message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
+ set(RunCMake_TEST_FAILED "Used emulator when it should not be used. ${error_details}")
+ return()
endif()
-if(NOT testfile_contents MATCHES "add_test[(]UsesTestLauncherAndEmulator[^\n]+pseudo_test_launcher.*pseudo_emulator[^\n]+\n")
- message(SEND_ERROR "Did not use test launcher and emulator when they should be used. ${error_details}")
+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 4bcb2cf..e021d87 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake
@@ -1,26 +1,28 @@
-set(CMAKE_CROSSCOMPILING 1)
+enable_language(C)
enable_testing()
+set(CMAKE_CROSSCOMPILING 1)
+
add_test(NAME DoesNotUseEmulator
COMMAND ${CMAKE_COMMAND} -E echo "Hi")
-add_executable(generated_exe simple_src_exiterror.cxx)
+add_executable(exe main.c)
add_test(NAME UsesEmulator
- COMMAND generated_exe)
+ COMMAND exe)
add_test(NAME DoesNotUseEmulatorWithGenex
- COMMAND $<TARGET_FILE:generated_exe>)
+ COMMAND $<TARGET_FILE:exe>)
add_subdirectory(AddTest)
add_test(NAME UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex
- COMMAND generated_exe_in_subdir_added_to_test_without_genex)
+ COMMAND subdir_exe_no_genex)
add_test(NAME DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex
- COMMAND $<TARGET_FILE:generated_exe_in_subdir_added_to_test_with_genex>)
+ COMMAND $<TARGET_FILE:subdir_exe_with_genex>)
-add_executable(generated_exe_test_launcher simple_src_exiterror.cxx)
-set_property(TARGET generated_exe_test_launcher PROPERTY TEST_LAUNCHER "pseudo_test_launcher")
+set(CMAKE_TEST_LAUNCHER ${CMAKE_CROSSCOMPILING_EMULATOR})
+add_executable(exe_test_launcher main.c)
add_test(NAME UsesTestLauncherAndEmulator
- COMMAND generated_exe_test_launcher)
+ COMMAND exe_test_launcher)
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest/CMakeLists.txt b/Tests/RunCMake/CrosscompilingEmulator/AddTest/CMakeLists.txt
index 025b54c..fa20ae9 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/AddTest/CMakeLists.txt
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest/CMakeLists.txt
@@ -1,5 +1,2 @@
-add_executable(generated_exe_in_subdir_added_to_test_without_genex
- ${CMAKE_CURRENT_SOURCE_DIR}/../simple_src_exiterror.cxx)
-
-add_executable(generated_exe_in_subdir_added_to_test_with_genex
- ${CMAKE_CURRENT_SOURCE_DIR}/../simple_src_exiterror.cxx)
+add_executable(subdir_exe_no_genex ../main.c)
+add_executable(subdir_exe_with_genex ../main.c)
diff --git a/Tests/RunCMake/CrosscompilingEmulator/CMakeLists.txt b/Tests/RunCMake/CrosscompilingEmulator/CMakeLists.txt
index 12a7fd4..93ee9df 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/CMakeLists.txt
+++ b/Tests/RunCMake/CrosscompilingEmulator/CMakeLists.txt
@@ -1,3 +1,3 @@
cmake_minimum_required(VERSION 3.5)
-project(${RunCMake_TEST} CXX)
+project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CrosscompilingEmulator/CrosscompilingEmulatorProperty.cmake b/Tests/RunCMake/CrosscompilingEmulator/CrosscompilingEmulatorProperty.cmake
index 2fdefc4..e9258fd 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/CrosscompilingEmulatorProperty.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/CrosscompilingEmulatorProperty.cmake
@@ -1,9 +1,11 @@
# This tests setting the CROSSCOMPILING_EMULATOR target property from the
# CMAKE_CROSSCOMPILING_EMULATOR variable.
+enable_language(C)
+
# -DCMAKE_CROSSCOMPILING_EMULATOR=/path/to/pseudo_emulator is passed to this
# test
-add_executable(target_with_emulator simple_src_exiterror.cxx)
+add_executable(target_with_emulator main.c)
get_property(emulator TARGET target_with_emulator
PROPERTY CROSSCOMPILING_EMULATOR)
if(NOT "${emulator}" MATCHES "pseudo_emulator")
@@ -20,14 +22,14 @@ if(NOT "${emulator}" MATCHES "another_emulator")
endif()
unset(CMAKE_CROSSCOMPILING_EMULATOR CACHE)
-add_executable(target_without_emulator simple_src_exiterror.cxx)
+add_executable(target_without_emulator main.c)
get_property(emulator TARGET target_without_emulator
PROPERTY CROSSCOMPILING_EMULATOR)
if(NOT "${emulator}" STREQUAL "")
message(SEND_ERROR "Default CROSSCOMPILING_EMULATOR property not set to null")
endif()
-add_executable(target_with_empty_emulator simple_src_exiterror.cxx)
+add_executable(target_with_empty_emulator main.c)
set_property(TARGET target_with_empty_emulator PROPERTY CROSSCOMPILING_EMULATOR "")
enable_testing()
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.
diff --git a/Tests/RunCMake/CrosscompilingEmulator/TryRun.cmake b/Tests/RunCMake/CrosscompilingEmulator/TryRun.cmake
index af3712c..448c924 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/TryRun.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/TryRun.cmake
@@ -1,8 +1,11 @@
+enable_language(C)
set(CMAKE_CROSSCOMPILING 1)
+set(ENV{PSEUDO_EMULATOR_FAIL} 1)
+
try_run(run_result compile_result
${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/simple_src_exiterror.cxx
+ ${CMAKE_CURRENT_SOURCE_DIR}/simple_src_exiterror.c
RUN_OUTPUT_VARIABLE run_output)
message(STATUS "run_output: ${run_output}")
@@ -13,6 +16,6 @@ set(CMAKE_CROSSCOMPILING_EMULATOR ${CMAKE_CROSSCOMPILING_EMULATOR}
"multi arg")
try_run(run_result compile_result
${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/simple_src_exiterror.cxx
+ ${CMAKE_CURRENT_SOURCE_DIR}/simple_src_exiterror.c
RUN_OUTPUT_VARIABLE run_output)
message(STATUS "Emulator with arguments run_output: ${run_output}")
diff --git a/Tests/RunCMake/CrosscompilingEmulator/generated_exe_emulator_unexpected.cxx b/Tests/RunCMake/CrosscompilingEmulator/emulator_unexpected.c
index 233f432..e6bbcff 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/generated_exe_emulator_unexpected.cxx
+++ b/Tests/RunCMake/CrosscompilingEmulator/emulator_unexpected.c
@@ -2,7 +2,8 @@
int main(int argc, const char* argv[])
{
- for (int i = 1; i < argc; ++i) {
+ int i;
+ for (i = 1; i < argc; ++i) {
fprintf(stderr, "unexpected argument: '%s'\n", argv[i]);
}
return argc == 1 ? 0 : 1;
diff --git a/Tests/RunCMake/CrosscompilingEmulator/main.c b/Tests/RunCMake/CrosscompilingEmulator/main.c
new file mode 100644
index 0000000..8488f4e
--- /dev/null
+++ b/Tests/RunCMake/CrosscompilingEmulator/main.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CrosscompilingEmulator/simple_src_exiterror.c b/Tests/RunCMake/CrosscompilingEmulator/simple_src_exiterror.c
new file mode 100644
index 0000000..a388185
--- /dev/null
+++ b/Tests/RunCMake/CrosscompilingEmulator/simple_src_exiterror.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 13;
+}
diff --git a/Tests/RunCMake/CrosscompilingEmulator/simple_src_exiterror.cxx b/Tests/RunCMake/CrosscompilingEmulator/simple_src_exiterror.cxx
deleted file mode 100644
index 6ce7183..0000000
--- a/Tests/RunCMake/CrosscompilingEmulator/simple_src_exiterror.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-int main(int, char**)
-{
- return 13;
-}
diff --git a/Tests/RunCMake/add_test/RunCMakeTest.cmake b/Tests/RunCMake/add_test/RunCMakeTest.cmake
index 8b5c915..6e7d53a 100644
--- a/Tests/RunCMake/add_test/RunCMakeTest.cmake
+++ b/Tests/RunCMake/add_test/RunCMakeTest.cmake
@@ -42,8 +42,19 @@ block()
run_cmake_command(EmptyArgument-ctest ${CMAKE_CTEST_COMMAND} -C Debug)
endblock()
-set(RunCMake_TEST_OPTIONS
- "-DCMAKE_TEST_LAUNCHER=/path/to/pseudo_test_launcher")
-
+set(RunCMake_TEST_OPTIONS "-DCMAKE_TEST_LAUNCHER=${PSEUDO_EMULATOR}")
run_cmake(TestLauncherProperty)
-run_cmake(TestLauncher)
+block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestLauncher-build)
+
+ run_cmake(TestLauncher)
+ unset(RunCMake_TEST_OPTIONS)
+
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
+ run_cmake_command(TestLauncher-build ${CMAKE_COMMAND} --build . --config Debug)
+ unset(RunCMake_TEST_OUTPUT_MERGE)
+
+ run_cmake_command(TestLauncher-test ${CMAKE_CTEST_COMMAND} -C Debug -V)
+endblock()
+unset(RunCMake_TEST_OPTIONS)
diff --git a/Tests/RunCMake/add_test/TestLauncher-check.cmake b/Tests/RunCMake/add_test/TestLauncher-check.cmake
index 78020a6..add1105 100644
--- a/Tests/RunCMake/add_test/TestLauncher-check.cmake
+++ b/Tests/RunCMake/add_test/TestLauncher-check.cmake
@@ -2,27 +2,33 @@ set(testfile "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake")
if(EXISTS "${testfile}")
file(READ "${testfile}" testfile_contents)
else()
- message(FATAL_ERROR "Could not find expected CTestTestfile.cmake.")
+ set(RunCMake_TEST_FAILED "Could not find expected CTestTestfile.cmake.")
+ return()
endif()
-set(error_details "There is a problem with generated test file: ${testfile}")
+set(error_details "There is a problem with generated test file:\n ${testfile}")
-if(testfile_contents MATCHES "add_test[(]DoesNotUseTestLauncher [^\n]+pseudo_test_launcher[^\n]+\n")
- message(SEND_ERROR "Used test launcher when it should not be used. ${error_details}")
+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_test_launcher[^\n]+\n")
- message(SEND_ERROR "Did not use test launcher when it should be used. ${error_details}")
+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_test_launcher[^\n]+\n")
- message(SEND_ERROR "Used test launcher when it should not be used. ${error_details}")
+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_test_launcher[^\n]+\n")
- message(SEND_ERROR "Did not use test launcher when it should be used. ${error_details}")
+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_test_launcher[^\n]+\n")
- message(SEND_ERROR "Used test launcher when it should not be used. ${error_details}")
+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()
diff --git a/Tests/RunCMake/add_test/TestLauncher-test-stdout.txt b/Tests/RunCMake/add_test/TestLauncher-test-stdout.txt
new file mode 100644
index 0000000..10d79d4
--- /dev/null
+++ b/Tests/RunCMake/add_test/TestLauncher-test-stdout.txt
@@ -0,0 +1,48 @@
+test 1
+ Start 1: DoesNotUseLauncher
++
+1: Test command: "?[^
+]*[/\]cmake(\.exe)?"? "-E" "echo" "Hi"
+1: Working Directory: [^
+]*/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
+test 2
+ Start 2: UsesTestLauncher
++
+2: Test command: "?[^
+]*[/\]Tests[/\]RunCMake([/\][^/\]+)?[/\]pseudo_emulator(\.exe)?"? "[^"]*/Tests/RunCMake/add_test/TestLauncher-build(/Debug)?/exe(\.exe)?"
+2: Working Directory: [^
+]*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
+test 3
+ Start 3: DoesNotUseTestLauncherWithGenex
++
+3: Test command: "?[^
+]*[/\]Tests[/\]RunCMake[/\]add_test[/\]TestLauncher-build([/\]Debug)?[/\]exe(\.exe)?"?
+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
+test 4
+ Start 4: UsesTestLauncherWithExecTargetFromSubdirAddedWithoutGenex
++
+4: Test command: "?[^
+]*[/\]Tests[/\]RunCMake([/\][^/\]+)?[/\]pseudo_emulator(\.exe)?"? "[^"]*/Tests/RunCMake/add_test/TestLauncher-build/TestLauncher(/Debug)?/subdir_exe_no_genex(\.exe)?"
+4: Working Directory: [^
+]*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
+test 5
+ Start 5: DoesNotUseTestLauncherWithExecTargetFromSubdirAddedWithGenex
++
+5: Test command: "?[^
+]*[/\]Tests[/\]RunCMake[/\]add_test[/\]TestLauncher-build[/\]TestLauncher([/\]Debug)?[/\]subdir_exe_with_genex(\.exe)?"?
+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
diff --git a/Tests/RunCMake/add_test/TestLauncher.cmake b/Tests/RunCMake/add_test/TestLauncher.cmake
index 8ad3be9..023b663 100644
--- a/Tests/RunCMake/add_test/TestLauncher.cmake
+++ b/Tests/RunCMake/add_test/TestLauncher.cmake
@@ -1,22 +1,21 @@
-project(test_launcher LANGUAGES C)
-
+enable_language(C)
enable_testing()
+
add_test(NAME DoesNotUseLauncher
COMMAND ${CMAKE_COMMAND} -E echo "Hi")
-add_executable(generated_exe simple_src_exiterror.cxx)
-set_target_properties(generated_exe PROPERTIES LINKER_LANGUAGE C)
+add_executable(exe main.c)
add_test(NAME UsesTestLauncher
- COMMAND generated_exe)
+ COMMAND exe)
add_test(NAME DoesNotUseTestLauncherWithGenex
- COMMAND $<TARGET_FILE:generated_exe>)
+ COMMAND $<TARGET_FILE:exe>)
add_subdirectory(TestLauncher)
add_test(NAME UsesTestLauncherWithExecTargetFromSubdirAddedWithoutGenex
- COMMAND generated_exe_in_subdir_added_to_test_without_genex)
+ COMMAND subdir_exe_no_genex)
add_test(NAME DoesNotUseTestLauncherWithExecTargetFromSubdirAddedWithGenex
- COMMAND $<TARGET_FILE:generated_exe_in_subdir_added_to_test_with_genex>)
+ COMMAND $<TARGET_FILE:subdir_exe_with_genex>)
diff --git a/Tests/RunCMake/add_test/TestLauncher/CMakeLists.txt b/Tests/RunCMake/add_test/TestLauncher/CMakeLists.txt
index fb40a59..fa20ae9 100644
--- a/Tests/RunCMake/add_test/TestLauncher/CMakeLists.txt
+++ b/Tests/RunCMake/add_test/TestLauncher/CMakeLists.txt
@@ -1,9 +1,2 @@
-add_executable(generated_exe_in_subdir_added_to_test_without_genex
- ${CMAKE_CURRENT_SOURCE_DIR}/../simple_src_exiterror.cxx)
-set_target_properties(generated_exe_in_subdir_added_to_test_without_genex
- PROPERTIES LINKER_LANGUAGE C)
-
-add_executable(generated_exe_in_subdir_added_to_test_with_genex
- ${CMAKE_CURRENT_SOURCE_DIR}/../simple_src_exiterror.cxx)
-set_target_properties(generated_exe_in_subdir_added_to_test_with_genex
- PROPERTIES LINKER_LANGUAGE C)
+add_executable(subdir_exe_no_genex ../main.c)
+add_executable(subdir_exe_with_genex ../main.c)
diff --git a/Tests/RunCMake/add_test/TestLauncherProperty.cmake b/Tests/RunCMake/add_test/TestLauncherProperty.cmake
index e86f42b..3bc49e6 100644
--- a/Tests/RunCMake/add_test/TestLauncherProperty.cmake
+++ b/Tests/RunCMake/add_test/TestLauncherProperty.cmake
@@ -2,16 +2,15 @@
# This tests setting the TEST_LAUNCHER target property from the
# CMAKE_TEST_LAUNCHER variable.
-# -DCMAKE_TEST_LAUNCHER=/path/to/pseudo_test_launcher is passed to this
-# test
+enable_language(C)
-project(test_launcher LANGUAGES C)
+# -DCMAKE_TEST_LAUNCHER=/path/to/pseudo_emulator is passed to this
+# test
-add_executable(target_with_test_launcher simple_src_exiterror.cxx)
-set_target_properties(target_with_test_launcher PROPERTIES LINKER_LANGUAGE C)
+add_executable(target_with_test_launcher main.c)
get_property(launcher TARGET target_with_test_launcher
PROPERTY TEST_LAUNCHER)
-if(NOT "${launcher}" MATCHES "pseudo_test_launcher")
+if(NOT "${launcher}" MATCHES "pseudo_emulator")
message(SEND_ERROR "Default TEST_LAUNCHER property not set")
endif()
@@ -25,16 +24,14 @@ if(NOT "${launcher}" MATCHES "another_test_launcher")
endif()
unset(CMAKE_TEST_LAUNCHER CACHE)
-add_executable(target_without_test_launcher simple_src_exiterror.cxx)
-set_target_properties(target_without_test_launcher PROPERTIES LINKER_LANGUAGE C)
+add_executable(target_without_test_launcher main.c)
get_property(launcher TARGET target_without_test_launcher
PROPERTY TEST_LAUNCHER)
if(NOT "${launcher}" STREQUAL "")
message(SEND_ERROR "Default TEST_LAUNCHER property not set to null")
endif()
-add_executable(target_with_empty_test_launcher simple_src_exiterror.cxx)
-set_target_properties(target_with_empty_test_launcher PROPERTIES LINKER_LANGUAGE C)
+add_executable(target_with_empty_test_launcher main.c)
set_property(TARGET target_with_empty_test_launcher PROPERTY TEST_LAUNCHER "")
enable_testing()
diff --git a/Tests/RunCMake/add_test/main.c b/Tests/RunCMake/add_test/main.c
new file mode 100644
index 0000000..8488f4e
--- /dev/null
+++ b/Tests/RunCMake/add_test/main.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/add_test/simple_src_exiterror.cxx b/Tests/RunCMake/add_test/simple_src_exiterror.cxx
deleted file mode 100644
index 6ce7183..0000000
--- a/Tests/RunCMake/add_test/simple_src_exiterror.cxx
+++ /dev/null
@@ -1,4 +0,0 @@
-int main(int, char**)
-{
- return 13;
-}
diff --git a/Tests/RunCMake/pseudo_emulator.c b/Tests/RunCMake/pseudo_emulator.c
index 15f64dc..cc921f0 100644
--- a/Tests/RunCMake/pseudo_emulator.c
+++ b/Tests/RunCMake/pseudo_emulator.c
@@ -1,8 +1,14 @@
+#ifndef _CRT_SECURE_NO_WARNINGS
+# define _CRT_SECURE_NO_WARNINGS
+#endif
+
#include <stdio.h>
+#include <stdlib.h>
int main(int argc, char* argv[])
{
int ii;
+ const char* fail = getenv("PSEUDO_EMULATOR_FAIL");
printf("Command:");
for (ii = 1; ii < argc; ++ii) {
@@ -10,5 +16,9 @@ int main(int argc, char* argv[])
}
printf("\n");
- return 42;
+ if (fail && *fail) {
+ return 42;
+ }
+
+ return 0;
}