summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CrosscompilingEmulator
diff options
context:
space:
mode:
authorMatt McCormick <matt.mccormick@kitware.com>2015-03-29 02:05:35 (GMT)
committerBrad King <brad.king@kitware.com>2015-04-08 13:06:22 (GMT)
commit9160d6c241adaeacc106d5b2ce4530f223345f22 (patch)
tree9007dabd5a565f77590a4ee20ca14b33c9d79196 /Tests/RunCMake/CrosscompilingEmulator
parente942526b3d9e886da4ce832d9d3adb99cc5ede2f (diff)
downloadCMake-9160d6c241adaeacc106d5b2ce4530f223345f22.zip
CMake-9160d6c241adaeacc106d5b2ce4530f223345f22.tar.gz
CMake-9160d6c241adaeacc106d5b2ce4530f223345f22.tar.bz2
TestGenerator: Add CROSSCOMPILING_EMULATOR support.
Prefix test commands with the CROSSCOMPILING_EMULATOR property for target executables. This allows test suites to be run on the host when crosscompiling.
Diffstat (limited to 'Tests/RunCMake/CrosscompilingEmulator')
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake12
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake8
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/InitialCache.txt.in1
-rw-r--r--Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake1
4 files changed, 22 insertions, 0 deletions
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake
new file mode 100644
index 0000000..0aae06c
--- /dev/null
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest-check.cmake
@@ -0,0 +1,12 @@
+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.")
+endif()
+if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator ^(pseudo_emulator)+$")
+ message(SEND_ERROR "Used emulator when it should not be used.")
+endif()
+if(NOT testfile_contents MATCHES "add_test[(]UsesEmulator .+pseudo_emulator.+$")
+ message(SEND_ERROR "Did not use emulator when it should be used.")
+endif()
diff --git a/Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake b/Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake
new file mode 100644
index 0000000..41850f2
--- /dev/null
+++ b/Tests/RunCMake/CrosscompilingEmulator/AddTest.cmake
@@ -0,0 +1,8 @@
+set(CMAKE_CROSSCOMPILING 1)
+enable_testing()
+add_test(NAME DoesNotUseEmulator
+ COMMAND ${CMAKE_COMMAND} -E echo "Hi")
+
+add_executable(generated_exe simple_src.cxx)
+add_test(NAME UsesEmulator
+ COMMAND generated_exe)
diff --git a/Tests/RunCMake/CrosscompilingEmulator/InitialCache.txt.in b/Tests/RunCMake/CrosscompilingEmulator/InitialCache.txt.in
new file mode 100644
index 0000000..c95fd8b
--- /dev/null
+++ b/Tests/RunCMake/CrosscompilingEmulator/InitialCache.txt.in
@@ -0,0 +1 @@
+CMAKE_EMULATOR:STRING=@PSEUDO_EMULATOR@
diff --git a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake
index 04fb7db..2581cfc 100644
--- a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake
@@ -5,3 +5,4 @@ set(RunCMake_TEST_OPTIONS
run_cmake(CrosscompilingEmulatorProperty)
run_cmake(TryRun)
+run_cmake(AddTest)