All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Julien Olivain <ju.o@free.fr>
Cc: Marcus Folkesson <marcus.folkesson@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH RFC 1/1] support/testing/tests/package/test_criu.py: new runtime test
Date: Wed, 1 Nov 2023 22:24:12 +0100	[thread overview]
Message-ID: <20231101212412.GG114892@scaer> (raw)
In-Reply-To: <20230915221444.1686011-1-ju.o@free.fr>

Julien, All,

On 2023-09-16 00:14 +0200, Julien Olivain spake thusly:
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Cc: Marcus Folkesson <marcus.folkesson@gmail.com>
> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
> This test was suggested by Thomas in [1] during the criu package
> proposal in [2]. criu is not accepted yet. This is a first version
> of the test for review. Minor rework is expected to align the the
> final criu package patch.

Thanks, these runtime tests you submit are very important!

[--SNIP--]
> diff --git a/support/testing/tests/package/test_criu.py b/support/testing/tests/package/test_criu.py
> new file mode 100644
> index 0000000000..af2def85e1
> --- /dev/null
> +++ b/support/testing/tests/package/test_criu.py
> @@ -0,0 +1,127 @@
[--SNIP--]
> +class TestCriu(infra.basetest.BRTest):
> +    # Criu needs to recompile a Kernel, to enable
> +    # CONFIG_CHECKPOINT_RESTORE=y
> +    config = \
> +        """
> +        BR2_aarch64=y
> +        BR2_TOOLCHAIN_EXTERNAL=y
> +        BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
> +        BR2_LINUX_KERNEL=y
> +        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
> +        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.1.53"
> +        BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
> +        BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
> +        BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="{}"
> +        BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
> +        BR2_PACKAGE_CRIU=y
> +        BR2_PACKAGE_HOST_PYTHON3=y

No longer needed, criu selects it now.

[--SNIP--]
> +    def test_run(self):
[--SNIP--]
> diff --git a/support/testing/tests/package/test_criu/rootfs-overlay/root/criu-loop.sh b/support/testing/tests/package/test_criu/rootfs-overlay/root/criu-loop.sh
> new file mode 100755
> index 0000000000..6a1f72b442
> --- /dev/null
> +++ b/support/testing/tests/package/test_criu/rootfs-overlay/root/criu-loop.sh
> @@ -0,0 +1,15 @@
> +#! /bin/sh
> +set -eu
> +echo "Start"
> +for LOOP in $(seq 6) ; do
> +    echo "Loop $LOOP"
> +    if [ "$LOOP" -eq 3 ] ; then
> +        touch /tmp/wait-flag
> +    fi
> +    while [ -e /tmp/wait-flag ] ; do
> +        sleep 1
> +        echo "Waiting..."
> +    done
> +    sleep 1
> +done
> +echo "Done"

This loop looks dubious. I think we can do simpler:

Here's shat the shell script would look like:

    #! /bin/sh
    set -eu

    echo "Start"
    touch /tmp/wait-flag

    while [ -e /tmp/wait-flag ] ; do
        sleep 1
        echo "Waiting..."
    done

    touch /tmp/stop-flag
    echo "Done"


And the python scriopt would basivally do:

    spawn script
    wait for /tmp/wait-flag
    suspend process
    check it no longer exists
    resume process
    check it exists again
    remove the wait-flag
    wait "a bit"
    check the stop-flag exists

By using the stop flag, you know the script is still alive: it went past
the wait-falg and informed us that it is still runing by touching
another file.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

      reply	other threads:[~2023-11-01 21:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15 22:14 [Buildroot] [PATCH RFC 1/1] support/testing/tests/package/test_criu.py: new runtime test Julien Olivain
2023-11-01 21:24 ` Yann E. MORIN [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=20231101212412.GG114892@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.org \
    --cc=ju.o@free.fr \
    --cc=marcus.folkesson@gmail.com \
    --cc=thomas.petazzoni@bootlin.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.