From: Frantisek Sumsal Date: Mon, 15 May 2023 08:15:24 +0000 (+0200) Subject: test: make $BUILD_DIR writable when rootfs is mounted read-only X-Git-Tag: v254-rc1~482^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F27644%2Fhead;p=thirdparty%2Fsystemd.git test: make $BUILD_DIR writable when rootfs is mounted read-only Adjust two systemd-nspawn invocations where rootfs is mounted read-only, to avoid gcov complaining. --- diff --git a/test/units/testsuite-13.nspawn.sh b/test/units/testsuite-13.nspawn.sh index 22a06e81124..76ba143751d 100755 --- a/test/units/testsuite-13.nspawn.sh +++ b/test/units/testsuite-13.nspawn.sh @@ -48,6 +48,7 @@ mount -t tmpfs tmpfs /var/lib/machines testcase_sanity_check() { local template root image oci uuid tmpdir + tmpdir="$(mktemp -d)" template="$(mktemp -d /tmp/nspawn-template.XXX)" "$CREATE_BB_CONTAINER" "$template" # Create a simple image from the just created container template @@ -94,7 +95,10 @@ EOF systemd-nspawn --directory="$root" --ephemeral sh -xec 'touch /ephemeral' test ! -e "$root/ephemeral" - (! systemd-nspawn --directory="$root" --read-only sh -xec 'touch /nope') + (! systemd-nspawn --directory="$root" \ + --bind="${COVERAGE_BUILD_DIR:-$tmpdir}" \ + --read-only \ + sh -xec 'touch /nope') test ! -e "$root/nope" systemd-nspawn --image="$image" sh -xec 'echo hello' systemd-nspawn --oci-bundle="$oci" sh -xec 'mountpoint /root' @@ -114,6 +118,7 @@ EOF test ! -e "$root/usr/read-only" # volatile=state: rootfs is read-only, /var/ is tmpfs systemd-nspawn --directory="$root" \ + --bind="${COVERAGE_BUILD_DIR:-$tmpdir}" \ --volatile=state \ sh -xec 'test -e /usr/has-usr; mountpoint /var; touch /read-only && exit 1; touch /var/nope' test ! -e "$root/read-only" @@ -178,7 +183,6 @@ EOF sh -xec "[[ \$container_uuid == $uuid ]]" # Mounts - tmpdir="$(mktemp -d)" mkdir "$tmpdir"/{1,2,3} touch "$tmpdir/1/one" "$tmpdir/2/two" "$tmpdir/3/three" touch "$tmpdir/foo"