[Cmake-commits] [cmake-commits] king committed CMakeLists.txt 1.10 1.11 File-Copy-BadArg.cmake NONE 1.1 File-Copy-BadPerm.cmake NONE 1.1 File-Copy-BadRegex.cmake NONE 1.1 File-Copy-EarlyArg.cmake NONE 1.1 File-Copy-LateArg.cmake NONE 1.1 File-Copy-NoDest.cmake NONE 1.1 File-Copy-NoFile.cmake NONE 1.1 FileTest.cmake.in NONE 1.1

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Apr 29 13:14:00 EDT 2009


Update of /cvsroot/CMake/CMake/Tests/CMakeTests
In directory public:/mounts/ram/cvs-serv23927/Tests/CMakeTests

Modified Files:
	CMakeLists.txt 
Added Files:
	File-Copy-BadArg.cmake File-Copy-BadPerm.cmake 
	File-Copy-BadRegex.cmake File-Copy-EarlyArg.cmake 
	File-Copy-LateArg.cmake File-Copy-NoDest.cmake 
	File-Copy-NoFile.cmake FileTest.cmake.in 
Log Message:
ENH: Test file(COPY) failure cases

This tests some cases of bad arguments to the file(COPY) signature.
It checks that the proper error messages are produced.


--- NEW FILE: File-Copy-NoFile.cmake ---
file(COPY does_not_exist.txt DESTINATION tmp)

--- NEW FILE: File-Copy-NoDest.cmake ---
file(COPY FileTest.cmake)

--- NEW FILE: File-Copy-EarlyArg.cmake ---
file(COPY FileTest.cmake DESTINATION tmp PERMISSIONS)

--- NEW FILE: File-Copy-BadPerm.cmake ---
file(COPY FileTest.cmake DESTINATION tmp FILE_PERMISSIONS BADPERM)

--- NEW FILE: File-Copy-BadArg.cmake ---
file(COPY FileTest.cmake DESTINATION tmp PATTERN * BADARG)

--- NEW FILE: File-Copy-BadRegex.cmake ---
file(COPY FileTest.cmake DESTINATION tmp REGEX "(")

--- NEW FILE: FileTest.cmake.in ---
set(Copy-BadArg-RESULT 1)
set(Copy-BadArg-STDERR "unknown argument \"BADARG\"")
set(Copy-BadPerm-RESULT 1)
set(Copy-BadPerm-STDERR "COPY given invalid permission \"BADPERM\"")
set(Copy-BadRegex-RESULT 1)
set(Copy-BadRegex-STDERR "could not compile REGEX")
set(Copy-EarlyArg-RESULT 1)
set(Copy-EarlyArg-STDERR "option PERMISSIONS may not appear before")
set(Copy-LateArg-RESULT 1)
set(Copy-LateArg-STDERR "option FILE_PERMISSIONS may not appear after")
set(Copy-NoDest-RESULT 1)
set(Copy-NoDest-STDERR "given no DESTINATION")
set(Copy-NoFile-RESULT 1)
set(Copy-NoFile-STDERR "COPY cannot find .*/does_not_exist\\.txt")

foreach(test
    Copy-BadArg
    Copy-BadPerm
    Copy-BadRegex
    Copy-EarlyArg
    Copy-LateArg
    Copy-NoDest
    Copy-NoFile
    )
  message(STATUS "Test ${test}...")
  execute_process(
    COMMAND ${CMAKE_COMMAND} -P
    "@CMAKE_CURRENT_SOURCE_DIR@/File-${test}.cmake"
    WORKING_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@"
    OUTPUT_VARIABLE stdout
    ERROR_VARIABLE stderr
    RESULT_VARIABLE result
    )
  string(REGEX REPLACE "\n" "\n out> " out " out> ${stdout}")
  string(REGEX REPLACE "\n" "\n err> " err " err> ${stderr}")
  if(NOT "${result}" STREQUAL ${${test}-RESULT})
    message(FATAL_ERROR
      "Test ${test} result is [${result}], not [${${test}-RESULT}].\n"
      "Test ${test} output:\n"
      "${out}\n"
      "${err}")
  endif()
  if(${test}-STDERR AND NOT "${err}" MATCHES "${${test}-STDERR}")
    message(FATAL_ERROR
      "Test ${test} stderr does not match\n  ${${test}-STDERR}\n"
      "Test ${test} output:\n"
      "${out}\n"
      "${err}")
  endif()
endforeach()

--- NEW FILE: File-Copy-LateArg.cmake ---
file(COPY FileTest.cmake DESTINATION tmp PATTERN * FILE_PERMISSIONS)

Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/CMakeTests/CMakeLists.txt,v
retrieving revision 1.10
retrieving revision 1.11
diff -C 2 -d -r1.10 -r1.11
*** CMakeLists.txt	6 Mar 2009 15:04:02 -0000	1.10
--- CMakeLists.txt	29 Apr 2009 17:13:51 -0000	1.11
***************
*** 18,21 ****
--- 18,22 ----
  AddCMakeTest(Version "")
  AddCMakeTest(Message "")
+ AddCMakeTest(File "")
  
  SET(GetPrerequisites_PreArgs



More information about the Cmake-commits mailing list