Tests/RunCMake/file-DOWNLOAD: Use /dev/urandom for write-error only on Apple

On other platforms, writing to `/dev/urandom` succeeds, so it cannot be
used to simulate a write error.

Fixes: #28047
This commit is contained in:
Hanjiang Yu
2026-09-02 11:07:28 -04:00
committed by Brad King
parent 80c848cd10
commit 5676f4ffc9
@@ -25,12 +25,13 @@ run_cmake(no-file)
run_cmake(range)
run_cmake(SHOW_PROGRESS)
foreach(file IN ITEMS /dev/full /dev/urandom)
if(IS_WRITABLE "${file}")
run_cmake_with_options(file-write-error -Dfile=${file})
break()
if(CMAKE_HOST_UNIX)
if(IS_WRITABLE "/dev/full")
run_cmake_with_options(file-write-error -Dfile=/dev/full)
elseif(IS_WRITABLE "/dev/urandom" AND CMAKE_HOST_APPLE)
run_cmake_with_options(file-write-error -Dfile=/dev/urandom)
endif()
endforeach()
endif()
if(NOT CMake_TEST_NO_NETWORK)
run_cmake(bad-hostname)