]> xenbits.xensource.com Git - xen.git/commitdiff
automation: fix false success in qemu tests
authorVictor Lira <victorm.lira@amd.com>
Thu, 29 Aug 2024 22:34:22 +0000 (15:34 -0700)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 11 Nov 2024 18:16:35 +0000 (18:16 +0000)
Fix flaw in qemu-*.sh tests that producess a false success. The following
lines produces success despite the "expect" script producing nonzero exit
status:

    set +e
...
    ./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
    (end of file)

The default exit status for a pipeline using "|" operator is that of the
rightmost command. Fix this by setting the "pipefail" option in the shell,
and removing "set +e" allowing the expect script to determine the result.

Signed-off-by: Victor Lira <victorm.lira@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
(cherry picked from commit 740c41ca05a83a2c3629eb2ff323877c37d95c1e)

automation/scripts/qemu-alpine-x86_64.sh
automation/scripts/qemu-key.exp
automation/scripts/qemu-smoke-dom0-arm32.sh
automation/scripts/qemu-smoke-dom0-arm64.sh
automation/scripts/qemu-smoke-dom0less-arm32.sh
automation/scripts/qemu-smoke-dom0less-arm64.sh
automation/scripts/qemu-smoke-ppc64le.sh
automation/scripts/qemu-smoke-riscv64.sh
automation/scripts/qemu-smoke-x86-64.sh
automation/scripts/qemu-xtf-dom0less-arm64.sh

index 42a89e86b02190df4c65bc4681f54767cbd5a0cb..93914c41bc2424f87808a8735d8a6bb0b4a4ba47 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 # DomU Busybox
 cd binaries
@@ -76,7 +76,6 @@ EOF
 
 # Run the test
 rm -f smoke.serial
-set +e
 export QEMU_CMD="qemu-system-x86_64 \
     -cpu qemu64,+svm \
     -m 2G -smp 2 \
index 787f1f08cb96073bbb73faf0f1eff783ef1e7ebf..66c416483146f8499fd3fbba54c7036d1853437f 100755 (executable)
@@ -14,7 +14,7 @@ eval spawn $env(QEMU_CMD)
 
 expect_after {
     -re "(.*)\r" {
-        exp_continue
+        exp_continue -continue_timer
     }
     timeout {send_error "ERROR-Timeout!\n"; exit 1}
     eof {send_error "ERROR-EOF!\n"; exit 1}
index 7f3d520d9b55ff7c9bec447722e925ce88871a20..0e758dc8f428d6f963af2a83c15420a662fcb8c0 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 serial_log="$(pwd)/smoke.serial"
 
@@ -77,7 +77,6 @@ git clone --depth 1 https://gitlab.com/xen-project/imagebuilder.git
 bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 
 rm -f ${serial_log}
-set +e
 export QEMU_CMD="./qemu-system-arm \
    -machine virt \
    -machine virtualization=true \
index e0cea742b0a0c842438f8367b1516c1a70151a8c..81f210f7f50ebabd5d8d1a233d6667ece9c467be 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 # DomU Busybox
 cd binaries
@@ -93,7 +93,6 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 
 # Run the test
 rm -f smoke.serial
-set +e
 export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
index e824cb7c2a3dbbf5ad28b3bb9c5b707a22b6f299..38e8a0b0bd7dec45d56de711366876042854cd38 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 test_variant=$1
 
@@ -130,7 +130,6 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 
 # Run the test
 rm -f ${serial_log}
-set +e
 export QEMU_CMD="./qemu-system-arm \
     -machine virt \
     -machine virtualization=true \
index f42ba5d196bce1167a28dba836a6229fc884b6be..ea67650e17dadddb038fce84cd0196365a5fffa1 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 test_variant=$1
 
@@ -204,7 +204,6 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 
 # Run the test
 rm -f smoke.serial
-set +e
 export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt,gic-version=$gic_version \
index 594f92c19cc2b8eea6713850a5f54e7f48814dd4..49e189c370580aa4f9bc9b7e8410da57749ca8de 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 serial_log="$(pwd)/smoke.serial"
 
@@ -9,7 +9,6 @@ machine=$1
 
 # Run the test
 rm -f ${serial_log}
-set +e
 
 export QEMU_CMD="qemu-system-ppc64 \
     -bios skiboot.lid \
index c2595f657ff3694221f12d96b312b19ee99816e1..422ee03e0d2665d170511e1e4d31a226fbc1ef4e 100755 (executable)
@@ -1,10 +1,9 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 # Run the test
 rm -f smoke.serial
-set +e
 
 export QEMU_CMD="qemu-system-riscv64 \
     -M virt \
index 3440b1761db4d1e112d6108cdfb32460dbef1f9d..7495185d9fc6d151ea7ea7bb6917969509589ac8 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 # variant should be either pv or pvh
 variant=$1
@@ -15,7 +15,6 @@ case $variant in
 esac
 
 rm -f smoke.serial
-set +e
 export QEMU_CMD="qemu-system-x86_64 -nographic -kernel binaries/xen \
         -initrd xtf/tests/example/$k \
         -append \"loglvl=all console=com1 noreboot console_timestamps=boot $extra\" \
index 4042fe50602b54199711cb16640281e423eba867..acef1637e25bdaa769a6d7dd356f3df114bb85e6 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 # Name of the XTF test
 xtf_test=$1
@@ -50,7 +50,6 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 
 # Run the test
 rm -f smoke.serial
-set +e
 export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \