From: Alexander Mikhalitsyn Date: Tue, 29 Jul 2025 09:32:13 +0000 (+0200) Subject: tests/lxc-test-rootfs: add idmapped rootfs testcase X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d8d439af89aab6e2cf51c0ed2857f86c477d2d2;p=thirdparty%2Flxc.git tests/lxc-test-rootfs: add idmapped rootfs testcase I've discovered that we have no test coverage for rootfs "lxc.rootfs.options = idmap=container" at all. Let's add this basic test at least. Signed-off-by: Alexander Mikhalitsyn --- diff --git a/src/tests/lxc-test-rootfs b/src/tests/lxc-test-rootfs index 9deaf18a4..bd9bb069e 100755 --- a/src/tests/lxc-test-rootfs +++ b/src/tests/lxc-test-rootfs @@ -9,6 +9,7 @@ set -ex cleanup() { set +e lxc-destroy -n lxc-test-rootfs -f + sed -i '/^root:910000:10000/d' /etc/subuid /etc/subgid if [ $PHASE != "done" ]; then echo "rootfs test failed at $PHASE" exit 1 @@ -48,4 +49,20 @@ mkdir /proc/$pid/root/rwtest || ro=1 rmdir /proc/$pid/root/rwtest ro=0 +lxc-stop -n lxc-test-rootfs -k +PHASE=idmapped_rootfs +echo "Starting phase $PHASE" +usermod -v 910000-919999 -w 910000-919999 root +sed -i '/lxc.rootfs.options/d' $config +echo "lxc.idmap = u 0 910000 9999" >> $config +echo "lxc.idmap = g 0 910000 9999" >> $config +echo "lxc.rootfs.options = idmap=container" >> $config +lxc-start -n lxc-test-rootfs +pid=$(lxc-info -n lxc-test-rootfs -p -H) +ro=0 +lxc-attach -n lxc-test-rootfs -- mkdir /rwtest || ro=1 +[ $ro -ne 1 ] +rmdir /proc/$pid/root/rwtest +ro=0 + PHASE=done