Skip to contentSkip to conversation

automation: preserve built xen.efi

PATCH Superseded Marek Marczykowski-Górecki 3 participants 14 messages Oct 2, 2024 – Oct 3, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 automation: preserve built xen.efi

It will be useful for further tests.

---
 automation/scripts/build | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
automation/scripts/build +6 -1
index b3c71fb6fb60..4cd41cb2c471 100755
@@ -47,6 +47,7 @@ if [[ "${CPPCHECK}" == "y" ]] && [[ "${HYPERVISOR_ONLY}" == "y" ]]; then
 
     # Preserve artefacts
     cp xen/xen binaries/xen
+    if [[ -f xen/xen.efi ]]; then cp xen/xen.efi binaries/xen.efi; fi
     cp xen/cppcheck-report/xen-cppcheck.txt xen-cppcheck.txt
 elif [[ "${HYPERVISOR_ONLY}" == "y" ]]; then
     # Xen-only build
@@ -54,6 +55,7 @@ elif [[ "${HYPERVISOR_ONLY}" == "y" ]]; then
 
     # Preserve artefacts
     cp xen/xen binaries/xen
+    if [[ -f xen/xen.efi ]]; then cp xen/xen.efi binaries/xen.efi; fi
 else
     # Full build.  Figure out our ./configure options
     cfgargs=()
@@ -101,5 +103,8 @@ else
     # even though dist/ contains everything, while some containers don't even
     # build Xen
     cp -r dist binaries/
-    if [[ -f xen/xen ]] ; then cp xen/xen binaries/xen; fi
+    if [[ -f xen/xen ]] ; then
+        cp xen/xen binaries/xen
+        if [[ -f xen/xen.efi ]]; then cp xen/xen.efi binaries/xen.efi; fi
+    fi
 fi
Signature · 1 line
2.46.0
#1 lore raw

PATCH 2/2 automation: add a smoke test for xen.efi on X86

Check if xen.efi is bootable with an XTF dom0.

The TEST_TIMEOUT is set in the script to override project-global value. Setting it in the gitlab yaml file doesn't work, as it's too low priority
(https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence).

The multiboot2+EFI path is tested on hardware tests already.

---
This requires rebuilding debian:bookworm container.

The TEST_TIMEOUT issue mentioned above applies to xilix-* jobs too. It's not clear to me why the default TEST_TIMEOUT is set at the group level instead of in the yaml file, so I'm not adjusting the other places.

---
 automation/build/debian/bookworm.dockerfile |  1 +
 automation/gitlab-ci/test.yaml              |  7 ++++
 automation/scripts/qemu-smoke-x86-64-efi.sh | 44 +++++++++++++++++++++
 3 files changed, 52 insertions(+)
 create mode 100755 automation/scripts/qemu-smoke-x86-64-efi.sh
automation/build/debian/bookworm.dockerfile +1 -0
index 3dd70cb6b2e3..061114ba522d 100644
@@ -46,6 +46,7 @@ RUN apt-get update && \
         # for test phase, qemu-smoke-* jobs
         qemu-system-x86 \
         expect \
+        ovmf \
         # for test phase, qemu-alpine-* jobs
         cpio \
         busybox-static \
automation/gitlab-ci/test.yaml +7 -0
index 8675016b6a37..74fd3f3109ae 100644
@@ -463,6 +463,13 @@ qemu-smoke-x86-64-clang-pvh:
   needs:
     - debian-bookworm-clang-debug
 
+qemu-smoke-x86-64-gcc-efi:
+  extends: .qemu-x86-64
+  script:
+    - ./automation/scripts/qemu-smoke-x86-64-efi.sh pv 2>&1 | tee ${LOGFILE}
+  needs:
+    - debian-bookworm-gcc-debug
+
 qemu-smoke-riscv64-gcc:
   extends: .qemu-riscv64
   script:
automation/scripts/qemu-smoke-x86-64-efi.sh new file +44 -0

44 lines not on this page · raw message

Signature · 1 line
2.46.0
#2 lore raw

Re: [PATCH 2/2] automation: add a smoke test for xen.efi on X86

Quoted 7 lines · Marek Marczykowski-Górecki

Check if xen.efi is bootable with an XTF dom0.

The TEST_TIMEOUT is set in the script to override project-global value. Setting it in the gitlab yaml file doesn't work, as it's too low priority
(https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence).

Quoted 5 lines

The multiboot2+EFI path is tested on hardware tests already.

---
This requires rebuilding debian:bookworm container.

Noted.

Quoted 4 lines

The TEST_TIMEOUT issue mentioned above applies to xilix-* jobs too. It's not clear to me why the default TEST_TIMEOUT is set at the group level instead of in the yaml file, so I'm not adjusting the other places.

I'll leave that side of things to Stefano.

Quoted 12 lines
---
 automation/build/debian/bookworm.dockerfile |  1 +
 automation/gitlab-ci/test.yaml              |  7 ++++
 automation/scripts/qemu-smoke-x86-64-efi.sh | 44 +++++++++++++++++++++
 3 files changed, 52 insertions(+)
 create mode 100755 automation/scripts/qemu-smoke-x86-64-efi.sh
automation/build/debian/bookworm.dockerfile +0 -0
index 3dd70cb6b2e3..061114ba522d 100644

automation/build/debian/bookworm.dockerfile RUN apt-get update && \ · line 48

Quoted 3 lines
automation/build/debian/bookworm.dockerfile +0 -0
@@ -46,6 +46,7 @@ RUN apt-get update && \
         # for test phase, qemu-smoke-* jobs
         qemu-system-x86 \
         expect \
# for test phase efi jobs
Quoted 10 lines
automation/build/debian/bookworm.dockerfile +1 -0
+        ovmf \
         # for test phase, qemu-alpine-* jobs
         cpio \
         busybox-static \
automation/scripts/qemu-smoke-x86-64-efi.sh new file +0 -0
new file mode 100755
index 000000000000..e053cfa995ba

automation/scripts/qemu-smoke-x86-64-efi.sh line 10

Quoted 10 lines
automation/scripts/qemu-smoke-x86-64-efi.sh new file +10 -0
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+set -ex -o pipefail
+
+# variant should be either pv or pvh
+variant=$1
+
+# Clone and build XTF
+git clone https://xenbits.xen.org/git-http/xtf.git
+cd xtf && make -j$(nproc) && cd -

make -C xtf -j$(nproc)

I still haven't got XTF nicely working in Gitlab CI, but if my plans work out, we will be able to replace this with a job-level artefact import.

automation/scripts/qemu-smoke-x86-64-efi.sh line 19

Quoted 9 lines
automation/scripts/qemu-smoke-x86-64-efi.sh new file +9 -0
+
+case $variant in
+    pvh) k=test-hvm64-example    extra="dom0-iommu=none dom0=pvh" ;;
+    *)   k=test-pv64-example     extra= ;;
+esac
+
+mkdir -p boot-esp/EFI/BOOT
+cp binaries/xen.efi boot-esp/EFI/BOOT/BOOTX64.EFI
+cp xtf/tests/example/$k boot-esp/EFI/BOOT/kernel

Looking at this split, I'd suggest having

k=example/test-... in the case, and cp xtf/tests/$k boot-... here.

That way, it's easier to swap out e.g. k=selftest/test-pv64-selftest

automation/scripts/qemu-smoke-x86-64-efi.sh line 26

Quoted 7 lines
automation/scripts/qemu-smoke-x86-64-efi.sh new file +7 -0
+
+cat > boot-esp/EFI/BOOT/BOOTX64.cfg <<EOF
+[global]
+default=test
+
+[test]
+options=loglvl=all console=com1 noreboot console_timestamps=boot $extra

Bah - we still can't select the timestamp mode at Kconfig time, can we. Because that would have been helpful...

Something for the todo list.  Individual tests should not be needing to arrange this.

I think you can drop the loglvl=all.  That (and guest_loglvl, and CONFIG_VERBOSE which you depend on) is already arranged by virtue of using a debug Xen.  I don't think this is liable to change.

automation/scripts/qemu-smoke-x86-64-efi.sh line 36

Quoted 10 lines
automation/scripts/qemu-smoke-x86-64-efi.sh new file +10 -0
+kernel=kernel
+EOF
+
+cp /usr/share/OVMF/OVMF_CODE.fd OVMF_CODE.fd
+cp /usr/share/OVMF/OVMF_VARS.fd OVMF_VARS.fd
+
+rm -f smoke.serial
+export TEST_CMD="qemu-system-x86_64 -nographic -M q35,kernel-irqchip=split \
+        -drive if=pflash,format=raw,readonly=on,file=OVMF_CODE.fd \
+        -drive if=pflash,format=raw,file=OVMF_VARS.fd \

Why do you copy OVMF_*.fd out of /usr/share to the local dir, then pass them as paths here?

Can't qemu be pointed at /usr/share directly?

~Andrew

#3 lore raw

Re: [PATCH 2/2] automation: add a smoke test for xen.efi on X86

In reply to Marek Marczykowski-Górecki
Quoted 9 lines · Marek Marczykowski-Górecki

Check if xen.efi is bootable with an XTF dom0.

The TEST_TIMEOUT is set in the script to override project-global value. Setting it in the gitlab yaml file doesn't work, as it's too low priority
(https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence).

The multiboot2+EFI path is tested on hardware tests already.

Quoted 7 lines

---
This requires rebuilding debian:bookworm container.

The TEST_TIMEOUT issue mentioned above applies to xilix-* jobs too. It's not clear to me why the default TEST_TIMEOUT is set at the group level instead of in the yaml file, so I'm not adjusting the other places.

Let me premise that now that we use "expect" all successful tests will terminate as soon as the success condition is met, without waiting for the test timeout to expire.

There is a CI/CD variable called TEST_TIMEOUT set at the gitlab.com/xen-project level. (There is also a check in console.exp in case TEST_TIMEOUT is not set so that we don't run into problems in case the CI/CD variable is removed accidentally.) The global TEST_TIMEOUT is meant to be a high value to account for slow QEMU tests running potentially on our slowest cloud runners.

However, for hardware-based tests such as the xilinx-* jobs, we know that the timeout is supposed to be less than that. The test is running on real hardware which is considerably faster than QEMU running on our slowest runners. Basically, the timeout depends on the runner more than the test. So we override the TEST_TIMEOUT variable for the xilinx-* jobs providing a lower timeout value.

The global TEST_TIMEOUT is set to 1500.
The xilinx-* timeout is set to 120 for ARM and 1000 for x86.

You are welcome to override the TEST_TIMEOUT value for the hardware-based QubesOS tests. At the same time, given that on success the timeout is not really used, it is also OK to leave it like this.

Quoted 24 lines
---
 automation/build/debian/bookworm.dockerfile |  1 +
 automation/gitlab-ci/test.yaml              |  7 ++++
 automation/scripts/qemu-smoke-x86-64-efi.sh | 44 +++++++++++++++++++++
 3 files changed, 52 insertions(+)
 create mode 100755 automation/scripts/qemu-smoke-x86-64-efi.sh
automation/build/debian/bookworm.dockerfile +1 -0
index 3dd70cb6b2e3..061114ba522d 100644
@@ -46,6 +46,7 @@ RUN apt-get update && \
         # for test phase, qemu-smoke-* jobs
         qemu-system-x86 \
         expect \
+        ovmf \
         # for test phase, qemu-alpine-* jobs
         cpio \
         busybox-static \
automation/gitlab-ci/test.yaml +0 -0
index 8675016b6a37..74fd3f3109ae 100644

automation/gitlab-ci/test.yaml qemu-smoke-x86-64-clang-pvh: · line 471

Quoted 9 lines
automation/gitlab-ci/test.yaml +6 -0
@@ -463,6 +463,13 @@ qemu-smoke-x86-64-clang-pvh:
   needs:
     - debian-bookworm-clang-debug
 
+qemu-smoke-x86-64-gcc-efi:
+  extends: .qemu-x86-64
+  script:
+    - ./automation/scripts/qemu-smoke-x86-64-efi.sh pv 2>&1 | tee ${LOGFILE}
+  needs:
+    - debian-bookworm-gcc-debug

Given that the script you wrote (thank you!) can also handle pvh, can we directly add a pvh job to test.yaml too?

Quoted 56 lines
automation/gitlab-ci/test.yaml +0 -0
 qemu-smoke-riscv64-gcc:
   extends: .qemu-riscv64
   script:
automation/scripts/qemu-smoke-x86-64-efi.sh new file +44 -0
new file mode 100755
index 000000000000..e053cfa995ba
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+set -ex -o pipefail
+
+# variant should be either pv or pvh
+variant=$1
+
+# Clone and build XTF
+git clone https://xenbits.xen.org/git-http/xtf.git
+cd xtf && make -j$(nproc) && cd -
+
+case $variant in
+    pvh) k=test-hvm64-example    extra="dom0-iommu=none dom0=pvh" ;;
+    *)   k=test-pv64-example     extra= ;;
+esac
+
+mkdir -p boot-esp/EFI/BOOT
+cp binaries/xen.efi boot-esp/EFI/BOOT/BOOTX64.EFI
+cp xtf/tests/example/$k boot-esp/EFI/BOOT/kernel
+
+cat > boot-esp/EFI/BOOT/BOOTX64.cfg <<EOF
+[global]
+default=test
+
+[test]
+options=loglvl=all console=com1 noreboot console_timestamps=boot $extra
+kernel=kernel
+EOF
+
+cp /usr/share/OVMF/OVMF_CODE.fd OVMF_CODE.fd
+cp /usr/share/OVMF/OVMF_VARS.fd OVMF_VARS.fd
+
+rm -f smoke.serial
+export TEST_CMD="qemu-system-x86_64 -nographic -M q35,kernel-irqchip=split \
+        -drive if=pflash,format=raw,readonly=on,file=OVMF_CODE.fd \
+        -drive if=pflash,format=raw,file=OVMF_VARS.fd \
+        -drive file=fat:rw:boot-esp,media=disk,index=0,format=raw \
+        -m 512 -monitor none -serial stdio"
+
+export TEST_LOG="smoke.serial"
+export PASSED="Test result: SUCCESS"
+export TEST_TIMEOUT=120
+
+./automation/scripts/console.exp | sed 's/\r\+$//'
Signature · 1 line
2.46.0
#4 lore raw

