Hey, hope it finds you guys well.
Recently we are trying to run ctest on read-only file system(kind of a sim farm) and it hits below error. Searching on the internet does not find any related topics. Wonder if it’s doable? Is there a flag for me to turn off the temp write when calling ctest?
possible related code piece: https://gitlab.kitware.com/cmake/cmake/-/blob/master/Source/CTest/cmCTestTestHandler.cxx#L1953
13:15:06 WARNING: Failed to assemble tests:
13:15:06 Error assembling ***/buildsystem/tests/cmake/library
13:15:06 java.util.concurrent.ExecutionException: ***.UniverseTestAssemblerImpl$TestAssemblyException: Non-zero return code while assembling tests for codebase ***/cmake/library and universe ***: 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:
Can you see what path it is trying to write (
strace?). I suspect it is a log file of some kind that may be prepped in
main or somewhere similarly high-level.
It is trying to open
Testing/Temporary/LastTest.log.tmp within the build directory in write mode (even though we’re passing
It seems that this file is only cared about if something went wrong. It seems that
--output-on-failure will suppress this behavior. Does that flag work?
hey Ben! Don’t forget send my regards to depp if he still remembers me🤔
Leif knows much more about the issue than me. Please see his response
I thought that would just cause failing tests’ output to be printed, but in this case we aren’t running any tests, just listing them. But I’ll try that and get back to you.
Dit you try to create the build directory only at a writable location?
You should never build in source tree!
We aren’t doing in-source-tree builds.
We’ve already done an out of tree build, uploaded the build directory to a network filesystem (think google’s ObjFS if you’re familiar), and we’re trying to run the tests on other machines for parallelism, where the build directory shows up as read only (we want to test exactly what was built).
Hey Ben, relaying for Leif as discourse has a limit on how many replies a new users can post(? who to contact so that limit can be lifted)
- " And yeah, we tried adding
--output-on-failure and that didn’t change anything, it fails in the same exact way."
CMake was trying to write to
Ok, I scrolled around enough to get out of discourse jail. As Haocheng said, I tried adding
--output-on-failure and it failed in the exact same way. I think it’s trying to open LastTest.log.tmp prematurely, in case it needs to write something there, before deciding whether it’s going to run any tests (it’s not, because we’re passing
--show-only=json-v1) or having any failures to output in the first place.
Then it seems that this is something that just isn’t handled at the moment then. I would suggest filing an issue.
Thanks Ben. How much effort do you foresee to implement this feature?
First would be tracking down where that file is opened within CMake’s code. If it’s “shallow” from
main, probably pretty easy. If it’s “deep”, then “is a read only operation” needs to be determined and passed around as needed.
@leifwalsh Did you consider using OverlayFS or mounting a tmpfs onto that
At least as an alternative or even a permanent solution.
Yeah we might bind mount in a writable directory with bubblewrap in a pinch.