summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorTerence Noone <me@techtricity.net>2022-12-08 00:48:22 (GMT)
committerBrad King <brad.king@kitware.com>2022-12-08 12:54:55 (GMT)
commitefae1ab68badef66505363505aecce7a7c3dbe6a (patch)
treea4f6f16a522711121165408a6270dc05c68dd1b7 /Tests
parent127fa54808acd80b658409758533c2522f6a1c19 (diff)
downloadCMake-efae1ab68badef66505363505aecce7a7c3dbe6a.zip
CMake-efae1ab68badef66505363505aecce7a7c3dbe6a.tar.gz
CMake-efae1ab68badef66505363505aecce7a7c3dbe6a.tar.bz2
file(MAKE_DIRECTORY): Provide a more descriptive error message
Previously, MAKE_DIRECTORY would print `problem creating directory: {}`, which was very unhelpful for debugging. Extend the message with the OS error string.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/file/MAKE_DIRECTORY-fail-result.txt1
-rw-r--r--Tests/RunCMake/file/MAKE_DIRECTORY-fail-stderr.txt9
-rw-r--r--Tests/RunCMake/file/MAKE_DIRECTORY-fail.cmake2
-rw-r--r--Tests/RunCMake/file/RunCMakeTest.cmake2
4 files changed, 14 insertions, 0 deletions
diff --git a/Tests/RunCMake/file/MAKE_DIRECTORY-fail-result.txt b/Tests/RunCMake/file/MAKE_DIRECTORY-fail-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/MAKE_DIRECTORY-fail-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/MAKE_DIRECTORY-fail-stderr.txt b/Tests/RunCMake/file/MAKE_DIRECTORY-fail-stderr.txt
new file mode 100644
index 0000000..95fccdf
--- /dev/null
+++ b/Tests/RunCMake/file/MAKE_DIRECTORY-fail-stderr.txt
@@ -0,0 +1,9 @@
+^CMake Error at [^
+]*/MAKE_DIRECTORY-fail.cmake:[0-9]+ \(file\):
+ file failed to create directory:
+
+ [^
+]*/Tests/RunCMake/file/MAKE_DIRECTORY-fail-build/file/directory
+
+ because: [^
+]+$
diff --git a/Tests/RunCMake/file/MAKE_DIRECTORY-fail.cmake b/Tests/RunCMake/file/MAKE_DIRECTORY-fail.cmake
new file mode 100644
index 0000000..57a68e5
--- /dev/null
+++ b/Tests/RunCMake/file/MAKE_DIRECTORY-fail.cmake
@@ -0,0 +1,2 @@
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/file" "")
+file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/file/directory")
diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake
index 752f7a0..c75e062 100644
--- a/Tests/RunCMake/file/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file/RunCMakeTest.cmake
@@ -61,6 +61,8 @@ run_cmake_script(COPY_FILE-arg-unknown)
run_cmake_script(COPY_FILE-input-missing)
run_cmake_script(COPY_FILE-output-missing)
+run_cmake_script(MAKE_DIRECTORY-fail)
+
run_cmake_script(RENAME-file-replace)
run_cmake_script(RENAME-file-to-file)
run_cmake_script(RENAME-file-to-dir-capture)