Re: [PATCH 2/2] automation: add a smoke test for xen.efi on X86

I forgot to reply to one important part below

Quoted 125 lines · Stefano Stabellini
Quoted 9 lines · Marek Marczykowski-Górecki

Check if xen.efi is bootable with an XTF dom0.

The TEST_TIMEOUT is set in the script to override project-global value. Setting it in the gitlab yaml file doesn't work, as it's too low priority
(https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence).

The multiboot2+EFI path is tested on hardware tests already.

Quoted 7 lines

---
This requires rebuilding debian:bookworm container.

The TEST_TIMEOUT issue mentioned above applies to xilix-* jobs too. It's not clear to me why the default TEST_TIMEOUT is set at the group level instead of in the yaml file, so I'm not adjusting the other places.

Let me premise that now that we use "expect" all successful tests will terminate as soon as the success condition is met, without waiting for the test timeout to expire.

There is a CI/CD variable called TEST_TIMEOUT set at the gitlab.com/xen-project level. (There is also a check in console.exp in case TEST_TIMEOUT is not set so that we don't run into problems in case the CI/CD variable is removed accidentally.) The global TEST_TIMEOUT is meant to be a high value to account for slow QEMU tests running potentially on our slowest cloud runners.

However, for hardware-based tests such as the xilinx-* jobs, we know that the timeout is supposed to be less than that. The test is running on real hardware which is considerably faster than QEMU running on our slowest runners. Basically, the timeout depends on the runner more than the test. So we override the TEST_TIMEOUT variable for the xilinx-* jobs providing a lower timeout value.

The global TEST_TIMEOUT is set to 1500.
The xilinx-* timeout is set to 120 for ARM and 1000 for x86.

You are welcome to override the TEST_TIMEOUT value for the hardware-based QubesOS tests. At the same time, given that on success the timeout is not really used, it is also OK to leave it like this.

Quoted 24 lines
---
 automation/build/debian/bookworm.dockerfile |  1 +
 automation/gitlab-ci/test.yaml              |  7 ++++
 automation/scripts/qemu-smoke-x86-64-efi.sh | 44 +++++++++++++++++++++
 3 files changed, 52 insertions(+)
 create mode 100755 automation/scripts/qemu-smoke-x86-64-efi.sh
automation/build/debian/bookworm.dockerfile +1 -0
index 3dd70cb6b2e3..061114ba522d 100644
@@ -46,6 +46,7 @@ RUN apt-get update && \
         # for test phase, qemu-smoke-* jobs
         qemu-system-x86 \
         expect \
+        ovmf \
         # for test phase, qemu-alpine-* jobs
         cpio \
         busybox-static \
automation/gitlab-ci/test.yaml +0 -0
index 8675016b6a37..74fd3f3109ae 100644

automation/gitlab-ci/test.yaml qemu-smoke-x86-64-clang-pvh: · line 471

Quoted 9 lines
automation/gitlab-ci/test.yaml +6 -0
@@ -463,6 +463,13 @@ qemu-smoke-x86-64-clang-pvh:
   needs:
     - debian-bookworm-clang-debug
 
+qemu-smoke-x86-64-gcc-efi:
+  extends: .qemu-x86-64
+  script:
+    - ./automation/scripts/qemu-smoke-x86-64-efi.sh pv 2>&1 | tee ${LOGFILE}
+  needs:
+    - debian-bookworm-gcc-debug

Given that the script you wrote (thank you!) can also handle pvh, can we directly add a pvh job to test.yaml too?

Quoted 43 lines
automation/gitlab-ci/test.yaml +0 -0
 qemu-smoke-riscv64-gcc:
   extends: .qemu-riscv64
   script:
automation/scripts/qemu-smoke-x86-64-efi.sh new file +34 -0
new file mode 100755
index 000000000000..e053cfa995ba
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+set -ex -o pipefail
+
+# variant should be either pv or pvh
+variant=$1
+
+# Clone and build XTF
+git clone https://xenbits.xen.org/git-http/xtf.git
+cd xtf && make -j$(nproc) && cd -
+
+case $variant in
+    pvh) k=test-hvm64-example    extra="dom0-iommu=none dom0=pvh" ;;
+    *)   k=test-pv64-example     extra= ;;
+esac
+
+mkdir -p boot-esp/EFI/BOOT
+cp binaries/xen.efi boot-esp/EFI/BOOT/BOOTX64.EFI
+cp xtf/tests/example/$k boot-esp/EFI/BOOT/kernel
+
+cat > boot-esp/EFI/BOOT/BOOTX64.cfg <<EOF
+[global]
+default=test
+
+[test]
+options=loglvl=all console=com1 noreboot console_timestamps=boot $extra
+kernel=kernel
+EOF
+
+cp /usr/share/OVMF/OVMF_CODE.fd OVMF_CODE.fd
+cp /usr/share/OVMF/OVMF_VARS.fd OVMF_VARS.fd
+
+rm -f smoke.serial
+export TEST_CMD="qemu-system-x86_64 -nographic -M q35,kernel-irqchip=split \
Quoted 8 lines

automation/scripts/qemu-smoke-x86-64-efi.sh line 42

