Skip to contentSkip to conversation

automation: Support running FVP Dom0 smoke test for Arm

PATCH Superseded Henry Wang 2 participants 15 messages Dec 7, 2023 – Dec 8, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Henry Wang

author
#0 lore raw

cover automation: Support running FVP Dom0 smoke test for Arm

This series adds the support for running FVP Dom0 smoke test for Arm on the Arm64 GitLab CI runner. Detailed changes please refer to the commit message of each commit.

An example test pipeline with these patches applied (with the docker registry changed to my own registry and unrelated job removed) can be found at:
https://gitlab.com/xen-project/people/henryw/xen/-/pipelines/1098531057

Henry Wang (5):
automation: Add a Dockerfile for running FVP_Base jobs
automation: Add the Dockerfile to build TF-A and U-Boot for FVP
automation: Add the expect script with test case for FVP
automation: Add the script for the FVP smoke test
automation: Add the arm64 FVP build and Dom0 smoke test jobs

 .../debian/bookworm-arm64v8-fvp.dockerfile    |  64 ++++++++++
 automation/gitlab-ci/build.yaml               |  17 +++
 automation/gitlab-ci/test.yaml                |  22 ++++
 .../expect/fvp-base-smoke-dom0-arm64.exp      |  73 +++++++++++
 .../scripts/fvp-base-smoke-dom0-arm64.sh      | 117 ++++++++++++++++++
 .../2023.10-2.9.0-arm64v8.dockerfile          |  48 +++++++
 6 files changed, 341 insertions(+)
 create mode 100644 automation/build/debian/bookworm-arm64v8-fvp.dockerfile
 create mode 100755 automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp
 create mode 100755 automation/scripts/fvp-base-smoke-dom0-arm64.sh
 create mode 100644 automation/tests-artifacts/armfvp-uboot-tfa/2023.10-2.9.0-arm64v8.dockerfile
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 1/5 automation: Add a Dockerfile for running FVP_Base jobs

Fixed Virtual Platforms (FVPs) are complete simulations of an Arm system, including processor, memory and peripherals. These are set out in a "programmer's view", which gives programmers a comprehensive model on which to build and test software. FVP can be configured to different setups by its cmdline parameters, and hence having the FVP in CI will provide us with the flexibility to test Arm features and setups that we find difficult to use real hardware or emulators.

This commit adds a Dockerfile for the new arm64v8 container with FVP installed, based on the debian bookworm-arm64v8 image. This container will be used to run the FVP test jobs. Compared to the debian bookworm-arm64v8 image, the packages in the newly added FVP container does not contain the u-boot-qemu, and adds the expect to run expect scripts introduced by following commits, telnet to connect to FVP, and tftpd-hpa to provide the TFTP service for the FVP.

---
 .../debian/bookworm-arm64v8-fvp.dockerfile    | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 automation/build/debian/bookworm-arm64v8-fvp.dockerfile
automation/build/debian/bookworm-arm64v8-fvp.dockerfile new file +64 -0
new file mode 100644
index 0000000000..3b87dc5a5b
@@ -0,0 +1,64 @@
+FROM --platform=linux/arm64/v8 debian:bookworm
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="[email protected]"
+
+ARG FVP_BASE_VERSION="11.23_9_Linux64_armv8l"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        zlib1g-dev \
+        libncurses5-dev \
+        libssl-dev \
+        python3-dev \
+        python3-setuptools \
+        xorg-dev \
+        uuid-dev \
+        libyajl-dev \
+        libaio-dev \
+        libglib2.0-dev \
+        clang \
+        libpixman-1-dev \
+        pkg-config \
+        flex \
+        bison \
+        acpica-tools \
+        libfdt-dev \
+        bin86 \
+        bcc \
+        liblzma-dev \
+        libnl-3-dev \
+        ocaml-nox \
+        libfindlib-ocaml-dev \
+        markdown \
+        transfig \
+        pandoc \
+        checkpolicy \
+        wget \
+        git \
+        nasm \
+        # for test phase, fvp-smoke-* jobs
+        u-boot-tools \
+        expect \
+        device-tree-compiler \
+        curl \
+        cpio \
+        busybox-static \
+        telnet \
+        tftpd-hpa \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
+
+RUN wget https://developer.arm.com/-/media/Files/downloads/ecosystem-models/FVP_Base_RevC-2xAEMvA_${FVP_BASE_VERSION}.tgz && \
+    mkdir -p /FVP/FVP_Base_RevC-2xAEMvA && \
+    tar -xvzf FVP_Base_RevC-2xAEMvA_${FVP_BASE_VERSION}.tgz -C /FVP/FVP_Base_RevC-2xAEMvA && \
+    rm FVP_Base_RevC-2xAEMvA_${FVP_BASE_VERSION}.tgz
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH 1/5] automation: Add a Dockerfile for running FVP_Base jobs

automation/build/debian/bookworm-arm64v8-fvp.dockerfile

Quoted 28 lines · Henry Wang

Fixed Virtual Platforms (FVPs) are complete simulations of an Arm system, including processor, memory and peripherals. These are set out in a "programmer's view", which gives programmers a comprehensive model on which to build and test software. FVP can be configured to different setups by its cmdline parameters, and hence having the FVP in CI will provide us with the flexibility to test Arm features and setups that we find difficult to use real hardware or emulators.

This commit adds a Dockerfile for the new arm64v8 container with FVP installed, based on the debian bookworm-arm64v8 image. This container will be used to run the FVP test jobs. Compared to the debian bookworm-arm64v8 image, the packages in the newly added FVP container does not contain the u-boot-qemu, and adds the expect to run expect scripts introduced by following commits, telnet to connect to FVP, and tftpd-hpa to provide the TFTP service for the FVP.

---
 .../debian/bookworm-arm64v8-fvp.dockerfile    | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 automation/build/debian/bookworm-arm64v8-fvp.dockerfile
automation/build/debian/bookworm-arm64v8-fvp.dockerfile new file +0 -0
new file mode 100644
index 0000000000..3b87dc5a5b

Please move this container under automation/tests-artifacts/ because the container is only meant to be used for tests as opposed as to build Xen. I know that in other cases we have reused the build container but that just because it was already there an working for the purpose.

Also please name it based on the fvp rather than debian:

automation/tests-artifacts/armfvp/11.23_9-arm64v8.dockerfile

Everything else looks fine.

