summaryrefslogtreecommitdiff
path: root/Tests/RunCMake/build_command
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-03-12 18:07:52 -0400
committerBrad King <brad.king@kitware.com>2013-03-12 18:09:22 -0400
commit4e5cb375901293e8fedb5d8e44d1481e3f6799d6 (patch)
treeca3ce460d02cb27aec0334dfbb7bbc4702e6865e /Tests/RunCMake/build_command
parent153242601e22d6f06e1f14dc55d70c2a42b2ec5f (diff)
downloadcmake-4e5cb375901293e8fedb5d8e44d1481e3f6799d6.tar.gz
Refactor RunCMake.build_command test to allow more cases
Move the ErrorsOFF/ON common logic from CMakeLists.txt into an ErrorsCommon file to allow other test cases to be added that do not use the Errors test logic.
Diffstat (limited to 'Tests/RunCMake/build_command')
-rw-r--r--Tests/RunCMake/build_command/CMakeLists.txt56
-rw-r--r--Tests/RunCMake/build_command/ErrorsCommon.cmake55
-rw-r--r--Tests/RunCMake/build_command/ErrorsOFF.cmake1
-rw-r--r--Tests/RunCMake/build_command/ErrorsON-stderr.txt15
-rw-r--r--Tests/RunCMake/build_command/ErrorsON.cmake1
5 files changed, 69 insertions, 59 deletions
diff --git a/Tests/RunCMake/build_command/CMakeLists.txt b/Tests/RunCMake/build_command/CMakeLists.txt
index 0fbb94803a..e8db6b05be 100644
--- a/Tests/RunCMake/build_command/CMakeLists.txt
+++ b/Tests/RunCMake/build_command/CMakeLists.txt
@@ -1,59 +1,3 @@
cmake_minimum_required(VERSION 2.8)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
-
-# This CMakeLists file is *sometimes expected* to result in a configure error.
-#
-# expect this to succeed:
-# ../bin/Release/cmake -G Xcode
-# ../../CMake/Tests/CMakeCommands/build_command
-#
-# expect this to fail:
-# ../bin/Release/cmake -DTEST_ERROR_CONDITIONS:BOOL=ON -G Xcode
-# ../../CMake/Tests/CMakeCommands/build_command
-#
-# This project exists merely to test the CMake command 'build_command'...
-# ...even purposefully calling it with known-bad argument lists to cover
-# error handling code.
-#
-
-set(cmd "initial")
-
-message("0. begin")
-
-if(TEST_ERROR_CONDITIONS)
- # Test with no arguments (an error):
- build_command()
- message("1. cmd='${cmd}'")
-
- # Test with unknown arguments (also an error):
- build_command(cmd BOGUS STUFF)
- message("2. cmd='${cmd}'")
-
- build_command(cmd STUFF BOGUS)
- message("3. cmd='${cmd}'")
-else()
- message("(skipping cases 1, 2 and 3 because TEST_ERROR_CONDITIONS is OFF)")
-endif()
-
-# Test the one arg signature with none of the optional KEYWORD arguments:
-build_command(cmd)
-message("4. cmd='${cmd}'")
-
-# Test the two-arg legacy signature:
-build_command(legacy_cmd ${CMAKE_BUILD_TOOL})
-message("5. legacy_cmd='${legacy_cmd}'")
-message(" CMAKE_BUILD_TOOL='${CMAKE_BUILD_TOOL}'")
-
-# Test the optional KEYWORDs:
-build_command(cmd CONFIGURATION hoohaaConfig)
-message("6. cmd='${cmd}'")
-
-build_command(cmd PROJECT_NAME hoohaaProject)
-message("7. cmd='${cmd}'")
-
-build_command(cmd TARGET hoohaaTarget)
-message("8. cmd='${cmd}'")
-
-set(cmd "final")
-message("9. cmd='${cmd}'")
diff --git a/Tests/RunCMake/build_command/ErrorsCommon.cmake b/Tests/RunCMake/build_command/ErrorsCommon.cmake
new file mode 100644
index 0000000000..d22453916d
--- /dev/null
+++ b/Tests/RunCMake/build_command/ErrorsCommon.cmake
@@ -0,0 +1,55 @@
+# This CMakeLists file is *sometimes expected* to result in a configure error.
+#
+# expect this to succeed:
+# ../bin/Release/cmake -G Xcode
+# ../../CMake/Tests/CMakeCommands/build_command
+#
+# expect this to fail:
+# ../bin/Release/cmake -DTEST_ERROR_CONDITIONS:BOOL=ON -G Xcode
+# ../../CMake/Tests/CMakeCommands/build_command
+#
+# This project exists merely to test the CMake command 'build_command'...
+# ...even purposefully calling it with known-bad argument lists to cover
+# error handling code.
+#
+
+set(cmd "initial")
+
+message("0. begin")
+
+if(TEST_ERROR_CONDITIONS)
+ # Test with no arguments (an error):
+ build_command()
+ message("1. cmd='${cmd}'")
+
+ # Test with unknown arguments (also an error):
+ build_command(cmd BOGUS STUFF)
+ message("2. cmd='${cmd}'")
+
+ build_command(cmd STUFF BOGUS)
+ message("3. cmd='${cmd}'")
+else()
+ message("(skipping cases 1, 2 and 3 because TEST_ERROR_CONDITIONS is OFF)")
+endif()
+
+# Test the one arg signature with none of the optional KEYWORD arguments:
+build_command(cmd)
+message("4. cmd='${cmd}'")
+
+# Test the two-arg legacy signature:
+build_command(legacy_cmd ${CMAKE_BUILD_TOOL})
+message("5. legacy_cmd='${legacy_cmd}'")
+message(" CMAKE_BUILD_TOOL='${CMAKE_BUILD_TOOL}'")
+
+# Test the optional KEYWORDs:
+build_command(cmd CONFIGURATION hoohaaConfig)
+message("6. cmd='${cmd}'")
+
+build_command(cmd PROJECT_NAME hoohaaProject)
+message("7. cmd='${cmd}'")
+
+build_command(cmd TARGET hoohaaTarget)
+message("8. cmd='${cmd}'")
+
+set(cmd "final")
+message("9. cmd='${cmd}'")
diff --git a/Tests/RunCMake/build_command/ErrorsOFF.cmake b/Tests/RunCMake/build_command/ErrorsOFF.cmake
index a243fab01d..7b9cac6473 100644
--- a/Tests/RunCMake/build_command/ErrorsOFF.cmake
+++ b/Tests/RunCMake/build_command/ErrorsOFF.cmake
@@ -1 +1,2 @@
set(TEST_ERROR_CONDITIONS OFF)
+include(ErrorsCommon.cmake)
diff --git a/Tests/RunCMake/build_command/ErrorsON-stderr.txt b/Tests/RunCMake/build_command/ErrorsON-stderr.txt
index 0be7475d78..47a84d6743 100644
--- a/Tests/RunCMake/build_command/ErrorsON-stderr.txt
+++ b/Tests/RunCMake/build_command/ErrorsON-stderr.txt
@@ -1,12 +1,21 @@
-CMake Error at CMakeLists.txt:[0-9]+ \(build_command\):
+CMake Error at ErrorsCommon.cmake:[0-9]+ \(build_command\):
build_command requires at least one argument naming a CMake variable
+Call Stack \(most recent call first\):
+ ErrorsON.cmake:[0-9]+ \(include\)
+ CMakeLists.txt:[0-9]+ \(include\)
+
1. cmd='initial'
-CMake Error at CMakeLists.txt:[0-9]+ \(build_command\):
+CMake Error at ErrorsCommon.cmake:[0-9]+ \(build_command\):
build_command unknown argument "BOGUS"
+Call Stack \(most recent call first\):
+ ErrorsON.cmake:[0-9]+ \(include\)
+ CMakeLists.txt:[0-9]+ \(include\)
+
2. cmd='initial'
-CMake Error at CMakeLists.txt:[0-9]+ \(build_command\):
+CMake Error at ErrorsCommon.cmake:[0-9]+ \(build_command\):
build_command unknown argument "STUFF"
+Call Stack \(most recent call first\):
+ ErrorsON.cmake:[0-9]+ \(include\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/build_command/ErrorsON.cmake b/Tests/RunCMake/build_command/ErrorsON.cmake
index 27814bf646..d7b709b87f 100644
--- a/Tests/RunCMake/build_command/ErrorsON.cmake
+++ b/Tests/RunCMake/build_command/ErrorsON.cmake
@@ -1 +1,2 @@
set(TEST_ERROR_CONDITIONS ON)
+include(ErrorsCommon.cmake)