Quoted 8 lines
automation/scripts/qemu-smoke-x86-64-efi.sh new file +8 -0
+        -drive if=pflash,format=raw,readonly=on,file=OVMF_CODE.fd \
+        -drive if=pflash,format=raw,file=OVMF_VARS.fd \
+        -drive file=fat:rw:boot-esp,media=disk,index=0,format=raw \
+        -m 512 -monitor none -serial stdio"
+
+export TEST_LOG="smoke.serial"
+export PASSED="Test result: SUCCESS"
+export TEST_TIMEOUT=120

Although this works, I would prefer keeping the TEST_TIMEOUT overrides in test.yaml for consistency. However, it might be better not to override it (or to override to a higher timeout value), as successful tests will terminate immediately anyway. We need to be cautious about setting TEST_TIMEOUT values too low, as using a slow runner (like a small, busy cloud instance) can lead to false positive failures. This issue occurred frequently with ARM tests when we temporarily moved from a fast ARM server to slower ARM cloud instances a couple of months ago.

On the other hand, adjusting TEST_TIMEOUT for non-QEMU hardware-based tests is acceptable since those tests rely on real hardware availability, which is unlikely to become suddenly slower.

#5 lore raw

Re: [PATCH 2/2] automation: add a smoke test for xen.efi on X86

Quoted 84 lines · Stefano Stabellini

I forgot to reply to one important part below

Quoted 80 lines · Stefano Stabellini
Quoted 9 lines · Marek Marczykowski-Górecki

Check if xen.efi is bootable with an XTF dom0.

The TEST_TIMEOUT is set in the script to override project-global value. Setting it in the gitlab yaml file doesn't work, as it's too low priority
(https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence).

The multiboot2+EFI path is tested on hardware tests already.

Quoted 7 lines

---
This requires rebuilding debian:bookworm container.

The TEST_TIMEOUT issue mentioned above applies to xilix-* jobs too. It's not clear to me why the default TEST_TIMEOUT is set at the group level instead of in the yaml file, so I'm not adjusting the other places.

Let me premise that now that we use "expect" all successful tests will terminate as soon as the success condition is met, without waiting for the test timeout to expire.

There is a CI/CD variable called TEST_TIMEOUT set at the gitlab.com/xen-project level. (There is also a check in console.exp in case TEST_TIMEOUT is not set so that we don't run into problems in case the CI/CD variable is removed accidentally.) The global TEST_TIMEOUT is meant to be a high value to account for slow QEMU tests running potentially on our slowest cloud runners.

However, for hardware-based tests such as the xilinx-* jobs, we know that the timeout is supposed to be less than that. The test is running on real hardware which is considerably faster than QEMU running on our slowest runners. Basically, the timeout depends on the runner more than the test. So we override the TEST_TIMEOUT variable for the xilinx-* jobs providing a lower timeout value.

The global TEST_TIMEOUT is set to 1500.
The xilinx-* timeout is set to 120 for ARM and 1000 for x86.

You are welcome to override the TEST_TIMEOUT value for the hardware-based QubesOS tests. At the same time, given that on success the timeout is not really used, it is also OK to leave it like this.

Quoted 24 lines
---
 automation/build/debian/bookworm.dockerfile |  1 +
 automation/gitlab-ci/test.yaml              |  7 ++++
 automation/scripts/qemu-smoke-x86-64-efi.sh | 44 +++++++++++++++++++++
 3 files changed, 52 insertions(+)
 create mode 100755 automation/scripts/qemu-smoke-x86-64-efi.sh
automation/build/debian/bookworm.dockerfile +1 -0
index 3dd70cb6b2e3..061114ba522d 100644
@@ -46,6 +46,7 @@ RUN apt-get update && \
         # for test phase, qemu-smoke-* jobs
         qemu-system-x86 \
         expect \
+        ovmf \
         # for test phase, qemu-alpine-* jobs
         cpio \
         busybox-static \
automation/gitlab-ci/test.yaml +0 -0
index 8675016b6a37..74fd3f3109ae 100644

automation/gitlab-ci/test.yaml qemu-smoke-x86-64-clang-pvh: · line 471

Quoted 9 lines
automation/gitlab-ci/test.yaml +6 -0
@@ -463,6 +463,13 @@ qemu-smoke-x86-64-clang-pvh:
   needs:
     - debian-bookworm-clang-debug
 
+qemu-smoke-x86-64-gcc-efi:
+  extends: .qemu-x86-64
+  script:
+    - ./automation/scripts/qemu-smoke-x86-64-efi.sh pv 2>&1 | tee ${LOGFILE}
+  needs:
+    - debian-bookworm-gcc-debug

Given that the script you wrote (thank you!) can also handle pvh, can we directly add a pvh job to test.yaml too?

I guess we can, but is xen.efi + PVH dom0 actually different enough to worth testing given we already test MB2+EFI + PVH dom0?

Quoted 46 lines
Quoted 46 lines
Quoted 46 lines
automation/gitlab-ci/test.yaml +0 -0
 qemu-smoke-riscv64-gcc:
   extends: .qemu-riscv64
   script:
automation/scripts/qemu-smoke-x86-64-efi.sh new file +37 -0
new file mode 100755
index 000000000000..e053cfa995ba
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+set -ex -o pipefail
+
+# variant should be either pv or pvh
+variant=$1
+
+# Clone and build XTF
+git clone https://xenbits.xen.org/git-http/xtf.git
+cd xtf && make -j$(nproc) && cd -
+
+case $variant in
+    pvh) k=test-hvm64-example    extra="dom0-iommu=none dom0=pvh" ;;
+    *)   k=test-pv64-example     extra= ;;
+esac
+
+mkdir -p boot-esp/EFI/BOOT
+cp binaries/xen.efi boot-esp/EFI/BOOT/BOOTX64.EFI
+cp xtf/tests/example/$k boot-esp/EFI/BOOT/kernel
+
+cat > boot-esp/EFI/BOOT/BOOTX64.cfg <<EOF
+[global]
+default=test
+
+[test]
+options=loglvl=all console=com1 noreboot console_timestamps=boot $extra
+kernel=kernel
+EOF
+
+cp /usr/share/OVMF/OVMF_CODE.fd OVMF_CODE.fd
+cp /usr/share/OVMF/OVMF_VARS.fd OVMF_VARS.fd
+
+rm -f smoke.serial
+export TEST_CMD="qemu-system-x86_64 -nographic -M q35,kernel-irqchip=split \
+        -drive if=pflash,format=raw,readonly=on,file=OVMF_CODE.fd \
+        -drive if=pflash,format=raw,file=OVMF_VARS.fd \
+        -drive file=fat:rw:boot-esp,media=disk,index=0,format=raw \
Quoted 8 lines
Quoted 5 lines