Quoted 68 lines
automation/build/debian/bookworm-arm64v8-fvp.dockerfile new file +64 -0
@@ -0,0 +1,64 @@
+FROM --platform=linux/arm64/v8 debian:bookworm
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="[email protected]"
+
+ARG FVP_BASE_VERSION="11.23_9_Linux64_armv8l"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        zlib1g-dev \
+        libncurses5-dev \
+        libssl-dev \
+        python3-dev \
+        python3-setuptools \
+        xorg-dev \
+        uuid-dev \
+        libyajl-dev \
+        libaio-dev \
+        libglib2.0-dev \
+        clang \
+        libpixman-1-dev \
+        pkg-config \
+        flex \
+        bison \
+        acpica-tools \
+        libfdt-dev \
+        bin86 \
+        bcc \
+        liblzma-dev \
+        libnl-3-dev \
+        ocaml-nox \
+        libfindlib-ocaml-dev \
+        markdown \
+        transfig \
+        pandoc \
+        checkpolicy \
+        wget \
+        git \
+        nasm \
+        # for test phase, fvp-smoke-* jobs
+        u-boot-tools \
+        expect \
+        device-tree-compiler \
+        curl \
+        cpio \
+        busybox-static \
+        telnet \
+        tftpd-hpa \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
+
+RUN wget https://developer.arm.com/-/media/Files/downloads/ecosystem-models/FVP_Base_RevC-2xAEMvA_${FVP_BASE_VERSION}.tgz && \
+    mkdir -p /FVP/FVP_Base_RevC-2xAEMvA && \
+    tar -xvzf FVP_Base_RevC-2xAEMvA_${FVP_BASE_VERSION}.tgz -C /FVP/FVP_Base_RevC-2xAEMvA && \
+    rm FVP_Base_RevC-2xAEMvA_${FVP_BASE_VERSION}.tgz
Signature · 1 line
2.25.1
Reviewed-by
#3 lore raw

Re: [PATCH 1/5] automation: Add a Dockerfile for running FVP_Base jobs

Quoted 35 lines · Stefano Stabellini

automation/build/debian/bookworm-arm64v8-fvp.dockerfile

Quoted 28 lines · Henry Wang

Fixed Virtual Platforms (FVPs) are complete simulations of an Arm system, including processor, memory and peripherals. These are set out in a "programmer's view", which gives programmers a comprehensive model on which to build and test software. FVP can be configured to different setups by its cmdline parameters, and hence having the FVP in CI will provide us with the flexibility to test Arm features and setups that we find difficult to use real hardware or emulators.

This commit adds a Dockerfile for the new arm64v8 container with FVP installed, based on the debian bookworm-arm64v8 image. This container will be used to run the FVP test jobs. Compared to the debian bookworm-arm64v8 image, the packages in the newly added FVP container does not contain the u-boot-qemu, and adds the expect to run expect scripts introduced by following commits, telnet to connect to FVP, and tftpd-hpa to provide the TFTP service for the FVP.

---
 .../debian/bookworm-arm64v8-fvp.dockerfile    | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 automation/build/debian/bookworm-arm64v8-fvp.dockerfile
automation/build/debian/bookworm-arm64v8-fvp.dockerfile new file +0 -0
new file mode 100644
index 0000000000..3b87dc5a5b

Please move this container under automation/tests-artifacts/ because the container is only meant to be used for tests as opposed as to build Xen. I know that in other cases we have reused the build container but that just because it was already there an working for the purpose.

Quoted 5 lines

Also please name it based on the fvp rather than debian:

automation/tests-artifacts/armfvp/11.23_9-arm64v8.dockerfile

Everything else looks fine.

I take it back. We even have automation/build/ubuntu/xenial-xilinx.dockerfile and automation/build/debian/bookworm-cppcheck.dockerfile

At one point I think we should separate the build containers from the ones we use for testing but I won't ask it here.

author
#4 lore raw

PATCH 2/5 automation: Add the Dockerfile to build TF-A and U-Boot for FVP

In reply to Henry Wang

Unlike the emulators that currently being used in the CI pipelines, the FVP must start at EL3. Therefore we need the firmware, i.e. the TrustedFirmware-A (TF-A), for corresponding functionality.

There is a dedicated board (vexpress_fvp) in U-Boot (serve as the BL33 of the TF-A) for the FVP platform, so the U-Boot should also be compiled for the FVP platform instead of reusing the U-Boot for the existing emulators used in the CI pipelines.

To avoid compiling TF-A and U-Boot everytime in the job, adding a Dockerfile to the test artifacts to build TF-A v2.9.0 and U-Boot v2023.10 for FVP. The binaries for the TF-A and U-Boot, as well as the device tree for the FVP platform, will be saved (and exported by the CI job introduced by following commits). Note that, a patch for the TF-A will be applied before building to enable the virtio-net and the virtio-rng device on the FVP. The virtio-net device will provide the networking service for FVP, and the virtio-rng device will improve the speed of the FVP.

---
 .../2023.10-2.9.0-arm64v8.dockerfile          | 48 +++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 automation/tests-artifacts/armfvp-uboot-tfa/2023.10-2.9.0-arm64v8.dockerfile
automation/tests-artifacts/armfvp-uboot-tfa/2023.10-2.9.0-arm64v8.dockerfile new file +48 -0
new file mode 100644
index 0000000000..6566b60545
@@ -0,0 +1,48 @@
+FROM --platform=linux/arm64/v8 debian:bookworm
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="[email protected]"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV UBOOT_VERSION="2023.10"
+ENV TFA_VERSION="v2.9.0"
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        libssl-dev \
+        bc \
+        curl \
+        flex \
+        bison \
+        git \
+        device-tree-compiler && \
+    apt-get autoremove -y && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
+
+# Build U-Boot and TF-A
+RUN curl -fsSLO https://ftp.denx.de/pub/u-boot/u-boot-"$UBOOT_VERSION".tar.bz2 && \
+    tar xvf u-boot-"$UBOOT_VERSION".tar.bz2 && \
+    cd u-boot-"$UBOOT_VERSION" && \
+    make -j$(nproc) V=1 vexpress_fvp_defconfig && \
+    make -j$(nproc) V=1 all && \
+    cd .. && \
+    git clone --branch "$TFA_VERSION" --depth 1 https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git && \
+    cd trusted-firmware-a && \
+    curl -fsSLO https://git.yoctoproject.org/meta-arm/plain/meta-arm-bsp/recipes-bsp/trusted-firmware-a/files/fvp-base/0001-fdts-fvp-base-Add-stdout-path-and-virtio-net-and-rng.patch \
+         --output 0001-fdts-fvp-base-Add-stdout-path-and-virtio-net-and-rng.patch && \
+    git config --global user.email "[email protected]" && \
+    git config --global user.name "Your Name" && \
+    git am 0001-fdts-fvp-base-Add-stdout-path-and-virtio-net-and-rng.patch && \
+    make -j$(nproc) DEBUG=1 PLAT=fvp ARCH=aarch64 FVP_DT_PREFIX=fvp-base-gicv3-psci-1t all && \
+    make -j$(nproc) DEBUG=1 PLAT=fvp ARCH=aarch64 FVP_DT_PREFIX=fvp-base-gicv3-psci-1t fip BL33=../u-boot-"$UBOOT_VERSION"/u-boot.bin && \
+    cp build/fvp/debug/bl1.bin / && \
+    cp build/fvp/debug/fip.bin / && \
+    cp build/fvp/debug/fdts/fvp-base-gicv3-psci-1t.dtb / && \
+    cd /build && \
+    rm -rf u-boot-"$UBOOT_VERSION" trusted-firmware-a
Signature · 1 line
2.25.1
Reviewed-by on v1 2/5
#5 lore raw

