diff options
author | Brad King <brad.king@kitware.com> | 2015-03-09 12:42:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-03-09 13:17:59 (GMT) |
commit | 024e25e485f8d1dbca40521fbc0bcd61e383f413 (patch) | |
tree | cefc356363aac67d1aa5c2643f7b12392b1dc8d7 /Tests | |
parent | 3ef776fc38fecff332e568f307dcf4e6f82fbe14 (diff) | |
download | CMake-024e25e485f8d1dbca40521fbc0bcd61e383f413.zip CMake-024e25e485f8d1dbca40521fbc0bcd61e383f413.tar.gz CMake-024e25e485f8d1dbca40521fbc0bcd61e383f413.tar.bz2 |
Tests: Add more signature tests to RunCMake.configure_file test
Move the test cases from Tests/CMakeTests/ConfigureFileTest.cmake.in
over to use the RunCMake.configure_file infrastructure. This does much
more robust verification of CMake output for each test case, and would
have caught the regression fixed in our parent commit.
Diffstat (limited to 'Tests')
27 files changed, 54 insertions, 42 deletions
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index ce36830..d5524c3 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -19,7 +19,6 @@ AddCMakeTest(GetFilenameComponentRealpath "") AddCMakeTest(Version "") AddCMakeTest(Message "") AddCMakeTest(File "") -AddCMakeTest(ConfigureFile "") AddCMakeTest(SeparateArguments "") AddCMakeTest(ImplicitLinkInfo "") AddCMakeTest(ModuleNotices "") diff --git a/Tests/CMakeTests/ConfigureFile-DirOutput.cmake b/Tests/CMakeTests/ConfigureFile-DirOutput.cmake deleted file mode 100644 index d682a2d..0000000 --- a/Tests/CMakeTests/ConfigureFile-DirOutput.cmake +++ /dev/null @@ -1,5 +0,0 @@ -file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-DirOutput.txt "DirOutput test file\n") -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ConfigureFile-DirOutput) -configure_file(ConfigureFile-DirOutput.txt ConfigureFile-DirOutput) -file(READ ${CMAKE_CURRENT_BINARY_DIR}/ConfigureFile-DirOutput/ConfigureFile-DirOutput.txt out) -message("${out}") diff --git a/Tests/CMakeTests/ConfigureFile-Relative.cmake b/Tests/CMakeTests/ConfigureFile-Relative.cmake deleted file mode 100644 index 532580a..0000000 --- a/Tests/CMakeTests/ConfigureFile-Relative.cmake +++ /dev/null @@ -1,4 +0,0 @@ -file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-Relative-In.txt "Relative test file\n") -configure_file(ConfigureFile-Relative-In.txt ConfigureFile-Relative-Out.txt) -file(READ ${CMAKE_CURRENT_BINARY_DIR}/ConfigureFile-Relative-Out.txt out) -message("${out}") diff --git a/Tests/CMakeTests/ConfigureFileTest.cmake.in b/Tests/CMakeTests/ConfigureFileTest.cmake.in deleted file mode 100644 index 6cc61d9..0000000 --- a/Tests/CMakeTests/ConfigureFileTest.cmake.in +++ /dev/null @@ -1,28 +0,0 @@ -set(DirInput-RESULT 1) -set(DirInput-STDERR "is a directory") -set(DirOutput-RESULT 0) -set(DirOutput-STDERR "DirOutput test file") -set(Relative-RESULT 0) -set(Relative-STDERR "Relative test file") -set(BadArg-RESULT 1) -set(BadArg-STDERR "called with incorrect number of arguments") -set(NewLineStyle-NoArg-RESULT 1) -set(NewLineStyle-NoArg-STDERR "NEWLINE_STYLE must set a style:") -set(NewLineStyle-WrongArg-RESULT 1) -set(NewLineStyle-WrongArg-STDERR "NEWLINE_STYLE sets an unknown style") -set(NewLineStyle-ValidArg-RESULT 0) -set(NewLineStyle-ValidArg-STDERR ) -set(NewLineStyle-COPYONLY-RESULT 1) -set(NewLineStyle-COPYONLY-STDERR "COPYONLY could not be used in combination") - -include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") -check_cmake_test(ConfigureFile - DirInput - DirOutput - Relative - BadArg - NewLineStyle-NoArg - NewLineStyle-WrongArg - NewLineStyle-ValidArg - NewLineStyle-COPYONLY - ) diff --git a/Tests/RunCMake/configure_file/BadArg-result.txt b/Tests/RunCMake/configure_file/BadArg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/BadArg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/BadArg-stderr.txt b/Tests/RunCMake/configure_file/BadArg-stderr.txt new file mode 100644 index 0000000..4567d3f --- /dev/null +++ b/Tests/RunCMake/configure_file/BadArg-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at BadArg.cmake:[0-9]+ \(configure_file\): + configure_file called with incorrect number of arguments, expected 2 +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeTests/ConfigureFile-BadArg.cmake b/Tests/RunCMake/configure_file/BadArg.cmake index 769fae1..769fae1 100644 --- a/Tests/CMakeTests/ConfigureFile-BadArg.cmake +++ b/Tests/RunCMake/configure_file/BadArg.cmake diff --git a/Tests/RunCMake/configure_file/DirInput-result.txt b/Tests/RunCMake/configure_file/DirInput-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/DirInput-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/DirInput-stderr.txt b/Tests/RunCMake/configure_file/DirInput-stderr.txt new file mode 100644 index 0000000..2e0cd14 --- /dev/null +++ b/Tests/RunCMake/configure_file/DirInput-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at DirInput.cmake:[0-9]+ \(configure_file\): + configure_file input location + + .*/Tests/RunCMake/configure_file/. + + is a directory but a file was expected. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeTests/ConfigureFile-DirInput.cmake b/Tests/RunCMake/configure_file/DirInput.cmake index 920ea28..920ea28 100644 --- a/Tests/CMakeTests/ConfigureFile-DirInput.cmake +++ b/Tests/RunCMake/configure_file/DirInput.cmake diff --git a/Tests/RunCMake/configure_file/DirOutput-stderr.txt b/Tests/RunCMake/configure_file/DirOutput-stderr.txt new file mode 100644 index 0000000..d051f7c --- /dev/null +++ b/Tests/RunCMake/configure_file/DirOutput-stderr.txt @@ -0,0 +1 @@ +^DirOutput test file$ diff --git a/Tests/RunCMake/configure_file/DirOutput.cmake b/Tests/RunCMake/configure_file/DirOutput.cmake new file mode 100644 index 0000000..aa0fadf --- /dev/null +++ b/Tests/RunCMake/configure_file/DirOutput.cmake @@ -0,0 +1,4 @@ +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/DirOutput) +configure_file(DirOutput.txt DirOutput) +file(READ ${CMAKE_CURRENT_BINARY_DIR}/DirOutput/DirOutput.txt out) +message("${out}") diff --git a/Tests/RunCMake/configure_file/DirOutput.txt b/Tests/RunCMake/configure_file/DirOutput.txt new file mode 100644 index 0000000..16388a6 --- /dev/null +++ b/Tests/RunCMake/configure_file/DirOutput.txt @@ -0,0 +1 @@ +DirOutput test file diff --git a/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-result.txt b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-stderr.txt b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-stderr.txt new file mode 100644 index 0000000..3f66909 --- /dev/null +++ b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at NewLineStyle-COPYONLY.cmake:[0-9]+ \(configure_file\): + configure_file COPYONLY could not be used in combination with NEWLINE_STYLE +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-COPYONLY.cmake b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY.cmake index 3b09eb0..c07b8f5 100644 --- a/Tests/CMakeTests/ConfigureFile-NewLineStyle-COPYONLY.cmake +++ b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY.cmake @@ -1,3 +1,3 @@ -set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt) +set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt) file(WRITE ${file_name} "Data\n") configure_file(${file_name} ${file_name}.out COPYONLY NEWLINE_STYLE DOS) diff --git a/Tests/RunCMake/configure_file/NewLineStyle-NoArg-result.txt b/Tests/RunCMake/configure_file/NewLineStyle-NoArg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/NewLineStyle-NoArg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/NewLineStyle-NoArg-stderr.txt b/Tests/RunCMake/configure_file/NewLineStyle-NoArg-stderr.txt new file mode 100644 index 0000000..3652657 --- /dev/null +++ b/Tests/RunCMake/configure_file/NewLineStyle-NoArg-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at NewLineStyle-NoArg.cmake:[0-9]+ \(configure_file\): + configure_file NEWLINE_STYLE must set a style: LF, CRLF, UNIX, DOS, or + WIN32 +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-NoArg.cmake b/Tests/RunCMake/configure_file/NewLineStyle-NoArg.cmake index 133a67a..b35bde1 100644 --- a/Tests/CMakeTests/ConfigureFile-NewLineStyle-NoArg.cmake +++ b/Tests/RunCMake/configure_file/NewLineStyle-NoArg.cmake @@ -1,3 +1,3 @@ -set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt) +set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt) file(WRITE ${file_name} "Data\n") configure_file(${file_name} ${file_name}.out NEWLINE_STYLE) diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-ValidArg.cmake b/Tests/RunCMake/configure_file/NewLineStyle-ValidArg.cmake index b7e619c..8d9f474 100644 --- a/Tests/CMakeTests/ConfigureFile-NewLineStyle-ValidArg.cmake +++ b/Tests/RunCMake/configure_file/NewLineStyle-ValidArg.cmake @@ -1,4 +1,4 @@ -set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt) +set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt) function(test_eol style in out) file(WRITE ${file_name} "${in}") diff --git a/Tests/RunCMake/configure_file/NewLineStyle-WrongArg-result.txt b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/NewLineStyle-WrongArg-stderr.txt b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg-stderr.txt new file mode 100644 index 0000000..0d6855f --- /dev/null +++ b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at NewLineStyle-WrongArg.cmake:[0-9]+ \(configure_file\): + configure_file NEWLINE_STYLE sets an unknown style, only LF, CRLF, UNIX, + DOS, and WIN32 are supported +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-WrongArg.cmake b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg.cmake index e8887c1..3ae906d 100644 --- a/Tests/CMakeTests/ConfigureFile-NewLineStyle-WrongArg.cmake +++ b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg.cmake @@ -1,3 +1,3 @@ -set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt) +set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt) file(WRITE ${file_name} "Data\n") configure_file(${file_name} ${file_name}.out NEWLINE_STYLE FOO) diff --git a/Tests/RunCMake/configure_file/Relative-In.txt b/Tests/RunCMake/configure_file/Relative-In.txt new file mode 100644 index 0000000..572fe53 --- /dev/null +++ b/Tests/RunCMake/configure_file/Relative-In.txt @@ -0,0 +1 @@ +Relative test file diff --git a/Tests/RunCMake/configure_file/Relative-stderr.txt b/Tests/RunCMake/configure_file/Relative-stderr.txt new file mode 100644 index 0000000..b94de0d --- /dev/null +++ b/Tests/RunCMake/configure_file/Relative-stderr.txt @@ -0,0 +1 @@ +^Relative test file$ diff --git a/Tests/RunCMake/configure_file/Relative.cmake b/Tests/RunCMake/configure_file/Relative.cmake new file mode 100644 index 0000000..085991c --- /dev/null +++ b/Tests/RunCMake/configure_file/Relative.cmake @@ -0,0 +1,3 @@ +configure_file(Relative-In.txt Relative-Out.txt) +file(READ ${CMAKE_CURRENT_BINARY_DIR}/Relative-Out.txt out) +message("${out}") diff --git a/Tests/RunCMake/configure_file/RunCMakeTest.cmake b/Tests/RunCMake/configure_file/RunCMakeTest.cmake index 489652b..de14468 100644 --- a/Tests/RunCMake/configure_file/RunCMakeTest.cmake +++ b/Tests/RunCMake/configure_file/RunCMakeTest.cmake @@ -7,6 +7,14 @@ run_cmake(UTF16BE-BOM) run_cmake(UTF32LE-BOM) run_cmake(UTF32BE-BOM) run_cmake(UnknownArg) +run_cmake(DirInput) +run_cmake(DirOutput) +run_cmake(Relative) +run_cmake(BadArg) +run_cmake(NewLineStyle-NoArg) +run_cmake(NewLineStyle-WrongArg) +run_cmake(NewLineStyle-ValidArg) +run_cmake(NewLineStyle-COPYONLY) if(RunCMake_GENERATOR MATCHES "Make") # Use a single build tree for a few tests without cleaning. |