meta-virtualization.lists.yoctoproject.org archive mirror
 help / color / mirror / Atom feed
From: Bruce Ashfield <bruce.ashfield@gmail.com>
To: Xiangyu Chen <xiangyu.chen@eng.windriver.com>
Cc: meta-virtualization@lists.yoctoproject.org
Subject: Re: [meta-virtualization][PATCH] lxc: fix broken test cases
Date: Tue, 9 Apr 2024 10:09:04 -0400	[thread overview]
Message-ID: <CADkTA4Oe71dQ101iLaP5hqgz99cEkJFqozZ5MSnqM53XJyFquQ@mail.gmail.com> (raw)
In-Reply-To: <20240326094258.1138548-1-xiangyu.chen@eng.windriver.com>

[-- Attachment #1: Type: text/plain, Size: 10901 bytes --]

merged to master-next (which should become master tomorrow, or later today).

Bruce

On Tue, Mar 26, 2024 at 5:03 AM Xiangyu Chen <xiangyu.chen@eng.windriver.com>
wrote:

> From: Xiangyu Chen <xiangyu.chen@windriver.com>
>
> 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 <xiangyu.chen@windriver.com>
> ---
>  ...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
>
> diff --git
> a/recipes-containers/lxc/files/0001-lxc-test-usernic-drop-cgroup-handling.patch
> b/recipes-containers/lxc/files/0001-lxc-test-usernic-drop-cgroup-handling.patch
> new file mode 100644
> index 00000000..162e8f9d
> --- /dev/null
> +++
> b/recipes-containers/lxc/files/0001-lxc-test-usernic-drop-cgroup-handling.patch
> @@ -0,0 +1,61 @@
> +From ec85e5ca4953292c4341497704ce738669a79b64 Mon Sep 17 00:00:00 2001
> +From: Serge Hallyn <serge@hallyn.com>
> +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 <serge@hallyn.com>
> +Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
> +---
> + 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
> +
> diff --git
> a/recipes-containers/lxc/files/0001-tests-remove-old-and-broken-cgroup-handling-code-fro.patch
> b/recipes-containers/lxc/files/0001-tests-remove-old-and-broken-cgroup-handling-code-fro.patch
> new file mode 100644
> index 00000000..bf8df795
> --- /dev/null
> +++
> b/recipes-containers/lxc/files/0001-tests-remove-old-and-broken-cgroup-handling-code-fro.patch
> @@ -0,0 +1,103 @@
> +From 8f9733d756361ff8f8d8d589f286c0e064b1195d Mon Sep 17 00:00:00 2001
> +From: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
> +Date: Thu, 15 Feb 2024 18:13:05 +0100
> +Subject: [PATCH] tests: remove old and broken cgroup handling code from
> tests
> +
> +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
> ]
> +
> +Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com
> >
> +Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
> +---
> + 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-mount
> b/src/tests/lxc-test-apparmor-mount
> +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/cgmanager
> org.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_cmd lxc-create -t busybox -n $cname
> +
> + 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/cgmanager
> org.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_cmd lxc-create -t busybox -n c1 -l trace -o "${UNPRIV_LOG}"
> +
> + # Make sure we can start it - twice
> +--
> +2.35.5
> +
> diff --git a/recipes-containers/lxc/lxc_git.bb b/recipes-containers/lxc/
> lxc_git.bb
> index 33ea4ee7..ee0e442f 100644
> --- a/recipes-containers/lxc/lxc_git.bb
> +++ b/recipes-containers/lxc/lxc_git.bb
> @@ -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: meta-virtualization+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [
> bruce.ashfield@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II

[-- Attachment #2: Type: text/html, Size: 14619 bytes --]

      reply	other threads:[~2024-04-09 14:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26  9:42 [meta-virtualization][PATCH] lxc: fix broken test cases Xiangyu Chen
2024-04-09 14:09 ` Bruce Ashfield [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADkTA4Oe71dQ101iLaP5hqgz99cEkJFqozZ5MSnqM53XJyFquQ@mail.gmail.com \
    --to=bruce.ashfield@gmail.com \
    --cc=meta-virtualization@lists.yoctoproject.org \
    --cc=xiangyu.chen@eng.windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).