From: Daan De Meyer Date: Tue, 3 Dec 2024 14:08:11 +0000 (+0100) Subject: test-execute: Don't make rootfs read-only if we're collecting coverage X-Git-Tag: v257~32^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=561a3786b7ad38f83a072fe5ec9405d6b314464e;p=thirdparty%2Fsystemd.git test-execute: Don't make rootfs read-only if we're collecting coverage The test needs to be able to write coverage data to the rootfs so don't make / read-only. --- diff --git a/src/test/test-execute.c b/src/test/test-execute.c index 95ccf5490de..de575ec1e6d 100644 --- a/src/test/test-execute.c +++ b/src/test/test-execute.c @@ -1448,8 +1448,10 @@ static int prepare_ns(const char *process_name) { _cleanup_free_ char *unit_dir = NULL, *build_dir = NULL, *build_dir_mount = NULL; int ret; - /* Make "/" read-only. */ - ASSERT_OK(mount_nofollow_verbose(LOG_DEBUG, NULL, "/", NULL, MS_BIND|MS_REMOUNT|MS_RDONLY, NULL)); + const char *coverage = getenv("COVERAGE_BUILD_DIR"); + if (!coverage) + /* Make "/" read-only. */ + ASSERT_OK(mount_nofollow_verbose(LOG_DEBUG, NULL, "/", NULL, MS_BIND|MS_REMOUNT|MS_RDONLY, NULL)); /* Creating a new user namespace in the above means all MS_SHARED mounts become MS_SLAVE. * Let's put them back to MS_SHARED here, since that's what we want as defaults. (This will