automation/scripts/qemu-smoke-x86-64-efi.sh line 42

Quoted 5 lines
automation/scripts/qemu-smoke-x86-64-efi.sh new file +5 -0
+        -m 512 -monitor none -serial stdio"
+
+export TEST_LOG="smoke.serial"
+export PASSED="Test result: SUCCESS"
+export TEST_TIMEOUT=120

Although this works, I would prefer keeping the TEST_TIMEOUT overrides in test.yaml for consistency.

The problem is this doesn't work. The group-level variable overrides the one in yaml. See the commit message and the link there...

Quoted 11 lines

However, it might be better not to
override it (or to override to a higher timeout value), as successful tests will terminate immediately anyway. We need to be cautious about setting TEST_TIMEOUT values too low, as using a slow runner (like a small, busy cloud instance) can lead to false positive failures. This issue occurred frequently with ARM tests when we temporarily moved from a fast ARM server to slower ARM cloud instances a couple of months ago.

On the other hand, adjusting TEST_TIMEOUT for non-QEMU hardware-based tests is acceptable since those tests rely on real hardware availability, which is unlikely to become suddenly slower.

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#6 lore raw

Re: [PATCH 2/2] automation: add a smoke test for xen.efi on X86

Quoted 83 lines · Marek Marczykowski-Górecki
Quoted 82 lines · Stefano Stabellini

I forgot to reply to one important part below

Quoted 78 lines · Stefano Stabellini
Quoted 9 lines · Marek Marczykowski-Górecki

Check if xen.efi is bootable with an XTF dom0.

The TEST_TIMEOUT is set in the script to override project-global value. Setting it in the gitlab yaml file doesn't work, as it's too low priority
(https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence).

The multiboot2+EFI path is tested on hardware tests already.

Quoted 7 lines

---
This requires rebuilding debian:bookworm container.

The TEST_TIMEOUT issue mentioned above applies to xilix-* jobs too. It's not clear to me why the default TEST_TIMEOUT is set at the group level instead of in the yaml file, so I'm not adjusting the other places.

Let me premise that now that we use "expect" all successful tests will terminate as soon as the success condition is met, without waiting for the test timeout to expire.