Re: [PATCH 2/5] automation: Add the Dockerfile to build TF-A and U-Boot for FVP

Quoted 19 lines · Henry Wang

Unlike the emulators that currently being used in the CI pipelines, the FVP must start at EL3. Therefore we need the firmware, i.e. the TrustedFirmware-A (TF-A), for corresponding functionality.

There is a dedicated board (vexpress_fvp) in U-Boot (serve as the BL33 of the TF-A) for the FVP platform, so the U-Boot should also be compiled for the FVP platform instead of reusing the U-Boot for the existing emulators used in the CI pipelines.

To avoid compiling TF-A and U-Boot everytime in the job, adding a Dockerfile to the test artifacts to build TF-A v2.9.0 and U-Boot v2023.10 for FVP. The binaries for the TF-A and U-Boot, as well as the device tree for the FVP platform, will be saved (and exported by the CI job introduced by following commits). Note that, a patch for the TF-A will be applied before building to enable the virtio-net and the virtio-rng device on the FVP. The virtio-net device will provide the networking service for FVP, and the virtio-rng device will improve the speed of the FVP.

Quoted 1 line
Quoted 62 lines
---
 .../2023.10-2.9.0-arm64v8.dockerfile          | 48 +++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 automation/tests-artifacts/armfvp-uboot-tfa/2023.10-2.9.0-arm64v8.dockerfile
automation/tests-artifacts/armfvp-uboot-tfa/2023.10-2.9.0-arm64v8.dockerfile new file +48 -0
new file mode 100644
index 0000000000..6566b60545
@@ -0,0 +1,48 @@
+FROM --platform=linux/arm64/v8 debian:bookworm
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="[email protected]"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV UBOOT_VERSION="2023.10"
+ENV TFA_VERSION="v2.9.0"
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        libssl-dev \
+        bc \
+        curl \
+        flex \
+        bison \
+        git \
+        device-tree-compiler && \
+    apt-get autoremove -y && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
+
+# Build U-Boot and TF-A
+RUN curl -fsSLO https://ftp.denx.de/pub/u-boot/u-boot-"$UBOOT_VERSION".tar.bz2 && \
+    tar xvf u-boot-"$UBOOT_VERSION".tar.bz2 && \
+    cd u-boot-"$UBOOT_VERSION" && \
+    make -j$(nproc) V=1 vexpress_fvp_defconfig && \
+    make -j$(nproc) V=1 all && \
+    cd .. && \
+    git clone --branch "$TFA_VERSION" --depth 1 https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git && \
+    cd trusted-firmware-a && \
+    curl -fsSLO https://git.yoctoproject.org/meta-arm/plain/meta-arm-bsp/recipes-bsp/trusted-firmware-a/files/fvp-base/0001-fdts-fvp-base-Add-stdout-path-and-virtio-net-and-rng.patch \
+         --output 0001-fdts-fvp-base-Add-stdout-path-and-virtio-net-and-rng.patch && \
+    git config --global user.email "[email protected]" && \
+    git config --global user.name "Your Name" && \
+    git am 0001-fdts-fvp-base-Add-stdout-path-and-virtio-net-and-rng.patch && \
+    make -j$(nproc) DEBUG=1 PLAT=fvp ARCH=aarch64 FVP_DT_PREFIX=fvp-base-gicv3-psci-1t all && \
+    make -j$(nproc) DEBUG=1 PLAT=fvp ARCH=aarch64 FVP_DT_PREFIX=fvp-base-gicv3-psci-1t fip BL33=../u-boot-"$UBOOT_VERSION"/u-boot.bin && \
+    cp build/fvp/debug/bl1.bin / && \
+    cp build/fvp/debug/fip.bin / && \
+    cp build/fvp/debug/fdts/fvp-base-gicv3-psci-1t.dtb / && \
+    cd /build && \
+    rm -rf u-boot-"$UBOOT_VERSION" trusted-firmware-a
Signature · 1 line
2.25.1
author
#6 lore raw

PATCH 3/5 automation: Add the expect script with test case for FVP

In reply to Henry Wang

To interact with the FVP (for example entering the U-Boot shell and transferring the files by TFTP), we need to connect the corresponding port by the telnet first. Use an expect script to simplify the automation of the whole "interacting with FVP" stuff.

The expect script will firstly detect the IP of the host, then connect to the telnet port of the FVP, set the serverip and ipaddr for the TFTP service in the U-Boot shell, and finally boot Xen from U-Boot and wait for the expected results by Xen, Dom0 and DomU.

---
 .../expect/fvp-base-smoke-dom0-arm64.exp      | 73 +++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100755 automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp
automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp new file +73 -0
new file mode 100755
index 0000000000..25d9a5f81c
@@ -0,0 +1,73 @@
+#!/usr/bin/expect
+
+set timeout 2000
+
+# Command to use to run must be given as first argument
+# if options are required, quotes must be used:
+# xxx.exp "cmd opt1 opt2"
+set runcmd [lindex $argv 0]
+
+# Maximum number of line to be printed, this can be used to prevent runs to
+# go forever on errors when Xen is rebooting
+set maxline 1000
+
+# Configure slow parameters used with send -s
+# This allows us to slow down console writes to prevent issues with slow
+# emulators or targets.
+# Format here is: {NUM TIME} which reads as wait TIME seconds each NUM of
+# characters, here we send 1 char each 100ms
+set send_slow {1 .1}
+
+proc test_boot {{maxline} {host_ip}} {
+    expect_after {
+        -re "(.*)\r" {
+            if {$maxline != 0} {
+                set maxline [expr {$maxline - 1}]
+                if {$maxline <= 0} {
+                    send_user "ERROR-Toomuch!\n"
+                    exit 2
+                }
+            }
+            exp_continue
+        }
+        timeout {send_user "ERROR-Timeout!\n"; exit 3}
+        eof {send_user "ERROR-EOF!\n"; exit 4}
+    }
+
+    # Extract the telnet port numbers from FVP output, because the telnet ports
+    # are not guaranteed to be fixed numbers.
+    expect -re {terminal_0: Listening for serial connection on port [0-9]+}
+    set terminal_0 $expect_out(0,string)
+    if {[regexp {port (\d+)} $terminal_0 match port_0]} {
+        puts "terminal_0 port is $port_0"
+    } else {
+        puts "terminal_0 port not found"
+        exit 5
+    }
+
+    spawn bash -c "telnet localhost $port_0"
+    expect -re "Hit any key to stop autoboot.*"
+    send -s "  \r"
+    send -s "setenv serverip $host_ip; setenv ipaddr $host_ip; tftpb 0x80200000 boot.scr; source 0x80200000\r"
+
+    # Initial Xen boot
+    expect -re "\(XEN\).*Freed .* init memory."
+
+    # Dom0 and DomU
+    expect -re "Domain-0.*"
+    expect -re "BusyBox.*"
+    expect -re "/ #.*"
+}
+
+# Get host IP
+spawn bash -c "hostname -I | awk '{print \$1}'"
+expect -re {(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})}
+set host_ip $expect_out(0,string)
+
+# Start the FVP and run the test
+spawn bash -c "$runcmd"
+
+test_boot 2000 "$host_ip"
+
+send_user "\nExecution with SUCCESS\n"
+exit 0
Signature · 1 line
2.25.1
#7 lore raw

Re: [PATCH 3/5] automation: Add the expect script with test case for FVP

Quoted 9 lines · Henry Wang

To interact with the FVP (for example entering the U-Boot shell and transferring the files by TFTP), we need to connect the corresponding port by the telnet first. Use an expect script to simplify the automation of the whole "interacting with FVP" stuff.

The expect script will firstly detect the IP of the host, then connect to the telnet port of the FVP, set the serverip and ipaddr for the TFTP service in the U-Boot shell, and finally boot Xen from U-Boot and wait for the expected results by Xen, Dom0 and DomU.

I am not an expert in "expect" but this script looks great

Quoted 37 lines
---
 .../expect/fvp-base-smoke-dom0-arm64.exp      | 73 +++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100755 automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp
automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp new file +25 -0
new file mode 100755
index 0000000000..25d9a5f81c
@@ -0,0 +1,73 @@
+#!/usr/bin/expect
+
+set timeout 2000
+
+# Command to use to run must be given as first argument
+# if options are required, quotes must be used:
+# xxx.exp "cmd opt1 opt2"
+set runcmd [lindex $argv 0]
+
+# Maximum number of line to be printed, this can be used to prevent runs to
+# go forever on errors when Xen is rebooting
+set maxline 1000
+
+# Configure slow parameters used with send -s
+# This allows us to slow down console writes to prevent issues with slow
+# emulators or targets.
+# Format here is: {NUM TIME} which reads as wait TIME seconds each NUM of
+# characters, here we send 1 char each 100ms
+set send_slow {1 .1}
+
+proc test_boot {{maxline} {host_ip}} {
+    expect_after {
+        -re "(.*)\r" {
+            if {$maxline != 0} {
+                set maxline [expr {$maxline - 1}]

automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp line 35

Quoted 10 lines
automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp new file +10 -0
+                if {$maxline <= 0} {
+                    send_user "ERROR-Toomuch!\n"
+                    exit 2
+                }
+            }
+            exp_continue
+        }
+        timeout {send_user "ERROR-Timeout!\n"; exit 3}
+        eof {send_user "ERROR-EOF!\n"; exit 4}
+    }

Why do we need this "expect_after" ?

Quoted 13 lines
automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp new file +13 -0
+    # Extract the telnet port numbers from FVP output, because the telnet ports
+    # are not guaranteed to be fixed numbers.
+    expect -re {terminal_0: Listening for serial connection on port [0-9]+}
+    set terminal_0 $expect_out(0,string)
+    if {[regexp {port (\d+)} $terminal_0 match port_0]} {
+        puts "terminal_0 port is $port_0"
+    } else {
+        puts "terminal_0 port not found"
+        exit 5
+    }
+
+    spawn bash -c "telnet localhost $port_0"
+    expect -re "Hit any key to stop autoboot.*"

automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp line 59

Quoted 10 lines
automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp new file +10 -0
+    send -s "  \r"
+    send -s "setenv serverip $host_ip; setenv ipaddr $host_ip; tftpb 0x80200000 boot.scr; source 0x80200000\r"
+
+    # Initial Xen boot
+    expect -re "\(XEN\).*Freed .* init memory."
+
+    # Dom0 and DomU
+    expect -re "Domain-0.*"
+    expect -re "BusyBox.*"
+    expect -re "/ #.*"

This is clear, excellent

automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp line 64

Quoted 5 lines
automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp new file +5 -0
+}
+
+# Get host IP
+spawn bash -c "hostname -I | awk '{print \$1}'"
+expect -re {(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})}

Why d{1,3}?

automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp line 72

Quoted 8 lines
automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp new file +8 -0
+set host_ip $expect_out(0,string)
+
+# Start the FVP and run the test
+spawn bash -c "$runcmd"
+
+test_boot 2000 "$host_ip"
+
+send_user "\nExecution with SUCCESS\n"

Won't this always return SUCCESS even in case of failure?

Quoted 4 lines
automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp new file +1 -0
+exit 0
Signature · 1 line
2.25.1
author
#8 lore raw

Re: [PATCH 3/5] automation: Add the expect script with test case for FVP

Hi Stefano,

Quoted 8 lines · Stefano Stabellini
Quoted 5 lines · Henry Wang

To interact with the FVP (for example entering the U-Boot shell and transferring the files by TFTP), we need to connect the corresponding port by the telnet first. Use an expect script to simplify the automation of the whole "interacting with FVP" stuff.

Quoted 6 lines
Quoted 4 lines

The expect script will firstly detect the IP of the host, then connect to the telnet port of the FVP, set the serverip and ipaddr for the TFTP service in the U-Boot shell, and finally boot Xen from U-Boot and wait for the expected results by Xen, Dom0 and DomU.

I am not an expert in "expect" but this script looks great

:)

Quoted 18 lines
Quoted 18 lines

---
.../expect/fvp-base-smoke-dom0-arm64.exp | 73 +++++++++++++++++++

1 file changed, 73 insertions(+)

create mode 100755 automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp

automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp new file +10 -0
+
+proc test_boot {{maxline} {host_ip}} {
+    expect_after {
+        -re "(.*)\r" {
+            if {$maxline != 0} {
+                set maxline [expr {$maxline - 1}]
+                if {$maxline <= 0} {
+                    send_user "ERROR-Toomuch!\n"
+                    exit 2
+                }
Quoted 8 lines

automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp line 35

Quoted 6 lines
automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp new file +6 -0
+            }
+            exp_continue
+        }
+        timeout {send_user "ERROR-Timeout!\n"; exit 3}
+        eof {send_user "ERROR-EOF!\n"; exit 4}
+    }

Why do we need this "expect_after" ?

It is basically for the error handling. Either there is too many characters triggered by some misconfiguration of Xen/Kernel leading to Xen/Kernel constantly reboots, or the code stuck somehow, we have a way to stop the script instead of waiting in the infinity loop.

Quoted 26 lines
Quoted 13 lines
automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp new file +13 -0
+    # Extract the telnet port numbers from FVP output, because the telnet ports
+    # are not guaranteed to be fixed numbers.
+    expect -re {terminal_0: Listening for serial connection on port [0-9]+}
+    set terminal_0 $expect_out(0,string)
+    if {[regexp {port (\d+)} $terminal_0 match port_0]} {
+        puts "terminal_0 port is $port_0"
+    } else {
+        puts "terminal_0 port not found"
+        exit 5
+    }
+
+    spawn bash -c "telnet localhost $port_0"
+    expect -re "Hit any key to stop autoboot.*"

automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp line 59

Quoted 10 lines
automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp new file +10 -0
+    send -s "  \r"
+    send -s "setenv serverip $host_ip; setenv ipaddr $host_ip; tftpb 0x80200000 boot.scr; source 0x80200000\r"
+
+    # Initial Xen boot
+    expect -re "\(XEN\).*Freed .* init memory."
+
+    # Dom0 and DomU
+    expect -re "Domain-0.*"
+    expect -re "BusyBox.*"
+    expect -re "/ #.*"

This is clear, excellent

Quoted 7 lines

automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp line 64

Quoted 5 lines
automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp new file +5 -0
+}
+
+# Get host IP
+spawn bash -c "hostname -I | awk '{print \$1}'"
+expect -re {(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})}

Why d{1,3}?

I think that is because the IP pattern, we at least have one digit and at most 3.

Quoted 10 lines

automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp line 72

Quoted 8 lines
automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp new file +8 -0
+set host_ip $expect_out(0,string)
+
+# Start the FVP and run the test
+spawn bash -c "$runcmd"
+
+test_boot 2000 "$host_ip"
+
+send_user "\nExecution with SUCCESS\n"

Won't this always return SUCCESS even in case of failure?

IMHO, if things fails, we have various exit code (1-5) for each failure case. For example, if the FVP port somehow cannot be found, we exit with error code 5. This will basically lead us to the only case where the failure is caused by the script fails to wait for the expected string/regexp, and this case we have the timeout failure triggered by my above-mentioned expect_after block.

Kind regards,
Henry

Quoted 4 lines
Quoted 4 lines

+exit 0

Signature · 1 line
2.25.1
author
#9 lore raw

Re: [PATCH 3/5] automation: Add the expect script with test case for FVP

Hi Stefano,

Quoted 16 lines · Henry Wang

Hi Stefano,

Quoted 11 lines · Stefano Stabellini

automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp line 72

Quoted 8 lines
automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp new file +8 -0
+set host_ip $expect_out(0,string)
+
+# Start the FVP and run the test
+spawn bash -c "$runcmd"
+
+test_boot 2000 "$host_ip"
+
+send_user "\nExecution with SUCCESS\n"

Won't this always return SUCCESS even in case of failure?

Quoted 5 lines

IMHO, if things fails, we have various exit code (1-5) for each failure case. For example, if the FVP port somehow cannot be found, we exit with error code 5. This will basically lead us to the only case where the failure is caused by the script fails to wait for the expected string/regexp, and this case we have the timeout failure triggered by my above-mentioned expect_after block.

I did a test to see if I break the expect script by adding below hunk:

```
--- a/automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp
+++ b/automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp
@@ -51,6 +51,7 @@ proc test_boot {{maxline} {host_ip}} {
     send -s "setenv serverip $host_ip; setenv ipaddr $host_ip; tftpb 0x80200000 boot.scr; source 0x80200000\r"

     # Initial Xen boot
+    expect -re "this is a hack to break the build"
     expect -re "\(XEN\).*Freed .* init memory."

     # Dom0 and DomU
```

The timeout did happen in the expect script after the set timeout, see [1]

However the job still passes, and I believe this is caused by the shell script:

```
./automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp \
    "/FVP/FVP_Base_RevC-2xAEMvA/Base_RevC_AEMvA_pkg/models/Linux64_armv8l_GCC-9.3/FVP_Base_RevC-2xAEMvA \
    -C bp.vis.disable_visualisation=1 \
    -C bp.ve_sysregs.exit_on_shutdown=1 \
    -C bp.secure_memory=0 \
    -C cache_state_modelled=0 \
    -C cluster0.has_arm_v8-4=1 \
    -C cluster1.has_arm_v8-4=1 \
    ${TERM0_CFG} ${TERM1_CFG} ${TERM2_CFG} ${TERM3_CFG} \
    ${VIRTIO_USER_NETWORK_CFG} \
    -C bp.secureflashloader.fname=$(pwd)/binaries/bl1.bin \
    -C bp.flashloader0.fname=$(pwd)/binaries/fip.bin" |& \
        tee smoke.serial

exit 0
```

The “|& tee smoke.serial” hides the error propagated by the expect script. I will send a v2 to fix it.

[1] https://gitlab.com/xen-project/people/henryw/xen/-/jobs/5708263782/artifacts/file/smoke.serial

Kind regards,
Henry

Quoted 9 lines

Kind regards,
Henry

Quoted 4 lines
Quoted 4 lines

+exit 0

Signature · 1 line
2.25.1
author
#10 lore raw

PATCH 4/5 automation: Add the script for the FVP smoke test

In reply to Henry Wang

This commit adds the shell script for the FVP smoke test. Similarly as the QEMU jobs, the shell script will firstly prepare the DomU BusyBox image, use the ImageBuilder to arrange the binaries in memory and generate the U-Boot script, then start the test. To provide the TFTP service for the FVP, the shell script will also start the TFTP service, and copy the binaries needed by test to the TFTP directory used by the TFTP server.

---
 .../scripts/fvp-base-smoke-dom0-arm64.sh      | 117 ++++++++++++++++++
 1 file changed, 117 insertions(+)
 create mode 100755 automation/scripts/fvp-base-smoke-dom0-arm64.sh
