lxc: fix broken test cases
PATCH 1/1 lxc: fix broken test cases
From: Xiangyu Chen <[email protected]>
Upstream dropped cgroup handling in lxc-test-usernic lxc-test-unpriv and lxc-test-apparmor-mount to fix the broken cases.
--- ...xc-test-usernic-drop-cgroup-handling.patch | 61 +++++++++++ ...-and-broken-cgroup-handling-code-fro.patch | 103 ++++++++++++++++++ recipes-containers/lxc/lxc_git.bb | 2 + 3 files changed, 166 insertions(+) create mode 100644 recipes-containers/lxc/files/0001-lxc-test-usernic-drop-cgroup-handling.patch create mode 100644 recipes-containers/lxc/files/0001-tests-remove-old-and-broken-cgroup-handling-code-fro.patch
recipes-containers/lxc/files/0001-lxc-test-usernic-drop-cgroup-handling.patch new file +61 -0
@@ -0,0 +1,61 @@ +From ec85e5ca4953292c4341497704ce738669a79b64 Mon Sep 17 00:00:00 2001 +From: Serge Hallyn <[email protected]> +Date: Fri, 2 Feb 2024 10:41:11 -0600 +Subject: [PATCH] lxc-test-usernic: drop cgroup handling + +This stuff is not needed in a modern systemd based system, and in fact +breaks. It would probably be better to detect such a system so that a +non-systemd box can still run this test. But I'm not sure what would be +reliable. + +Upstream-Status: Backport from +[https://github.com/lxc/lxc/commit/ec85e5ca4953292c4341497704ce738669a79b64] + +Signed-off-by: Serge Hallyn <[email protected]> +Signed-off-by: Xiangyu Chen <[email protected]> +--- + src/tests/lxc-test-usernic.in | 28 ---------------------------- + 1 file changed, 28 deletions(-) + +diff --git a/src/tests/lxc-test-usernic.in b/src/tests/lxc-test-usernic.in +index 9af8678f3..49fd5e3f7 100755 +--- a/src/tests/lxc-test-usernic.in ++++ b/src/tests/lxc-test-usernic.in +@@ -80,34 +80,6 @@ lxc.idmap = u 0 910000 10000 + lxc.idmap = g 0 910000 10000 + EOF + +-if command -v cgm >/dev/null 2>&1; then +- cgm create all usernic-user +- cgm chown all usernic-user $(id -u usernic-user) $(id -g usernic-user) +- cgm movepid all usernic-user $$ +-elif [ -e /sys/fs/cgroup/cgmanager/sock ]; then +- for d in $(cut -d : -f 2 /proc/self/cgroup); do +- dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock \ +- --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.Create \ +- string:$d string:usernic-user >/dev/null +- +- dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock \ +- --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.Chown \ +- string:$d string:usernic-user int32:$(id -u usernic-user) int32:$(id -g usernic-user) >/dev/null +- +- dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock \ +- --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.MovePid \ +- string:$d string:usernic-user int32:$$ >/dev/null +- done +-else +- for d in /sys/fs/cgroup/*; do +- [ "$d" = "/sys/fs/cgroup/unified" ] && continue +- [ -f $d/cgroup.clone_children ] && echo 1 > $d/cgroup.clone_children +- [ ! -d $d/lxctest ] && mkdir $d/lxctest +- chown -R usernic-user: $d/lxctest +- echo $$ > $d/lxctest/tasks +- done +-fi +- + mkdir -p /run/user/$(id -u usernic-user) + chown -R usernic-user: /run/user/$(id -u usernic-user) /home/usernic-user + +-- +2.35.5 +
recipes-containers/lxc/files/0001-tests-remove-old-and-broken-cgroup-handling-code-fro.patch new file +103 -0
103 lines not on this page · raw message
recipes-containers/lxc/lxc_git.bb +2 -0
@@ -47,6 +47,8 @@ SRC_URI = "git://github.com/lxc/lxc.git;branch=stable-5.0;protocol=https \ file://0001-template-if-busybox-contains-init-use-it-in-containe.patch \ file://dnsmasq.conf \ file://lxc-net \ + file://0001-lxc-test-usernic-drop-cgroup-handling.patch \ + file://0001-tests-remove-old-and-broken-cgroup-handling-code-fro.patch \ " SRCREV = "cb8e38aca27a23964941f0f011a8919aab8bebab"
Signature · 1 line
2.35.5
Bruce Ashfield
Appliedmerged to master-next (which should become master tomorrow, or later today).
Bruce
Quoted 263 lines · Xiangyu Chen
From: Xiangyu Chen <[email protected]>
Upstream dropped cgroup handling in lxc-test-usernic lxc-test-unpriv and lxc-test-apparmor-mount to fix the broken cases.
Signed-off-by Xiangyu Chen <[email protected]>--- ...xc-test-usernic-drop-cgroup-handling.patch | 61 +++++++++++ ...-and-broken-cgroup-handling-code-fro.patch | 103 ++++++++++++++++++ recipes-containers/lxc/lxc_git.bb | 2 + 3 files changed, 166 insertions(+) create mode 100644 recipes-containers/lxc/files/0001-lxc-test-usernic-drop-cgroup-handling.patch create mode 100644
recipes-containers/lxc/files/0001-tests-remove-old-and-broken-cgroup-handling-code-fro.patchdiff --git
a/recipes-containers/lxc/files/0001-lxc-test-usernic-drop-cgroup-handling.patchb/recipes-containers/lxc/files/0001-lxc-test-usernic-drop-cgroup-handling.patchnew file mode 100644
index 00000000..162e8f9d
---/dev/null
+++b/recipes-containers/lxc/files/0001-lxc-test-usernic-drop-cgroup-handling.patchrecipes-containers/lxc/files/0001-lxc-test-usernic-drop-cgroup-handling.patch new file +12
-0@@ -0,0 +1,61 @@ +From ec85e5ca4953292c4341497704ce738669a79b64 Mon Sep 17 00:00:00 2001 +From: Serge Hallyn <[email protected]> +Date: Fri, 2 Feb 2024 10:41:11 -0600 +Subject: [PATCH] lxc-test-usernic: drop cgroup handling + +This stuff is not needed in a modern systemd based system, and in fact +breaks. It would probably be better to detect such a system so that a +non-systemd box can still run this test. But I'm not sure what would be +reliable. + +Upstream-Status: Backport from +[https://github.com/lxc/lxc/commit/ec85e5ca4953292c4341497704ce738669a79b64
]recipes-containers/lxc/files/0001-lxc-test-usernic-drop-cgroup-handling.patch new file +8
-0+ +Signed-off-by: Serge Hallyn <[email protected]> +Signed-off-by: Xiangyu Chen <[email protected]> +--- + src/tests/lxc-test-usernic.in | 28 ---------------------------- + 1 file changed, 28 deletions(-) + +diff --git a/src/tests/lxc-test-usernic.in b/src/tests/lxc-test-usernic.in
recipes-containers/lxc/files/0001-lxc-test-usernic-drop-cgroup-handling.patch new file +10
-0+index 9af8678f3..49fd5e3f7 100755 +--- a/src/tests/lxc-test-usernic.in ++++ b/src/tests/lxc-test-usernic.in +@@ -80,34 +80,6 @@ lxc.idmap = u 0 910000 10000 + lxc.idmap = g 0 910000 10000 + EOF + +-if command -v cgm >/dev/null 2>&1; then +- cgm create all usernic-user +- cgm chown all usernic-user $(id -u usernic-user) $(id -gusernic-user)
+- cgm movepid all usernic-user $$ +-elif [ -e /sys/fs/cgroup/cgmanager/sock ]; then +- for d in $(cut -d : -f 2 /proc/self/cgroup); do +- dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock \ +- --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.Create \ +- string:$d string:usernic-user >/dev/null +- +- dbus-send --print-reply--address=unix:path=/sys/fs/cgroup/cgmanager/sock \
+- --type=method_call /org/linuxcontainers/cgmanager
org.linuxcontainers.cgmanager0_0.Chown \
+- string:$d string:usernic-user int32:$(id -u
usernic-user) int32:$(id -g usernic-user) >/dev/null+- +- dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock \ +- --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.MovePid \ +- string:$d string:usernic-user int32:$$ >/dev/null +- done +-else +- for d in /sys/fs/cgroup/*; do +- [ "$d" = "/sys/fs/cgroup/unified" ] && continue +- [ -f $d/cgroup.clone_children ] && echo 1 > $d/cgroup.clone_children +- [ ! -d $d/lxctest ] && mkdir $d/lxctest +- chown -R usernic-user: $d/lxctest +- echo $$ > $d/lxctest/tasks +- done +-fi +-+ mkdir -p /run/user/$(id -u usernic-user)
+ chown -R usernic-user: /run/user/$(id -u usernic-user)/home/usernic-userrecipes-containers/lxc/files/0001-lxc-test-usernic-drop-cgroup-handling.patch new file +4
-0+ +-- +2.35.5 +diff --git
a/recipes-containers/lxc/files/0001-tests-remove-old-and-broken-cgroup-handling-code-fro.patchb/recipes-containers/lxc/files/0001-tests-remove-old-and-broken-cgroup-handling-code-fro.patchnew file mode 100644
index 00000000..bf8df795
---/dev/null
+++b/recipes-containers/lxc/files/0001-tests-remove-old-and-broken-cgroup-handling-code-fro.patchrecipes-containers/lxc/files/0001-tests-remove-old-and-broken-cgroup-handling-code-fro.patch new file +4
-0@@ -0,0 +1,103 @@ +From 8f9733d756361ff8f8d8d589f286c0e064b1195d Mon Sep 17 00:00:00 2001 +From: Alexander Mikhalitsyn <[email protected]> +Date: Thu, 15 Feb 2024 18:13:05 +0100 +Subject: [PATCH] tests: remove old and broken cgroup handling code fromtests
recipes-containers/lxc/files/0001-tests-remove-old-and-broken-cgroup-handling-code-fro.patch new file +9
-0+ +We have removed the same piece of code in +ec85e5ca495 ("lxc-test-usernic: drop cgroup handling") +let's do the same for two other tests. + +This fixes autopkgtests. + +Upstream-Status: Backport from +[https://github.com/lxc/lxc/commit/8f9733d756361ff8f8d8d589f286c0e064b1195d
](quoted diff) +2
-0+ +Signed-off-by: Alexander Mikhalitsyn <[email protected]Quoted 1 line
recipes-containers/lxc/files/0001-tests-remove-old-and-broken-cgroup-handling-code-fro.patch new file +7
-0+Signed-off-by: Xiangyu Chen <[email protected]> +--- + src/tests/lxc-test-apparmor-mount | 29 ----------------------------- + src/tests/lxc-test-unpriv | 28 ---------------------------- + 2 files changed, 57 deletions(-) + +diff --git a/src/tests/lxc-test-apparmor-mountb/src/tests/lxc-test-apparmor-mount
recipes-containers/lxc/files/0001-tests-remove-old-and-broken-cgroup-handling-code-fro.patch new file +15
-1+index 7c9d9ad50..ddf783d4b 100755 +--- a/src/tests/lxc-test-apparmor-mount ++++ b/src/tests/lxc-test-apparmor-mount +@@ -119,35 +119,6 @@ chown -R $TUSER: /run/user/$(id -u $TUSER) + + cd $HDIR + +-if command -v cgm >/dev/null 2>&1; then +- cgm create all $TUSER +- cgm chown all $TUSER $(id -u $TUSER) $(id -g $TUSER) +- cgm movepid all $TUSER $$ +-elif [ -e /sys/fs/cgroup/cgmanager/sock ]; then +- for d in $(cut -d : -f 2 /proc/self/cgroup); do +- dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock \ +- --type=method_call /org/linuxcontainers/cgmanagerorg.linuxcontainers.cgmanager0_0.Create \
+- string:$d string:$TUSER >/dev/null +- +- dbus-send --print-reply--address=unix:path=/sys/fs/cgroup/cgmanager/sock \
+- --type=method_call /org/linuxcontainers/cgmanager
org.linuxcontainers.cgmanager0_0.Chown \
+- string:$d string:$TUSER int32:$(id -u $TUSER)
int32:$(id -g $TUSER) >/dev/null+- +- dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock \ +- --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.MovePid \ +- string:$d string:$TUSER int32:$$ >/dev/null +- done +-else +- for d in /sys/fs/cgroup/*; do +- [ "$d" = "/sys/fs/cgroup/unified" ] && continue +- [ -f $d/cgroup.clone_children ] && echo 1 > $d/cgroup.clone_children +- [ ! -d $d/lxctest ] && mkdir $d/lxctest +- chown -R $TUSER: $d/lxctest +- echo $$ > $d/lxctest/tasks +- done +-fi +- +-+
run_cmdlxc-create -t busybox -n $cnamerecipes-containers/lxc/files/0001-tests-remove-old-and-broken-cgroup-handling-code-fro.patch new file +18
-1+ + echo "test default confined container" +diff --git a/src/tests/lxc-test-unpriv b/src/tests/lxc-test-unpriv +index 8fb9106d6..426add9da 100755 +--- a/src/tests/lxc-test-unpriv ++++ b/src/tests/lxc-test-unpriv +@@ -130,34 +130,6 @@ chown -R $TUSER: /run/user/$(id -u $TUSER) + + cd $HDIR + +-if command -v cgm >/dev/null 2>&1; then +- cgm create all $TUSER +- cgm chown all $TUSER $(id -u $TUSER) $(id -g $TUSER) +- cgm movepid all $TUSER $$ +-elif [ -e /sys/fs/cgroup/cgmanager/sock ]; then +- for d in $(cut -d : -f 2 /proc/self/cgroup); do +- dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock \ +- --type=method_call /org/linuxcontainers/cgmanagerorg.linuxcontainers.cgmanager0_0.Create \
+- string:$d string:$TUSER >/dev/null +- +- dbus-send --print-reply--address=unix:path=/sys/fs/cgroup/cgmanager/sock \
+- --type=method_call /org/linuxcontainers/cgmanager
org.linuxcontainers.cgmanager0_0.Chown \
+- string:$d string:$TUSER int32:$(id -u $TUSER)
int32:$(id -g $TUSER) >/dev/null+- +- dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock \ +- --type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.MovePid \ +- string:$d string:$TUSER int32:$$ >/dev/null +- done +-else +- for d in /sys/fs/cgroup/*; do +- [ "$d" = "/sys/fs/cgroup/unified" ] && continue +- [ -f $d/cgroup.clone_children ] && echo 1 > $d/cgroup.clone_children +- [ ! -d $d/lxctest ] && mkdir $d/lxctest +- chown -R $TUSER: $d/lxctest +- echo $$ > $d/lxctest/tasks +- done +-fi +-+
run_cmdlxc-create -t busybox -n c1 -l trace -o "${UNPRIV_LOG}"recipes-containers/lxc/files/0001-tests-remove-old-and-broken-cgroup-handling-code-fro.patch new file +5
-0+ + # Make sure we can start it - twice +-- +2.35.5 +recipes-containers/lxc/ renamed from recipes-containers/lxc/lxc_git.bb +0
-0lxc_git.bb
index33ea4ee7..ee0e442f100644recipes-containers/lxc/lxc_git.bb +2
-0@@ -47,6 +47,8 @@ SRC_URI = "git:// github.com/lxc/lxc.git;branch=stable-5.0;protocol=https \ file://0001-template-if-busybox-contains-init-use-it-in-containe.patch \ file://dnsmasq.conf \ file://lxc-net \ + file://0001-lxc-test-usernic-drop-cgroup-handling.patch \ + file://0001-tests-remove-old-and-broken-cgroup-handling-code-fro.patch \"SRCREV = "
cb8e38aca27a23964941f0f011a8919aab8bebab"
--
2.35.5-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#8656):
https://lists.yoctoproject.org/g/meta-virtualization/message/8656
Mute This Topic: https://lists.yoctoproject.org/mt/105154916/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II