There is a CI/CD variable called TEST_TIMEOUT set at the gitlab.com/xen-project level. (There is also a check in console.exp in case TEST_TIMEOUT is not set so that we don't run into problems in case the CI/CD variable is removed accidentally.) The global TEST_TIMEOUT is meant to be a high value to account for slow QEMU tests running potentially on our slowest cloud runners.

However, for hardware-based tests such as the xilinx-* jobs, we know that the timeout is supposed to be less than that. The test is running on real hardware which is considerably faster than QEMU running on our slowest runners. Basically, the timeout depends on the runner more than the test. So we override the TEST_TIMEOUT variable for the xilinx-* jobs providing a lower timeout value.

The global TEST_TIMEOUT is set to 1500.
The xilinx-* timeout is set to 120 for ARM and 1000 for x86.

You are welcome to override the TEST_TIMEOUT value for the hardware-based QubesOS tests. At the same time, given that on success the timeout is not really used, it is also OK to leave it like this.

Quoted 24 lines
---
 automation/build/debian/bookworm.dockerfile |  1 +
 automation/gitlab-ci/test.yaml              |  7 ++++
 automation/scripts/qemu-smoke-x86-64-efi.sh | 44 +++++++++++++++++++++
 3 files changed, 52 insertions(+)
 create mode 100755 automation/scripts/qemu-smoke-x86-64-efi.sh
automation/build/debian/bookworm.dockerfile +1 -0
index 3dd70cb6b2e3..061114ba522d 100644
@@ -46,6 +46,7 @@ RUN apt-get update && \
         # for test phase, qemu-smoke-* jobs
         qemu-system-x86 \
         expect \
+        ovmf \
         # for test phase, qemu-alpine-* jobs
         cpio \
         busybox-static \
automation/gitlab-ci/test.yaml +0 -0
index 8675016b6a37..74fd3f3109ae 100644

automation/gitlab-ci/test.yaml qemu-smoke-x86-64-clang-pvh: · line 471

Quoted 9 lines
automation/gitlab-ci/test.yaml +6 -0
@@ -463,6 +463,13 @@ qemu-smoke-x86-64-clang-pvh:
   needs:
     - debian-bookworm-clang-debug
 
+qemu-smoke-x86-64-gcc-efi:
+  extends: .qemu-x86-64
+  script:
+    - ./automation/scripts/qemu-smoke-x86-64-efi.sh pv 2>&1 | tee ${LOGFILE}
+  needs:
+    - debian-bookworm-gcc-debug

Given that the script you wrote (thank you!) can also handle pvh, can we directly add a pvh job to test.yaml too?

Quoted 2 lines

I guess we can, but is xen.efi + PVH dom0 actually different enough to worth testing given we already test MB2+EFI + PVH dom0?

Given that its only an XTF dom0, no.  We're only smoke testing the "native EFI" bits here.

~Andrew

#7 lore raw

Re: [PATCH 2/2] automation: add a smoke test for xen.efi on X86

In reply to Marek Marczykowski-Górecki
Quoted 86 lines · Marek Marczykowski-Górecki
Quoted 84 lines · Stefano Stabellini

I forgot to reply to one important part below

Quoted 80 lines · Stefano Stabellini
Quoted 9 lines · Marek Marczykowski-Górecki

Check if xen.efi is bootable with an XTF dom0.

The TEST_TIMEOUT is set in the script to override project-global value. Setting it in the gitlab yaml file doesn't work, as it's too low priority
(https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence).

The multiboot2+EFI path is tested on hardware tests already.

Quoted 7 lines

---
This requires rebuilding debian:bookworm container.

The TEST_TIMEOUT issue mentioned above applies to xilix-* jobs too. It's not clear to me why the default TEST_TIMEOUT is set at the group level instead of in the yaml file, so I'm not adjusting the other places.

Let me premise that now that we use "expect" all successful tests will terminate as soon as the success condition is met, without waiting for the test timeout to expire.

There is a CI/CD variable called TEST_TIMEOUT set at the gitlab.com/xen-project level. (There is also a check in console.exp in case TEST_TIMEOUT is not set so that we don't run into problems in case the CI/CD variable is removed accidentally.) The global TEST_TIMEOUT is meant to be a high value to account for slow QEMU tests running potentially on our slowest cloud runners.

However, for hardware-based tests such as the xilinx-* jobs, we know that the timeout is supposed to be less than that. The test is running on real hardware which is considerably faster than QEMU running on our slowest runners. Basically, the timeout depends on the runner more than the test. So we override the TEST_TIMEOUT variable for the xilinx-* jobs providing a lower timeout value.

The global TEST_TIMEOUT is set to 1500.
The xilinx-* timeout is set to 120 for ARM and 1000 for x86.

You are welcome to override the TEST_TIMEOUT value for the hardware-based QubesOS tests. At the same time, given that on success the timeout is not really used, it is also OK to leave it like this.

Quoted 24 lines
---
 automation/build/debian/bookworm.dockerfile |  1 +
 automation/gitlab-ci/test.yaml              |  7 ++++
 automation/scripts/qemu-smoke-x86-64-efi.sh | 44 +++++++++++++++++++++
 3 files changed, 52 insertions(+)
 create mode 100755 automation/scripts/qemu-smoke-x86-64-efi.sh
automation/build/debian/bookworm.dockerfile +1 -0
index 3dd70cb6b2e3..061114ba522d 100644
@@ -46,6 +46,7 @@ RUN apt-get update && \
         # for test phase, qemu-smoke-* jobs
         qemu-system-x86 \
         expect \
+        ovmf \
         # for test phase, qemu-alpine-* jobs
         cpio \
         busybox-static \
automation/gitlab-ci/test.yaml +0 -0
index 8675016b6a37..74fd3f3109ae 100644

automation/gitlab-ci/test.yaml qemu-smoke-x86-64-clang-pvh: · line 471

Quoted 9 lines
automation/gitlab-ci/test.yaml +6 -0
@@ -463,6 +463,13 @@ qemu-smoke-x86-64-clang-pvh:
   needs:
     - debian-bookworm-clang-debug
 
+qemu-smoke-x86-64-gcc-efi:
+  extends: .qemu-x86-64
+  script:
+    - ./automation/scripts/qemu-smoke-x86-64-efi.sh pv 2>&1 | tee ${LOGFILE}
+  needs:
+    - debian-bookworm-gcc-debug

Given that the script you wrote (thank you!) can also handle pvh, can we directly add a pvh job to test.yaml too?

Quoted 2 lines

I guess we can, but is xen.efi + PVH dom0 actually different enough to worth testing given we already test MB2+EFI + PVH dom0?

As it looks like also Andy thinks this is not useful, I am happy not to do this. Let's go with PV only as you did.

Quoted 55 lines
Quoted 46 lines
Quoted 46 lines
Quoted 46 lines
automation/gitlab-ci/test.yaml +0 -0
 qemu-smoke-riscv64-gcc:
   extends: .qemu-riscv64
   script:
automation/scripts/qemu-smoke-x86-64-efi.sh new file +37 -0
new file mode 100755
index 000000000000..e053cfa995ba
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+set -ex -o pipefail
+
+# variant should be either pv or pvh
+variant=$1
+
+# Clone and build XTF
+git clone https://xenbits.xen.org/git-http/xtf.git
+cd xtf && make -j$(nproc) && cd -
+
+case $variant in
+    pvh) k=test-hvm64-example    extra="dom0-iommu=none dom0=pvh" ;;
+    *)   k=test-pv64-example     extra= ;;
+esac
+
+mkdir -p boot-esp/EFI/BOOT
+cp binaries/xen.efi boot-esp/EFI/BOOT/BOOTX64.EFI
+cp xtf/tests/example/$k boot-esp/EFI/BOOT/kernel
+
+cat > boot-esp/EFI/BOOT/BOOTX64.cfg <<EOF
+[global]
+default=test
+
+[test]
+options=loglvl=all console=com1 noreboot console_timestamps=boot $extra
+kernel=kernel
+EOF
+
+cp /usr/share/OVMF/OVMF_CODE.fd OVMF_CODE.fd
+cp /usr/share/OVMF/OVMF_VARS.fd OVMF_VARS.fd
+
+rm -f smoke.serial
+export TEST_CMD="qemu-system-x86_64 -nographic -M q35,kernel-irqchip=split \
+        -drive if=pflash,format=raw,readonly=on,file=OVMF_CODE.fd \
+        -drive if=pflash,format=raw,file=OVMF_VARS.fd \
+        -drive file=fat:rw:boot-esp,media=disk,index=0,format=raw \
Quoted 8 lines
Quoted 5 lines

automation/scripts/qemu-smoke-x86-64-efi.sh line 42

Quoted 5 lines
automation/scripts/qemu-smoke-x86-64-efi.sh new file +5 -0
+        -m 512 -monitor none -serial stdio"
+
+export TEST_LOG="smoke.serial"
+export PASSED="Test result: SUCCESS"
+export TEST_TIMEOUT=120

Although this works, I would prefer keeping the TEST_TIMEOUT overrides in test.yaml for consistency.

Quoted 2 lines

The problem is this doesn't work. The group-level variable overrides the one in yaml. See the commit message and the link there...

Now I understand the problem, well spotted, thanks!

The idea behind having TEST_TIMEOUT defined as a project CI/CD variable is that it depends on the test infrastructure rather than the Xen code. So if we suddenly had slower runners we could change TEST_TIMEOUT without having to change the Xen code itself. So I think we should keep TEST_TIMEOUT as a project CI/CD variable.

I am not a fan of overwriting the TEST_TIMEOUT variable in the test scripts, because one test script can be used for multiple different tests, possibly even with different runners. For instance qubes-x86-64.sh works with a couple of different hardware runners that could have different timeout values. But I think it would work OK for now for our hardware-based tests (e.g. xilinx-smoke-dom0less-arm64.sh and qubes-x86-64.sh could overwrite TEST_TIMEOUT).

For this specific XTF test, I am not sure it is worth optimizing the timeout, maybe we should leave it as default. However if we wanted to lower the timeout value, overwriting it the way you did is OKish as I cannot think of another way.

Quoted 11 lines
Quoted 11 lines

However, it might be better not to
override it (or to override to a higher timeout value), as successful tests will terminate immediately anyway. We need to be cautious about setting TEST_TIMEOUT values too low, as using a slow runner (like a small, busy cloud instance) can lead to false positive failures. This issue occurred frequently with ARM tests when we temporarily moved from a fast ARM server to slower ARM cloud instances a couple of months ago.

On the other hand, adjusting TEST_TIMEOUT for non-QEMU hardware-based tests is acceptable since those tests rely on real hardware availability, which is unlikely to become suddenly slower.

#8 lore raw

Re: [PATCH 2/2] automation: add a smoke test for xen.efi on X86

