summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-05-30 12:57:42 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-05-30 12:57:42 (GMT)
commit585cfa51dec828ddc4b12e6005f3137b231d6cb3 (patch)
tree1c341594ceb99b6e76ad925e2b5aad436ba86dff /Tests
parentd721a9cf6ad7e5354f2c4e9f88ae8a408ecd7411 (diff)
parent7378792b4938d32c5eefc5bb485ecae1a7ec95fb (diff)
downloadCMake-585cfa51dec828ddc4b12e6005f3137b231d6cb3.zip
CMake-585cfa51dec828ddc4b12e6005f3137b231d6cb3.tar.gz
CMake-585cfa51dec828ddc4b12e6005f3137b231d6cb3.tar.bz2
Merge topic 'fix-FileIsDirectory-SEGV'
7378792 if: Add test for IS_DIRECTORY 4ab10e0 Merge branch 'master' into fix-FileIsDirectory-SEGV 045d6ae KWSys: Fix SystemTools::FileIsDirectory with long paths (#14176)
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/if/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/if/IsDirectory-stdout.txt1
-rw-r--r--Tests/RunCMake/if/IsDirectory.cmake5
-rw-r--r--Tests/RunCMake/if/IsDirectoryLong-stdout.txt1
-rw-r--r--Tests/RunCMake/if/IsDirectoryLong.cmake10
-rw-r--r--Tests/RunCMake/if/RunCMakeTest.cmake4
7 files changed, 25 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 8e0c0e5..66f86b6 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -72,6 +72,7 @@ add_RunCMake_test(add_dependencies)
add_RunCMake_test(build_command)
add_RunCMake_test(find_package)
add_RunCMake_test(get_filename_component)
+add_RunCMake_test(if)
add_RunCMake_test(include)
add_RunCMake_test(include_directories)
add_RunCMake_test(list)
diff --git a/Tests/RunCMake/if/CMakeLists.txt b/Tests/RunCMake/if/CMakeLists.txt
new file mode 100644
index 0000000..e8db6b0
--- /dev/null
+++ b/Tests/RunCMake/if/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/if/IsDirectory-stdout.txt b/Tests/RunCMake/if/IsDirectory-stdout.txt
new file mode 100644
index 0000000..b89446a
--- /dev/null
+++ b/Tests/RunCMake/if/IsDirectory-stdout.txt
@@ -0,0 +1 @@
+CMAKE_CURRENT_SOURCE_DIR exists, tested with trailing slash
diff --git a/Tests/RunCMake/if/IsDirectory.cmake b/Tests/RunCMake/if/IsDirectory.cmake
new file mode 100644
index 0000000..23d126d
--- /dev/null
+++ b/Tests/RunCMake/if/IsDirectory.cmake
@@ -0,0 +1,5 @@
+if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/")
+ message(STATUS "CMAKE_CURRENT_SOURCE_DIR exists, tested with trailing slash")
+else()
+ message(FATAL_ERROR "CMAKE_CURRENT_SOURCE_DIR does not exist!")
+endif()
diff --git a/Tests/RunCMake/if/IsDirectoryLong-stdout.txt b/Tests/RunCMake/if/IsDirectoryLong-stdout.txt
new file mode 100644
index 0000000..5e62754
--- /dev/null
+++ b/Tests/RunCMake/if/IsDirectoryLong-stdout.txt
@@ -0,0 +1 @@
+Directory path with length 94208 correctly does not exist.
diff --git a/Tests/RunCMake/if/IsDirectoryLong.cmake b/Tests/RunCMake/if/IsDirectoryLong.cmake
new file mode 100644
index 0000000..0e93be7
--- /dev/null
+++ b/Tests/RunCMake/if/IsDirectoryLong.cmake
@@ -0,0 +1,10 @@
+set(d "/long/path/to/directory")
+foreach(i RANGE 11)
+ set(d "${d}${d}")
+endforeach()
+string(LENGTH "${d}" dl)
+if(IS_DIRECTORY "${d}/")
+ message(FATAL_ERROR "Directory should not exist!")
+else()
+ message(STATUS "Directory path with length ${dl} correctly does not exist.")
+endif()
diff --git a/Tests/RunCMake/if/RunCMakeTest.cmake b/Tests/RunCMake/if/RunCMakeTest.cmake
new file mode 100644
index 0000000..6b6b74b
--- /dev/null
+++ b/Tests/RunCMake/if/RunCMakeTest.cmake
@@ -0,0 +1,4 @@
+include(RunCMake)
+
+run_cmake(IsDirectory)
+run_cmake(IsDirectoryLong)