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/RunCMake | |
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/RunCMake')
23 files changed, 78 insertions, 0 deletions
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/RunCMake/configure_file/BadArg.cmake b/Tests/RunCMake/configure_file/BadArg.cmake new file mode 100644 index 0000000..769fae1 --- /dev/null +++ b/Tests/RunCMake/configure_file/BadArg.cmake @@ -0,0 +1 @@ +configure_file(.) 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/RunCMake/configure_file/DirInput.cmake b/Tests/RunCMake/configure_file/DirInput.cmake new file mode 100644 index 0000000..920ea28 --- /dev/null +++ b/Tests/RunCMake/configure_file/DirInput.cmake @@ -0,0 +1 @@ +configure_file(. .) 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/RunCMake/configure_file/NewLineStyle-COPYONLY.cmake b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY.cmake new file mode 100644 index 0000000..c07b8f5 --- /dev/null +++ b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY.cmake @@ -0,0 +1,3 @@ +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/RunCMake/configure_file/NewLineStyle-NoArg.cmake b/Tests/RunCMake/configure_file/NewLineStyle-NoArg.cmake new file mode 100644 index 0000000..b35bde1 --- /dev/null +++ b/Tests/RunCMake/configure_file/NewLineStyle-NoArg.cmake @@ -0,0 +1,3 @@ +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/RunCMake/configure_file/NewLineStyle-ValidArg.cmake b/Tests/RunCMake/configure_file/NewLineStyle-ValidArg.cmake new file mode 100644 index 0000000..8d9f474 --- /dev/null +++ b/Tests/RunCMake/configure_file/NewLineStyle-ValidArg.cmake @@ -0,0 +1,17 @@ +set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt) + +function(test_eol style in out) + file(WRITE ${file_name} "${in}") + configure_file(${file_name} ${file_name}.out NEWLINE_STYLE ${style}) + file(READ ${file_name}.out new HEX) + if(NOT "${new}" STREQUAL "${out}") + message(FATAL_ERROR "No ${style} line endings") + endif() +endfunction() + +test_eol(DOS "a\n" "610d0a") +test_eol(WIN32 "b\n" "620d0a") +test_eol(CRLF "c\n" "630d0a") + +test_eol(UNIX "d\n" "640a") +test_eol(LF "e\n" "650a") 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/RunCMake/configure_file/NewLineStyle-WrongArg.cmake b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg.cmake new file mode 100644 index 0000000..3ae906d --- /dev/null +++ b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg.cmake @@ -0,0 +1,3 @@ +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. |