[Skiboot] [PATCH] tests: Specfiy Qemu with a single environment variable

Joel Stanley joel at jms.id.au
Wed May 2 17:18:07 AEST 2018


This allows Qemu to work out of the box if the user has an appropriate
Qemu installed.

Support for running TCG power guests has come a long way from when we
first added these test scripts. It makes sense to use the system Qemu
where possible, as for most people this will succeed.

Signed-off-by: Joel Stanley <joel at jms.id.au>
---
Stewart, hopefully this doesn't break other scripts and test frameworks.

 test/hello_world/run_qemu_hello_world.sh           | 14 +++++---------
 test/run_qemu-jessie-debian-installer_boot_test.sh | 14 +++++---------
 test/run_qemu_boot_test.sh                         | 14 +++++---------
 3 files changed, 15 insertions(+), 27 deletions(-)

diff --git a/test/hello_world/run_qemu_hello_world.sh b/test/hello_world/run_qemu_hello_world.sh
index e08f851f2b08..cc5055ee7cbd 100755
--- a/test/hello_world/run_qemu_hello_world.sh
+++ b/test/hello_world/run_qemu_hello_world.sh
@@ -1,16 +1,12 @@
 #!/bin/bash
 
 
-if [ -z "$QEMU_PATH" ]; then
-    QEMU_PATH=`pwd`/opal-ci/qemu/ppc64-softmmu/
+if [ -z "$QEMU" ]; then
+    QEMU="qemu-system-ppc64"
 fi
 
-if [ -z "$QEMU_BINARY" ]; then
-    QEMU_BINARY="qemu-system-ppc64"
-fi
-
-if [ ! -x "$QEMU_PATH/$QEMU_BINARY" ]; then
-    echo 'Could not find executable QEMU_BINARY. Skipping hello_world test';
+if [ ! `command -v $QEMU` ]; then
+    echo 'Could not find executable QEMU. Skipping hello_world test';
     exit 0;
 fi
 
@@ -34,7 +30,7 @@ trap "rm -f -- '$t'" EXIT
 (
 cat <<EOF | expect
 set timeout 30
-spawn $QEMU_PATH/$QEMU_BINARY -m 1G -M powernv -kernel $SKIBOOT_ZIMAGE -nographic
+spawn $QEMU -m 1G -M powernv -kernel $SKIBOOT_ZIMAGE -nographic
 expect {
 timeout { send_user "\nTimeout waiting for hello world\n"; exit 1 }
 eof { send_user "\nUnexpected EOF\n;" exit 1 }
diff --git a/test/run_qemu-jessie-debian-installer_boot_test.sh b/test/run_qemu-jessie-debian-installer_boot_test.sh
index ab9ca85f18cb..57e9d82f71a6 100755
--- a/test/run_qemu-jessie-debian-installer_boot_test.sh
+++ b/test/run_qemu-jessie-debian-installer_boot_test.sh
@@ -1,16 +1,12 @@
 #!/bin/bash
 
 
-if [ -z "$QEMU_PATH" ]; then
-    QEMU_PATH=`pwd`/opal-ci/qemu/ppc64-softmmu/
+if [ -z "$QEMU" ]; then
+    QEMU="qemu-system-ppc64"
 fi
 
-if [ -z "$QEMU_BINARY" ]; then
-    QEMU_BINARY="qemu-system-ppc64"
-fi
-
-if [ ! -x "$QEMU_PATH/$QEMU_BINARY" ]; then
-    echo 'Could not find executable QEMU_BINARY. Skipping hello_world test';
+if [ ! `command -v qemu-system-ppc64` ]; then
+    echo 'Could not find executable QEMU. Skipping hello_world test';
     exit 0;
 fi
 
@@ -44,7 +40,7 @@ $QEMU_PATH/../qemu-img  create -f qcow2 $D 128G 2>&1 > $T
 
 ( cat <<EOF | expect
 set timeout 600
-spawn $QEMU_PATH/$QEMU_BINARY -m 2G -M powernv -kernel debian-jessie-vmlinux -initrd debian-jessie-initrd.gz -nographic -device ipmi-bmc-sim,id=ipmi0 -device isa-ipmi-bt,bmc=ipmi0 -hda $D
+spawn $QEMU -m 2G -M powernv -kernel debian-jessie-vmlinux -initrd debian-jessie-initrd.gz -nographic -device ipmi-bmc-sim,id=ipmi0 -device isa-ipmi-bt,bmc=ipmi0 -hda $D
 expect {
 timeout { send_user "\nTimeout waiting for petitboot\n"; exit 1 }
 eof { send_user "\nUnexpected EOF\n;" exit 1 }
diff --git a/test/run_qemu_boot_test.sh b/test/run_qemu_boot_test.sh
index b984afc22aef..c3a793376e21 100755
--- a/test/run_qemu_boot_test.sh
+++ b/test/run_qemu_boot_test.sh
@@ -1,16 +1,12 @@
 #!/bin/bash
 
 
-if [ -z "$QEMU_PATH" ]; then
-    QEMU_PATH=`pwd`/opal-ci/qemu/ppc64-softmmu/
+if [ -z "$QEMU" ]; then
+    QEMU="qemu-system-ppc64"
 fi
 
-if [ -z "$QEMU_BINARY" ]; then
-    QEMU_BINARY="qemu-system-ppc64"
-fi
-
-if [ ! -x "$QEMU_PATH/$QEMU_BINARY" ]; then
-    echo 'Could not find executable QEMU_BINARY. Skipping hello_world test';
+if [ ! `command -v qemu-system-ppc64` ]; then
+    echo 'Could not find executable QEMU. Skipping hello_world test';
     exit 0;
 fi
 
@@ -37,7 +33,7 @@ T=`mktemp  --tmpdir skiboot_qemu_boot_test.XXXXXXXXXX`
 
 ( cat <<EOF | expect
 set timeout 600
-spawn $QEMU_PATH/$QEMU_BINARY -m 3G -M powernv -kernel $SKIBOOT_ZIMAGE -nographic -device ipmi-bmc-sim,id=ipmi0 -device isa-ipmi-bt,bmc=ipmi0
+spawn $QEMU -m 3G -M powernv -kernel $SKIBOOT_ZIMAGE -nographic -device ipmi-bmc-sim,id=ipmi0 -device isa-ipmi-bt,bmc=ipmi0
 expect {
 timeout { send_user "\nTimeout waiting for petitboot\n"; exit 1 }
 eof { send_user "\nUnexpected EOF\n;" exit 1 }
-- 
2.17.0



More information about the Skiboot mailing list