# Can ctest be run on read only file system

**URL:** https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845
**Category:** Usage
**Tags:** os:linux
**Created:** [January 13, 2022, 6:42pm UTC](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845 "2022-01-13T18:42:34Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![Haocheng\_Liu1](https://discourse.cmake.org/user_avatar/discourse.cmake.org/haocheng_liu1/32/514_2.png) [@Haocheng\_Liu1](https://discourse.cmake.org/u/Haocheng_Liu1)
#### Post date: [January 13, 2022, 6:42pm UTC](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845/1 "2022-01-13T18:42:34Z")

</div>

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](https://gitlab.kitware.com/cmake/cmake/-/blob/master/Source/CTest/cmCTestTestHandler.cxx#L1953)

```auto
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:

```

Thanks  
Haocheng Liu

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [January 16, 2022, 6:03pm UTC](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845/2 "2022-01-16T18:03:43Z")

</div>

Hi Haocheng!

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.

---

<div class="post-metadata">

### Author: ![leifwalsh](https://discourse.cmake.org/user_avatar/discourse.cmake.org/leifwalsh/32/2102_2.png) [@leifwalsh](https://discourse.cmake.org/u/leifwalsh)
#### Post date: [January 16, 2022, 6:44pm UTC](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845/3 "2022-01-16T18:44:31Z")

</div>

It is trying to open `Testing/Temporary/LastTest.log.tmp` within the build directory in write mode (even though we’re passing `--show-only`!).

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [January 16, 2022, 7:26pm UTC](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845/4 "2022-01-16T19:26:21Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Haocheng\_Liu1](https://discourse.cmake.org/user_avatar/discourse.cmake.org/haocheng_liu1/32/514_2.png) [@Haocheng\_Liu1](https://discourse.cmake.org/u/Haocheng_Liu1)
#### Post date: [January 16, 2022, 7:34pm UTC](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845/5 "2022-01-16T19:34:53Z")

</div>

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

---

<div class="post-metadata">

### Author: ![leifwalsh](https://discourse.cmake.org/user_avatar/discourse.cmake.org/leifwalsh/32/2102_2.png) [@leifwalsh](https://discourse.cmake.org/u/leifwalsh)
#### Post date: [January 16, 2022, 8:59pm UTC](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845/6 "2022-01-16T20:59:40Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [January 18, 2022, 3:17pm UTC](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845/7 "2022-01-18T15:17:00Z")

</div>

Dit you try to create the build directory only at a writable location?

You should never build in source tree!

---

<div class="post-metadata">

### Author: ![leifwalsh](https://discourse.cmake.org/user_avatar/discourse.cmake.org/leifwalsh/32/2102_2.png) [@leifwalsh](https://discourse.cmake.org/u/leifwalsh)
#### Post date: [January 18, 2022, 6:34pm UTC](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845/8 "2022-01-18T18:34:53Z")

</div>

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).

---

<div class="post-metadata">

### Author: ![Haocheng\_Liu1](https://discourse.cmake.org/user_avatar/discourse.cmake.org/haocheng_liu1/32/514_2.png) [@Haocheng\_Liu1](https://discourse.cmake.org/u/Haocheng_Liu1)
#### Post date: [January 18, 2022, 7:11pm UTC](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845/9 "2022-01-18T19:11:41Z")

</div>

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 ` /build/build/<company-build-system>/tests/cmake/library/c/build/Testing/Temporary/LastTest.log.tmp`

---

<div class="post-metadata">

### Author: ![leifwalsh](https://discourse.cmake.org/user_avatar/discourse.cmake.org/leifwalsh/32/2102_2.png) [@leifwalsh](https://discourse.cmake.org/u/leifwalsh)
#### Post date: [January 18, 2022, 11:29pm UTC](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845/10 "2022-01-18T23:29:16Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [January 21, 2022, 1:38pm UTC](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845/11 "2022-01-21T13:38:12Z")

</div>

Then it seems that this is something that just isn’t handled at the moment then. I would suggest filing [an issue](https://gitlab.kitware.com/cmake/cmake/-/issues).

---

<div class="post-metadata">

### Author: ![Haocheng\_Liu1](https://discourse.cmake.org/user_avatar/discourse.cmake.org/haocheng_liu1/32/514_2.png) [@Haocheng\_Liu1](https://discourse.cmake.org/u/Haocheng_Liu1)
#### Post date: [January 21, 2022, 3:41pm UTC](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845/12 "2022-01-21T15:41:14Z")

</div>

Thanks Ben. How much effort do you foresee to implement this feature?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [January 21, 2022, 3:48pm UTC](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845/13 "2022-01-21T15:48:56Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jtxa](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jtxa/32/1535_2.png) [@jtxa](https://discourse.cmake.org/u/jtxa)
#### Post date: [January 27, 2022, 9:40pm UTC](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845/14 "2022-01-27T21:40:27Z")

</div>

@leifwalsh Did you consider using OverlayFS or mounting a tmpfs onto that `build/tests/Temporary` directory?  
At least as an alternative or even a permanent solution.

---

<div class="post-metadata">

### Author: ![leifwalsh](https://discourse.cmake.org/user_avatar/discourse.cmake.org/leifwalsh/32/2102_2.png) [@leifwalsh](https://discourse.cmake.org/u/leifwalsh)
#### Post date: [January 27, 2022, 11:09pm UTC](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845/15 "2022-01-27T23:09:49Z")

</div>

Yeah we might bind mount in a writable directory with bubblewrap in a pinch.

---

<div class="post-metadata">

### Author: ![Haocheng\_Liu1](https://discourse.cmake.org/user_avatar/discourse.cmake.org/haocheng_liu1/32/514_2.png) [@Haocheng\_Liu1](https://discourse.cmake.org/u/Haocheng_Liu1)
#### Post date: [February 15, 2022, 4:59pm UTC](https://discourse.cmake.org/t/can-ctest-be-run-on-read-only-file-system/4845/16 "2022-02-15T16:59:17Z")

</div>

Issue is file [here](https://gitlab.kitware.com/cmake/cmake/-/issues/23231)