Quoted 20 lines · Stefano Stabellini
Quoted 2 lines · Marek Marczykowski-Górecki

The problem is this doesn't work. The group-level variable overrides the one in yaml. See the commit message and the link there...

Now I understand the problem, well spotted, thanks!

The idea behind having TEST_TIMEOUT defined as a project CI/CD variable is that it depends on the test infrastructure rather than the Xen code. So if we suddenly had slower runners we could change TEST_TIMEOUT without having to change the Xen code itself. So I think we should keep TEST_TIMEOUT as a project CI/CD variable.

I am not a fan of overwriting the TEST_TIMEOUT variable in the test scripts, because one test script can be used for multiple different tests, possibly even with different runners. For instance qubes-x86-64.sh works with a couple of different hardware runners that could have different timeout values. But I think it would work OK for now for our hardware-based tests (e.g. xilinx-smoke-dom0less-arm64.sh and qubes-x86-64.sh could overwrite TEST_TIMEOUT).

Quoted 2 lines

For this specific XTF test, I am not sure it is worth optimizing the timeout, maybe we should leave it as default.

The default of 25min is quite wasteful for XTF test that failed...

Quoted 3 lines

However if we wanted to
lower the timeout value, overwriting it the way you did is OKish as I cannot think of another way.

If we'd need this option more often, Maybe we could set TEST_TIMEOUT_OVERRIDE in test yaml, and then test script use that (if present) instead? Or maybe have few "classes" of timeouts set globally (TEST_TIMEOUT_SHORT, TEST_TIMEOUT_MEDIUM, TEST_TIMEOUT_LONG? or some better named categories). But I don't think it's worth it for this XTF test yet.

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#9 lore raw

Re: [PATCH 2/2] automation: add a smoke test for xen.efi on X86

Quoted 30 lines · Marek Marczykowski-Górecki
Quoted 20 lines · Stefano Stabellini
Quoted 2 lines · Marek Marczykowski-Górecki

The problem is this doesn't work. The group-level variable overrides the one in yaml. See the commit message and the link there...

Now I understand the problem, well spotted, thanks!

The idea behind having TEST_TIMEOUT defined as a project CI/CD variable is that it depends on the test infrastructure rather than the Xen code. So if we suddenly had slower runners we could change TEST_TIMEOUT without having to change the Xen code itself. So I think we should keep TEST_TIMEOUT as a project CI/CD variable.

I am not a fan of overwriting the TEST_TIMEOUT variable in the test scripts, because one test script can be used for multiple different tests, possibly even with different runners. For instance qubes-x86-64.sh works with a couple of different hardware runners that could have different timeout values. But I think it would work OK for now for our hardware-based tests (e.g. xilinx-smoke-dom0less-arm64.sh and qubes-x86-64.sh could overwrite TEST_TIMEOUT).

Quoted 2 lines

For this specific XTF test, I am not sure it is worth optimizing the timeout, maybe we should leave it as default.

The default of 25min is quite wasteful for XTF test that failed...

Quoted 3 lines

However if we wanted to
lower the timeout value, overwriting it the way you did is OKish as I cannot think of another way.

Quoted 6 lines

If we'd need this option more often, Maybe we could set TEST_TIMEOUT_OVERRIDE in test yaml, and then test script use that (if present) instead? Or maybe have few "classes" of timeouts set globally (TEST_TIMEOUT_SHORT, TEST_TIMEOUT_MEDIUM, TEST_TIMEOUT_LONG? or some better named categories). But I don't think it's worth it for this XTF test yet.

Agreed, and good idea about TEST_TIMEOUT_OVERRIDE

#10 lore raw

Re: [PATCH 2/2] automation: add a smoke test for xen.efi on X86

Quoted 31 lines · Stefano Stabellini
Quoted 30 lines · Marek Marczykowski-Górecki
Quoted 20 lines · Stefano Stabellini
Quoted 2 lines · Marek Marczykowski-Górecki

The problem is this doesn't work. The group-level variable overrides the one in yaml. See the commit message and the link there...

Now I understand the problem, well spotted, thanks!

The idea behind having TEST_TIMEOUT defined as a project CI/CD variable is that it depends on the test infrastructure rather than the Xen code. So if we suddenly had slower runners we could change TEST_TIMEOUT without having to change the Xen code itself. So I think we should keep TEST_TIMEOUT as a project CI/CD variable.

I am not a fan of overwriting the TEST_TIMEOUT variable in the test scripts, because one test script can be used for multiple different tests, possibly even with different runners. For instance qubes-x86-64.sh works with a couple of different hardware runners that could have different timeout values. But I think it would work OK for now for our hardware-based tests (e.g. xilinx-smoke-dom0less-arm64.sh and qubes-x86-64.sh could overwrite TEST_TIMEOUT).

Quoted 2 lines

For this specific XTF test, I am not sure it is worth optimizing the timeout, maybe we should leave it as default.

The default of 25min is quite wasteful for XTF test that failed...

Quoted 3 lines

However if we wanted to
lower the timeout value, overwriting it the way you did is OKish as I cannot think of another way.

Quoted 8 lines
Quoted 6 lines

If we'd need this option more often, Maybe we could set TEST_TIMEOUT_OVERRIDE in test yaml, and then test script use that (if present) instead? Or maybe have few "classes" of timeouts set globally (TEST_TIMEOUT_SHORT, TEST_TIMEOUT_MEDIUM, TEST_TIMEOUT_LONG? or some better named categories). But I don't think it's worth it for this XTF test yet.

Agreed, and good idea about TEST_TIMEOUT_OVERRIDE

I decided to send a patch to implement it as I didn't want to keep the TEST_TIMEOUT as is (ignored) for the Xilinx jobs

https://marc.info/?l=xen-devel&m=172798685928204

You should be able to use TEST_TIMEOUT_OVERRIDE in your test.yaml for this test

#11 lore raw
In reply to Marek Marczykowski-Górecki
Quoted 12 lines · Marek Marczykowski-Górecki

It will be useful for further tests.

---
 automation/scripts/build | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
automation/scripts/build +0 -0
index b3c71fb6fb60..4cd41cb2c471 100755

automation/scripts/build if [[ "${CPPCHECK}" == "y" ]] && [[ "${HYPERVISOR_ONLY}" == "y" ]]; then · line 50

Quoted 4 lines
automation/scripts/build +1 -0
@@ -47,6 +47,7 @@ if [[ "${CPPCHECK}" == "y" ]] && [[ "${HYPERVISOR_ONLY}" == "y" ]]; then
 
     # Preserve artefacts
     cp xen/xen binaries/xen
