[U-Boot] [PATCH 1/1] test/py: provide example scripts for integrating qemu

Stephen Warren swarren at wwwdotorg.org
Mon Sep 18 18:27:19 UTC 2017


On 09/17/2017 01:32 PM, Heinrich Schuchardt wrote:
> The necessary parameters for running Python tests on qemu are
> tediouus to find.

Nit: tedious

Let's wrap the commit description to 72-74 characters; it's rather 
narrow right now.

> 
> The patch adds examples for u-boot-test-console and
> u-boot-test-reset.

> diff --git a/test/py/README.md b/test/py/README.md
> index 829c7efbb2..f3ad10df5a 100644
> --- a/test/py/README.md
> +++ b/test/py/README.md
> @@ -197,6 +197,23 @@ simulator includes a virtual reset button! If not, you can launch the
>   simulator from `u-boot-test-reset` instead, while arranging for this console
>   process to always communicate with the current simulator instance.

Rather that adding these examples into a section that details one of the 
individual hook scripts, let's create a new section "Simple qemu 
example" and put it right before or after the existing "Examples" section.

> +With qemu you can use the parameter -monitor to connect the control console to a
> +Unix socket, e.g.

Let's state what filename the following example should be saved to; 
u-boot-test-console.

> +    #!/bin/sh
> +    touch /tmp/u-boot-monitor-socket
> +    qemu-system-x86_64 -bios build-qemu-x86/u-boot.rom -nographic -netdev \
> +    user,id=eth0,tftp=../tftp,net=192.168.76.0/24,dhcpstart=192.168.76.9 \

Let's indent the continuation lines so it's more obvious this is a 
multi-line command:

asdfsd fsjkl fsfj lssfjdasdfsjl \
	asdfsd fsjkl fsfj lssfjdasdfsjl \
	asdfsd fsjkl fsfj lssfjdasdfsjl \

I think this (and the other) script should "exec" the commands to avoid 
leaving the shell instance around.

This example seems to enable networking support in qemu, and a TFTP 
server. I believe you'll need to provide an example Python board 
configuration so that test/py knows to enable the network tests.

> +    -device e1000,netdev=eth0 -machine pc-i440fx-2.8 \
> +    -monitor unix:/tmp/u-boot-monitor-socket,server,nowait
> +
> +In `u-boot-test-reset` call the socat command to send a system reset:
> +
> +    #!/bin/sh
> +    echo system_reset | socat - UNIX-CONNECT:/tmp/u-boot-monitor-socket
> +    sleep 1
> +    true

Why is the sleep needed? The true command shouldn't have any effect 
given set -e isn't in use.

I only see examples for u-boot-test-console and u-boot-test-reset. I 
believe you need to provide a dummy/empty u-boot-test-flash too.


More information about the U-Boot mailing list