[Buildroot] [PATCH RFC 1/1] support/testing/tests/package/test_criu.py: new runtime test

Yann E. MORIN yann.morin.1998 at free.fr
Wed Nov 1 21:24:12 UTC 2023


Julien, All,

On 2023-09-16 00:14 +0200, Julien Olivain spake thusly:
> Cc: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
> Cc: Marcus Folkesson <marcus.folkesson at gmail.com>
> Signed-off-by: Julien Olivain <ju.o at 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.  |
'------------------------------^-------^------------------^--------------------'



More information about the buildroot mailing list