+    if [[ -f xen/xen.efi ]]; then cp xen/xen.efi binaries/xen.efi; fi

Wouldn't

    # Preserve xen and optionally xen.efi
    cp -f xen/xen xen/xen.efi binaries/

do this in a more concise way?

Alternatively, what about this:

automation/scripts/build +0 -0
index b3c71fb6fb60..14815ea7ad9c 100755
@@ -41,6 +41,15 @@ cp xen/.config xen-config

 # Directory for the artefacts to be dumped into
 mkdir -p binaries

+collect_xen_artefacts ()
+{
+    for A in xen/xen xen/xen.efi; do
+        if [[ -f $A ]]; then
+            cp $A binaries/
+        fi
+    done
+}
+
 if [[ "${CPPCHECK}" == "y" ]] && [[ "${HYPERVISOR_ONLY}" == "y" ]]; then # Cppcheck analysis invokes Xen-only build xen/scripts/xen-analysis.py --run-cppcheck --cppcheck-misra -- -j$(nproc)
@@ -53,7 +62,7 @@ elif [[ "${HYPERVISOR_ONLY}" == "y" ]]; then make -j$(nproc) xen

     # Preserve artefacts
-    cp xen/xen binaries/xen
+    collect_xen_artefacts
 else
     # Full build.  Figure out our ./configure options cfgargs=()

so we don't triplicate the handling?

~Andrew

#12 lore raw
Quoted 20 lines · Andrew Cooper
Quoted 12 lines · Marek Marczykowski-Górecki

It will be useful for further tests.

---
 automation/scripts/build | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
automation/scripts/build +0 -0
index b3c71fb6fb60..4cd41cb2c471 100755

automation/scripts/build if [[ "${CPPCHECK}" == "y" ]] && [[ "${HYPERVISOR_ONLY}" == "y" ]]; then · line 50

Quoted 4 lines
automation/scripts/build +1 -0
@@ -47,6 +47,7 @@ if [[ "${CPPCHECK}" == "y" ]] && [[ "${HYPERVISOR_ONLY}" == "y" ]]; then
 
     # Preserve artefacts
     cp xen/xen binaries/xen
+    if [[ -f xen/xen.efi ]]; then cp xen/xen.efi binaries/xen.efi; fi

Wouldn't

Quoted 4 lines

    # Preserve xen and optionally xen.efi
    cp -f xen/xen xen/xen.efi binaries/

do this in a more concise way?

I don't think so, cp -f still fails if the source cannot be found.

Quoted 33 lines

Alternatively, what about this:

automation/scripts/build +0 -0
index b3c71fb6fb60..14815ea7ad9c 100755
@@ -41,6 +41,15 @@ cp xen/.config xen-config
  # Directory for the artefacts to be dumped into

 mkdir -p binaries

automation/scripts/build +9 -0
+collect_xen_artefacts ()
+{
+    for A in xen/xen xen/xen.efi; do
+        if [[ -f $A ]]; then
+            cp $A binaries/
+        fi
+    done
+}
+

 if [[ "${CPPCHECK}" == "y" ]] && [[ "${HYPERVISOR_ONLY}" == "y" ]]; then # Cppcheck analysis invokes Xen-only build xen/scripts/xen-analysis.py --run-cppcheck --cppcheck-misra --

automation/scripts/build +0 -1
-j$(nproc)
@@ -53,7 +62,7 @@ elif [[ "${HYPERVISOR_ONLY}" == "y" ]]; then

     make -j$(nproc) xen

     # Preserve artefacts
-    cp xen/xen binaries/xen
+    collect_xen_artefacts
 else
     # Full build.  Figure out our ./configure options cfgargs=()

Quoted 1 line

so we don't triplicate the handling?

That may be a better idea indeed.

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#13 lore raw
Quoted 21 lines · Marek Marczykowski-Górecki
Quoted 20 lines · Andrew Cooper
Quoted 12 lines · Marek Marczykowski-Górecki

It will be useful for further tests.

---
 automation/scripts/build | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
automation/scripts/build +0 -0
index b3c71fb6fb60..4cd41cb2c471 100755

automation/scripts/build if [[ "${CPPCHECK}" == "y" ]] && [[ "${HYPERVISOR_ONLY}" == "y" ]]; then · line 50

Quoted 4 lines
automation/scripts/build +1 -0
@@ -47,6 +47,7 @@ if [[ "${CPPCHECK}" == "y" ]] && [[ "${HYPERVISOR_ONLY}" == "y" ]]; then
 
     # Preserve artefacts
     cp xen/xen binaries/xen
+    if [[ -f xen/xen.efi ]]; then cp xen/xen.efi binaries/xen.efi; fi

Wouldn't

Quoted 6 lines
Quoted 4 lines

    # Preserve xen and optionally xen.efi
    cp -f xen/xen xen/xen.efi binaries/

do this in a more concise way?

I don't think so, cp -f still fails if the source cannot be found.

I think it would have to be something like:

cp -f xen/xen xen/xen.efi binaries/ || true

Quoted 33 lines
Quoted 33 lines

Alternatively, what about this:

automation/scripts/build +0 -0
index b3c71fb6fb60..14815ea7ad9c 100755
@@ -41,6 +41,15 @@ cp xen/.config xen-config
  # Directory for the artefacts to be dumped into

 mkdir -p binaries

automation/scripts/build +9 -0
+collect_xen_artefacts ()
+{
+    for A in xen/xen xen/xen.efi; do
+        if [[ -f $A ]]; then
+            cp $A binaries/
+        fi
+    done
+}
+

 if [[ "${CPPCHECK}" == "y" ]] && [[ "${HYPERVISOR_ONLY}" == "y" ]]; then # Cppcheck analysis invokes Xen-only build xen/scripts/xen-analysis.py --run-cppcheck --cppcheck-misra --

automation/scripts/build +0 -1
-j$(nproc)
@@ -53,7 +62,7 @@ elif [[ "${HYPERVISOR_ONLY}" == "y" ]]; then

     make -j$(nproc) xen

     # Preserve artefacts
-    cp xen/xen binaries/xen
+    collect_xen_artefacts
 else
     # Full build.  Figure out our ./configure options cfgargs=()

Quoted 3 lines
Quoted 1 line

so we don't triplicate the handling?

That may be a better idea indeed.

collect_xen_artefacts is also a good option, perhaps even better. A couple of minor NITs:

function collect_xen_artefacts()
{
local f
    for f in xen/xen xen/xen.efi; do
        if [[ -f $f ]]; then
            cp $f binaries/
        fi
    done
}