automation/scripts/fvp-base-smoke-dom0-arm64.sh new file +117 -0
new file mode 100755
index 0000000000..716a63b0a8
@@ -0,0 +1,117 @@
+#!/bin/bash
+
+set -ex
+
+# DomU Busybox
+cd binaries
+mkdir -p initrd
+mkdir -p initrd/bin
+mkdir -p initrd/sbin
+mkdir -p initrd/etc
+mkdir -p initrd/dev
+mkdir -p initrd/proc
+mkdir -p initrd/sys
+mkdir -p initrd/lib
+mkdir -p initrd/var
+mkdir -p initrd/mnt
+cp /bin/busybox initrd/bin/busybox
+initrd/bin/busybox --install initrd/bin
+echo "#!/bin/sh
+
+mount -t proc proc /proc
+mount -t sysfs sysfs /sys
+mount -t devtmpfs devtmpfs /dev
+/bin/sh" > initrd/init
+chmod +x initrd/init
+cd initrd
+find . | cpio --create --format='newc' | gzip > ../initrd.cpio.gz
+cd ..
+
+mkdir -p rootfs
+cd rootfs
+tar xvzf ../initrd.tar.gz
+mkdir proc
+mkdir run
+mkdir srv
+mkdir sys
+rm var/run
+cp -ar ../dist/install/* .
+mv ../initrd.cpio.gz ./root
+cp ../Image ./root
+echo "name=\"test\"
+memory=512
+vcpus=1
+kernel=\"/root/Image\"
+ramdisk=\"/root/initrd.cpio.gz\"
+extra=\"console=hvc0 root=/dev/ram0 rdinit=/bin/sh\"
+" > root/test.cfg
+echo "#!/bin/bash
+
+export LD_LIBRARY_PATH=/usr/local/lib
+bash /etc/init.d/xencommons start
+
+xl list
+
+xl create -c /root/test.cfg
+
+" > etc/local.d/xen.start
+chmod +x etc/local.d/xen.start
+echo "rc_verbose=yes" >> etc/rc.conf
+find . |cpio -H newc -o|gzip > ../xen-rootfs.cpio.gz
+cd ../..
+
+# Start a TFTP server to provide TFTP service to FVP
+service tftpd-hpa start
+
+# ImageBuilder
+echo 'MEMORY_START="0x80000000"
+MEMORY_END="0xFF000000"
+
+DEVICE_TREE="fvp-base-gicv3-psci-1t.dtb"
+XEN="xen"
+DOM0_KERNEL="Image"
+DOM0_RAMDISK="xen-rootfs.cpio.gz"
+XEN_CMD="console=dtuart dom0_mem=1024M console_timestamps=boot"
+
+NUM_DOMUS=0
+
+LOAD_CMD="tftpb"
+UBOOT_SOURCE="boot.source"
+UBOOT_SCRIPT="boot.scr"' > binaries/config
+rm -rf imagebuilder
+git clone https://gitlab.com/ViryaOS/imagebuilder
+bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/config
+
+# Copy files to the TFTP directory to use
+cp ./binaries/boot.scr /srv/tftp/
+cp ./binaries/Image /srv/tftp/
+cp ./binaries/xen-rootfs.cpio.gz /srv/tftp/
+cp ./binaries/xen /srv/tftp/
+cp ./binaries/fvp-base-gicv3-psci-1t.dtb /srv/tftp/
+
+# Start FVP
+TERM0_CFG="-C bp.terminal_0.mode=telnet -C bp.terminal_0.start_telnet=0"
+TERM1_CFG="-C bp.terminal_1.mode=telnet -C bp.terminal_1.start_telnet=0"
+TERM2_CFG="-C bp.terminal_2.mode=telnet -C bp.terminal_2.start_telnet=0"
+TERM3_CFG="-C bp.terminal_3.mode=telnet -C bp.terminal_3.start_telnet=0"
+
+VIRTIO_USER_NETWORK_CFG="-C bp.virtio_net.enabled=1 \
+-C bp.virtio_net.hostbridge.userNetworking=1 \
+-C bp.virtio_net.hostbridge.userNetPorts=8022=22 \
+-C bp.virtio_net.transport=legacy"
+
+./automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp \
+    "/FVP/FVP_Base_RevC-2xAEMvA/Base_RevC_AEMvA_pkg/models/Linux64_armv8l_GCC-9.3/FVP_Base_RevC-2xAEMvA \
+    -C bp.vis.disable_visualisation=1 \
+    -C bp.ve_sysregs.exit_on_shutdown=1 \
+    -C bp.secure_memory=0 \
+    -C cache_state_modelled=0 \
+    -C cluster0.has_arm_v8-4=1 \
+    -C cluster1.has_arm_v8-4=1 \
+    ${TERM0_CFG} ${TERM1_CFG} ${TERM2_CFG} ${TERM3_CFG} \
+    ${VIRTIO_USER_NETWORK_CFG} \
+    -C bp.secureflashloader.fname=$(pwd)/binaries/bl1.bin \
+    -C bp.flashloader0.fname=$(pwd)/binaries/fip.bin" |& \
+        tee smoke.serial
+
+exit 0
Signature · 1 line
2.25.1
Reviewed-by on v1 4/5
#11 lore raw

Re: [PATCH 4/5] automation: Add the script for the FVP smoke test

Quoted 125 lines · Henry Wang

This commit adds the shell script for the FVP smoke test. Similarly as the QEMU jobs, the shell script will firstly prepare the DomU BusyBox image, use the ImageBuilder to arrange the binaries in memory and generate the U-Boot script, then start the test. To provide the TFTP service for the FVP, the shell script will also start the TFTP service, and copy the binaries needed by test to the TFTP directory used by the TFTP server.

---
 .../scripts/fvp-base-smoke-dom0-arm64.sh      | 117 ++++++++++++++++++
 1 file changed, 117 insertions(+)
 create mode 100755 automation/scripts/fvp-base-smoke-dom0-arm64.sh
automation/scripts/fvp-base-smoke-dom0-arm64.sh new file +105 -0
new file mode 100755
index 0000000000..716a63b0a8
@@ -0,0 +1,117 @@
+#!/bin/bash
+
+set -ex
+
+# DomU Busybox
+cd binaries
+mkdir -p initrd
+mkdir -p initrd/bin
+mkdir -p initrd/sbin
+mkdir -p initrd/etc
+mkdir -p initrd/dev
+mkdir -p initrd/proc
+mkdir -p initrd/sys
+mkdir -p initrd/lib
+mkdir -p initrd/var
+mkdir -p initrd/mnt
+cp /bin/busybox initrd/bin/busybox
+initrd/bin/busybox --install initrd/bin
+echo "#!/bin/sh
+
+mount -t proc proc /proc
+mount -t sysfs sysfs /sys
+mount -t devtmpfs devtmpfs /dev
+/bin/sh" > initrd/init
+chmod +x initrd/init
+cd initrd
+find . | cpio --create --format='newc' | gzip > ../initrd.cpio.gz
+cd ..
+
+mkdir -p rootfs
+cd rootfs
+tar xvzf ../initrd.tar.gz
+mkdir proc
+mkdir run
+mkdir srv
+mkdir sys
+rm var/run
+cp -ar ../dist/install/* .
+mv ../initrd.cpio.gz ./root
+cp ../Image ./root
+echo "name=\"test\"
+memory=512
+vcpus=1
+kernel=\"/root/Image\"
+ramdisk=\"/root/initrd.cpio.gz\"
+extra=\"console=hvc0 root=/dev/ram0 rdinit=/bin/sh\"
+" > root/test.cfg
+echo "#!/bin/bash
+
+export LD_LIBRARY_PATH=/usr/local/lib
+bash /etc/init.d/xencommons start
+
+xl list
+
+xl create -c /root/test.cfg
+
+" > etc/local.d/xen.start
+chmod +x etc/local.d/xen.start
+echo "rc_verbose=yes" >> etc/rc.conf
+find . |cpio -H newc -o|gzip > ../xen-rootfs.cpio.gz
+cd ../..
+
+# Start a TFTP server to provide TFTP service to FVP
+service tftpd-hpa start
+
+# ImageBuilder
+echo 'MEMORY_START="0x80000000"
+MEMORY_END="0xFF000000"
+
+DEVICE_TREE="fvp-base-gicv3-psci-1t.dtb"
+XEN="xen"
+DOM0_KERNEL="Image"
+DOM0_RAMDISK="xen-rootfs.cpio.gz"
+XEN_CMD="console=dtuart dom0_mem=1024M console_timestamps=boot"
+
+NUM_DOMUS=0
+
+LOAD_CMD="tftpb"
+UBOOT_SOURCE="boot.source"
+UBOOT_SCRIPT="boot.scr"' > binaries/config
+rm -rf imagebuilder
+git clone https://gitlab.com/ViryaOS/imagebuilder
+bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/config
+
+# Copy files to the TFTP directory to use
+cp ./binaries/boot.scr /srv/tftp/
+cp ./binaries/Image /srv/tftp/
+cp ./binaries/xen-rootfs.cpio.gz /srv/tftp/
+cp ./binaries/xen /srv/tftp/
+cp ./binaries/fvp-base-gicv3-psci-1t.dtb /srv/tftp/
+
+# Start FVP
+TERM0_CFG="-C bp.terminal_0.mode=telnet -C bp.terminal_0.start_telnet=0"
+TERM1_CFG="-C bp.terminal_1.mode=telnet -C bp.terminal_1.start_telnet=0"
+TERM2_CFG="-C bp.terminal_2.mode=telnet -C bp.terminal_2.start_telnet=0"
+TERM3_CFG="-C bp.terminal_3.mode=telnet -C bp.terminal_3.start_telnet=0"
+
+VIRTIO_USER_NETWORK_CFG="-C bp.virtio_net.enabled=1 \
+-C bp.virtio_net.hostbridge.userNetworking=1 \
+-C bp.virtio_net.hostbridge.userNetPorts=8022=22 \
+-C bp.virtio_net.transport=legacy"
+
+./automation/scripts/expect/fvp-base-smoke-dom0-arm64.exp \
+    "/FVP/FVP_Base_RevC-2xAEMvA/Base_RevC_AEMvA_pkg/models/Linux64_armv8l_GCC-9.3/FVP_Base_RevC-2xAEMvA \
+    -C bp.vis.disable_visualisation=1 \

automation/scripts/fvp-base-smoke-dom0-arm64.sh line 115

Quoted 10 lines
automation/scripts/fvp-base-smoke-dom0-arm64.sh new file +10 -0
+    -C bp.ve_sysregs.exit_on_shutdown=1 \
+    -C bp.secure_memory=0 \
+    -C cache_state_modelled=0 \
+    -C cluster0.has_arm_v8-4=1 \
+    -C cluster1.has_arm_v8-4=1 \
+    ${TERM0_CFG} ${TERM1_CFG} ${TERM2_CFG} ${TERM3_CFG} \
+    ${VIRTIO_USER_NETWORK_CFG} \
+    -C bp.secureflashloader.fname=$(pwd)/binaries/bl1.bin \
+    -C bp.flashloader0.fname=$(pwd)/binaries/fip.bin" |& \
+        tee smoke.serial

This script is clear and it is fine:

My only concern is that the expect checks on what booted (Xen, Dom0, DomU) are inside the script fvp-base-smoke-dom0-arm64.exp rather than in this script. So if in the future we are going to have multiple tests with different configurations (for instance see qemu-smoke-dom0less-arm64.sh) we'll have to find a way to reuse fvp-base-smoke-dom0-arm64.exp somehow.

author
#12 lore raw

Re: [PATCH 4/5] automation: Add the script for the FVP smoke test

Hi Stefano,

Quoted 17 lines · Stefano Stabellini
Quoted 8 lines · Henry Wang

This commit adds the shell script for the FVP smoke test. Similarly as the QEMU jobs, the shell script will firstly prepare the DomU BusyBox image, use the ImageBuilder to arrange the binaries in memory and generate the U-Boot script, then start the test. To provide the TFTP service for the FVP, the shell script will also start the TFTP service, and copy the binaries needed by test to the TFTP directory used by the TFTP server.

Quoted 5 lines

---
.../scripts/fvp-base-smoke-dom0-arm64.sh | 117 ++++++++++++++++++

1 file changed, 117 insertions(+)

create mode 100755 automation/scripts/fvp-base-smoke-dom0-arm64.sh

Quoted 3 lines

This script is clear and it is fine:

Thanks!

Quoted 7 lines

My only concern is that the expect checks on what booted (Xen, Dom0, DomU) are inside the script fvp-base-smoke-dom0-arm64.exp rather than in this script. So if in the future we are going to have multiple tests with different configurations (for instance see qemu-smoke-dom0less-arm64.sh) we'll have to find a way to reuse fvp-base-smoke-dom0-arm64.exp somehow.

We do have ways to reuse expect script, for example, we can extract the common code (variables and test logic) to the common.tcl file and source the common.tcl file in the expect script to reuse the code. The reason why I didn’t do that in this series is that currently there is only one script so I feel that there is not much benefit to do this instantly :) Let’s wait to see if there is more comments from others, and I am definitely open to refactor if there is the need to extract the common logic (for example when we add dom0less tests in the future).

Kind regards,
Henry

author
#13 lore raw

PATCH 5/5 automation: Add the arm64 FVP build and Dom0 smoke test jobs

In reply to Henry Wang

Add a job in the build stage to export the TF-A, U-Boot and the device tree for the FVP platform from the test artifact container.

Add a FVP smoke test job in the test stage to do the same test as the qemu-smoke-dom0-arm64-gcc job.

---
Although it does not affect the functionality, I am still quite confused about why the logs displayed by GitLab UI, for example [1], is much less than the actual output (saved in the artifacts, see [2]). Had a discussion with Michal on Matrix and we agree that the log in gitlab UI is usually capped.

[1] https://gitlab.com/xen-project/people/henryw/xen/-/jobs/5700569676
[2] https://gitlab.com/xen-project/people/henryw/xen/-/jobs/5700569676/artifacts/file/smoke.serial

---
 automation/gitlab-ci/build.yaml | 17 +++++++++++++++++
 automation/gitlab-ci/test.yaml  | 22 ++++++++++++++++++++++
 2 files changed, 39 insertions(+)
automation/gitlab-ci/build.yaml +17 -0
index 32af30cced..89d2f01302 100644
@@ -344,6 +344,23 @@ kernel-6.1.19-export:
   tags:
     - x86_64
 
+armfvp-uboot-tfa-2023.10-2.9.0-arm64-export:
+  extends: .test-jobs-artifact-common
+  image: registry.gitlab.com/xen-project/xen/tests-artifacts/armfvp-uboot-tfa:2023.10-2.9.0-arm64v8
+  script:
+    - |
+       mkdir binaries && \
+       cp /bl1.bin binaries/bl1.bin && \
+       cp /fip.bin binaries/fip.bin && \
+       cp /fvp-base-gicv3-psci-1t.dtb binaries/fvp-base-gicv3-psci-1t.dtb
+  artifacts:
+    paths:
+      - binaries/bl1.bin
+      - binaries/fip.bin
+      - binaries/fvp-base-gicv3-psci-1t.dtb
+  tags:
+    - arm64
+
 # Jobs below this line
 
 # Build jobs needed for tests
automation/gitlab-ci/test.yaml +22 -0
index 6aabdb9d15..47e00d0a0b 100644
@@ -96,6 +96,19 @@
   tags:
     - xilinx
 
+.fvp-arm64:
+  extends: .test-jobs-common
+  variables:
+    CONTAINER: debian:bookworm-arm64v8-fvp
+    LOGFILE: fvp-smoke-arm64.log
+  artifacts:
+    paths:
+      - smoke.serial
+      - '*.log'
+    when: always
+  tags:
+    - arm64
+
 .adl-x86-64:
   extends: .test-jobs-common
   variables:
@@ -459,3 +472,12 @@ qemu-smoke-ppc64le-powernv9-gcc:
   needs:
     - qemu-system-ppc64-8.1.0-ppc64-export
     - debian-bullseye-gcc-ppc64le-debug
+
+fvp-smoke-dom0-arm64-gcc-debug:
+  extends: .fvp-arm64
+  script:
+    - ./automation/scripts/fvp-base-smoke-dom0-arm64.sh 2>&1 | tee ${LOGFILE}
+  needs:
+    - *arm64-test-needs
+    - armfvp-uboot-tfa-2023.10-2.9.0-arm64-export
+    - alpine-3.18-gcc-debug-arm64
Signature · 1 line
2.25.1
Reviewed-by on v1 5/5
#14 lore raw

Re: [PATCH 5/5] automation: Add the arm64 FVP build and Dom0 smoke test jobs

Quoted 7 lines · Henry Wang

Add a job in the build stage to export the TF-A, U-Boot and the device tree for the FVP platform from the test artifact container.

Add a FVP smoke test job in the test stage to do the same test as the qemu-smoke-dom0-arm64-gcc job.

Quoted 82 lines

---
Although it does not affect the functionality, I am still quite confused about why the logs displayed by GitLab UI, for example [1], is much less than the actual output (saved in the artifacts, see [2]). Had a discussion with Michal on Matrix and we agree that the log in gitlab UI is usually capped.

[1] https://gitlab.com/xen-project/people/henryw/xen/-/jobs/5700569676
[2] https://gitlab.com/xen-project/people/henryw/xen/-/jobs/5700569676/artifacts/file/smoke.serial

---
 automation/gitlab-ci/build.yaml | 17 +++++++++++++++++
 automation/gitlab-ci/test.yaml  | 22 ++++++++++++++++++++++
 2 files changed, 39 insertions(+)
automation/gitlab-ci/build.yaml +17 -0
index 32af30cced..89d2f01302 100644
@@ -344,6 +344,23 @@ kernel-6.1.19-export:
   tags:
     - x86_64
 
+armfvp-uboot-tfa-2023.10-2.9.0-arm64-export:
+  extends: .test-jobs-artifact-common
+  image: registry.gitlab.com/xen-project/xen/tests-artifacts/armfvp-uboot-tfa:2023.10-2.9.0-arm64v8
+  script:
+    - |
+       mkdir binaries && \
+       cp /bl1.bin binaries/bl1.bin && \
+       cp /fip.bin binaries/fip.bin && \
+       cp /fvp-base-gicv3-psci-1t.dtb binaries/fvp-base-gicv3-psci-1t.dtb
+  artifacts:
+    paths:
+      - binaries/bl1.bin
+      - binaries/fip.bin
+      - binaries/fvp-base-gicv3-psci-1t.dtb
+  tags:
+    - arm64
+
 # Jobs below this line
 
 # Build jobs needed for tests
automation/gitlab-ci/test.yaml +22 -0
index 6aabdb9d15..47e00d0a0b 100644
@@ -96,6 +96,19 @@
   tags:
     - xilinx
 
+.fvp-arm64:
+  extends: .test-jobs-common
+  variables:
+    CONTAINER: debian:bookworm-arm64v8-fvp
+    LOGFILE: fvp-smoke-arm64.log
+  artifacts:
+    paths:
+      - smoke.serial
+      - '*.log'
+    when: always
+  tags:
+    - arm64
+
 .adl-x86-64:
   extends: .test-jobs-common
   variables:
@@ -459,3 +472,12 @@ qemu-smoke-ppc64le-powernv9-gcc:
   needs:
     - qemu-system-ppc64-8.1.0-ppc64-export
     - debian-bullseye-gcc-ppc64le-debug
+
+fvp-smoke-dom0-arm64-gcc-debug:
+  extends: .fvp-arm64
+  script:
+    - ./automation/scripts/fvp-base-smoke-dom0-arm64.sh 2>&1 | tee ${LOGFILE}
+  needs:
+    - *arm64-test-needs
+    - armfvp-uboot-tfa-2023.10-2.9.0-arm64-export
+    - alpine-3.18-gcc-debug-arm64
Signature · 1 line
2.25.1