CTest: Running tests on read-only filesystem
Currently when users run ctest to list tests, It will try to open Testing/Temporary/LastTest.log.tmp within the build directory in write mode (even though --show-only is passed in!). --output-on-failure
does not work as well.
This is causing problems for running ctest on a readonly file system which is pretty common for a build test farm environment.
A workaround here is to mount a writable directory, though the correct way to handle things here is to make CMake open lastTest.log tmp only when needed.
A possible way to attack the problem is to:
Firstly track down where that file is opened within CMake’s code. If it’s “shallow” from main, probably pretty easy. Move it to the right place so that list tests happens before that or let show-only
controls it.
If it’s “deep”, then “is a read only operation” needs to be determined and passed around as needed.
13:15:06 WARNING: Failed to assemble tests:
13:15:06 Error assembling ***/buildsystem/tests/cmake/library
...
Test listing failed: 1 stderr: (CMake Error: Cannot open file for write: /build/build/ts/buildsystem/tests/cmake/library/c/build/Testing/Temporary/LastTest.log.tmp
13:15:06 CMake Error: : System Error: Read-only file system
13:15:06 cmakectest: Unable list tests: Command '['/build/build/ext/public/cmake/dist/bin/ctest', '--show-only=json-v1']' returned non-zero exit status 8.
13:15:06 Errors encountered during test discovery; cannot continue.
13:15:06 Build failed with exit code 1
13:15:06 ) stdout: (), caused by:
Related discourse discussion