Re: [kvm-unit-tests PATCH v2 23/23] arm64: Add an efi/run script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 22, 2022 at 03:13:56PM +0100, Nikos Nikoleris wrote:
> On 22/06/2022 00:09, Ricardo Koller wrote:
> > On Fri, May 06, 2022 at 09:56:05PM +0100, Nikos Nikoleris wrote:
> > > This change adds a efi/run script inspired by the one in x86. This
> > > script will setup a folder with the test compiled as an EFI app and a
> > > startup.nsh script. The script launches QEMU providing an image with
> > > EDKII and the path to the folder with the test which is executed
> > > automatically.
> > > 
> > > For example:
> > > 
> > > $> ./arm/efi/run ./arm/selftest.efi setup smp=2 mem=256
> > > 
> > > Signed-off-by: Nikos Nikoleris <nikos.nikoleris@xxxxxxx>
> > > ---
> > >   scripts/runtime.bash | 14 +++++-----
> > >   arm/efi/run          | 61 ++++++++++++++++++++++++++++++++++++++++++++
> > >   arm/run              |  8 ++++--
> > >   arm/Makefile.common  |  1 +
> > >   arm/dummy.c          |  4 +++
> > >   5 files changed, 78 insertions(+), 10 deletions(-)
> > >   create mode 100755 arm/efi/run
> > >   create mode 100644 arm/dummy.c
> > > 
> > > diff --git a/scripts/runtime.bash b/scripts/runtime.bash
> > > index 7d0180b..dc28f24 100644
> > > --- a/scripts/runtime.bash
> > > +++ b/scripts/runtime.bash
> > > @@ -131,14 +131,12 @@ function run()
> > >       fi
> > > 
> > >       last_line=$(premature_failure > >(tail -1)) && {
> > > -        skip=true
> > > -        if [ "${CONFIG_EFI}" == "y" ] && [[ "${last_line}" =~ "enabling apic" ]]; then
> > > -            skip=false
> > > -        fi
> > > -        if [ ${skip} == true ]; then
> > > -            print_result "SKIP" $testname "" "$last_line"
> > > -            return 77
> > > -        fi
> > > +        if [ "${CONFIG_EFI}" == "y" ] && [ "${ARCH}" = x86_64 ]; then
> > > +            if ! [[ "${last_line}" =~ "enabling apic" ]]; then
> > > +                    print_result "SKIP" $testname "" "$last_line"
> > > +                    return 77
> > > +            fi
> > > +    fi
> > >       }
> > > 
> > >       cmdline=$(get_cmdline $kernel)
> > > diff --git a/arm/efi/run b/arm/efi/run
> > > new file mode 100755
> > > index 0000000..dfff717
> > > --- /dev/null
> > > +++ b/arm/efi/run
> > > @@ -0,0 +1,61 @@
> > > +#!/bin/bash
> > > +
> > > +set -e
> > > +
> > > +if [ $# -eq 0 ]; then
> > > +    echo "Usage $0 TEST_CASE [QEMU_ARGS]"
> > > +    exit 2
> > > +fi
> > > +
> > > +if [ ! -f config.mak ]; then
> > > +    echo "run './configure --enable-efi && make' first. See ./configure -h"
> > > +    exit 2
> > > +fi
> > > +source config.mak
> > > +source scripts/arch-run.bash
> > > +source scripts/common.bash
> > > +
> > > +: "${EFI_SRC:=$(realpath "$(dirname "$0")/../")}"
> > > +: "${EFI_UEFI:=/usr/share/qemu-efi-aarch64/QEMU_EFI.fd}"
> > > +: "${EFI_TEST:=efi-tests}"
> > > +: "${EFI_CASE:=$(basename $1 .efi)}"
> > > +
> > > +if [ ! -f "$EFI_UEFI" ]; then
> > > +    echo "UEFI firmware not found: $EFI_UEFI"
> > > +    echo "Please install the UEFI firmware to this path"
> > > +    echo "Or specify the correct path with the env variable EFI_UEFI"
> > > +    exit 2
> > > +fi
> > > +
> > > +# Remove the TEST_CASE from $@
> > > +shift 1
> > > +
> > > +# Fish out the arguments for the test, they should be the next string
> > > +# after the "-append" option
> > > +qemu_args=()
> > > +cmd_args=()
> > > +while (( "$#" )); do
> > > +    if [ "$1" = "-append" ]; then
> > > +            cmd_args=$2
> > > +            shift 2
> > 
> > Does this work with params like this (2 words)?
> > 
> >       [pmu-cycle-counter]
> >       file = pmu.flat
> >       groups = pmu
> >       extra_params = -append 'cycle-counter 0'
> > 
> 
> I think it does. cmd_args will take the value of the string that follows
> append and in this case whatever is between the single/double quotes.

Just in case I tested it on bash and it works as expected.

So, with that:

Reviewed-by: Ricardo Koller <ricarkol@xxxxxxxxxx>



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux