diff options
author | Terence Noone <me@techtricity.net> | 2022-12-08 00:48:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-12-08 12:54:55 (GMT) |
commit | efae1ab68badef66505363505aecce7a7c3dbe6a (patch) | |
tree | a4f6f16a522711121165408a6270dc05c68dd1b7 /Tests | |
parent | 127fa54808acd80b658409758533c2522f6a1c19 (diff) | |
download | CMake-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.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/file/MAKE_DIRECTORY-fail-stderr.txt | 9 | ||||
-rw-r--r-- | Tests/RunCMake/file/MAKE_DIRECTORY-fail.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/file/RunCMakeTest.cmake | 2 |
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) |