summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Franz <roy.franz@linaro.org>2015-04-22 14:30:13 -0700
committerRoy Franz <roy.franz@linaro.org>2015-04-22 20:24:50 -0700
commit9fcda914ebd1cb666a86877d27880d42793c83f8 (patch)
tree246e015c590e05a4bcf371e716d407cbe5e99f11
parent23203f9f686e0d2268d4165f26b0efd30bd7c8a5 (diff)
Add EDK2 AArch64 QEMU boot tests, with networking
Add EDK2 boot tests on AAarch64 QEMU with networking enabled to support testing iSCSI boot in EDK2. This is intended to be run in a KVM image that has been set up to provide a DHCP server and an iSCSI target Change-Id: I78753166c5d5288c56e264c76773c68f02f98b91 Signed-off-by: Roy Franz <roy.franz@linaro.org>
-rw-r--r--ubuntu/qemu-edk2-boot.yaml38
-rwxr-xr-xubuntu/scripts/qemu-edk2-boot.expect29
-rwxr-xr-xubuntu/scripts/qemu-edk2-boot.sh16
3 files changed, 83 insertions, 0 deletions
diff --git a/ubuntu/qemu-edk2-boot.yaml b/ubuntu/qemu-edk2-boot.yaml
new file mode 100644
index 0000000..80cc9ba
--- /dev/null
+++ b/ubuntu/qemu-edk2-boot.yaml
@@ -0,0 +1,38 @@
+metadata:
+ name: qemu-edk2-boot
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description: "Setup and run a test on Aarch64 QEMU System Image, with networking."
+ maintainer:
+ - roy.franz@linaro.org
+ os:
+ - debian
+ scope:
+ - functional
+ devices:
+ - kvm
+
+params:
+ # The QEMU executable
+ QEMU_BIN: /usr/local/bin/qemu-system-aarch64
+ # The QEMU machine definitions
+ QEMU_ARGS: -machine virt -cpu cortex-a57 -machine type=virt -pflash /home/flash0.img -pflash /home/flash1.img -device virtio-net-device,netdev=v0 -netdev tap,id=v0,ifname=tap0 -nographic -smp 1 -m 256
+ # Args for local disk: -machine virt -cpu cortex-a57 -machine type=virt -pflash /home/flash0.img -pflash /home/flash1.img -drive file=/root/iscsi-disk-image.bin,if=none,id=blk -device virtio-blk-device,drive=blk -nographic -smp 1 -m 256
+ # Test name to identify specific configuration
+ TEST_NAME: iscsi
+
+install:
+ deps:
+ - wget
+ - expect
+
+run:
+ steps:
+ # Put the flash image in /home with the disk image provided files
+ # for QEMU to keep them all together.
+ - pushd /home
+ - wget -O QEMU_EFI.fd ${EDK2_BIN}
+ # Pad to 64 MBytes as required for QEMU flash images
+ - dd if=QEMU_EFI.fd of=flash0.img ibs=64M conv=sync
+ - popd
+ - export QEMU_BIN QEMU_ARGS TEST_NAME
+ - ubuntu/scripts/qemu-edk2-boot.sh
diff --git a/ubuntu/scripts/qemu-edk2-boot.expect b/ubuntu/scripts/qemu-edk2-boot.expect
new file mode 100755
index 0000000..62300b0
--- /dev/null
+++ b/ubuntu/scripts/qemu-edk2-boot.expect
@@ -0,0 +1,29 @@
+#!/usr/bin/expect --
+#
+# Run qemu-system and check we can boot and shutdown
+#
+
+if {[llength $argv] == 0} {
+ send_user "Usage: boot.expect <qemu invocation>\n"
+ exit 1
+}
+
+set timeout 180
+spawn {*}$argv
+expect {
+ "buildroot login: " { send -- "root\r" }
+ timeout { send "# boot failed"; exit 1 }
+}
+
+
+expect "# "
+send -- "uname -a\r"
+expect "# "
+set timeout 10
+send -- "halt -d 5\r"
+expect {
+ "reboot: System halted" { send -- "c"; expect "(qemu) "; send -- "quit\r" }
+ timeout { send "# shutdown failed"; exit 2 }
+}
+expect eof
+exit 0
diff --git a/ubuntu/scripts/qemu-edk2-boot.sh b/ubuntu/scripts/qemu-edk2-boot.sh
new file mode 100755
index 0000000..5a226d0
--- /dev/null
+++ b/ubuntu/scripts/qemu-edk2-boot.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+#
+# A simple wrapper to run a expect based system test
+#
+# This expects the follow environment variables to be set:
+# QEMU_BIN - path to binary
+# QEMU_ARGS - arguments to run
+#
+
+
+pushd `dirname $0` > /dev/null
+BASE=`pwd -P`
+popd > /dev/null
+
+lava-test-case qemu-edk2-boot-${TEST_NAME} --shell ${BASE}/qemu-edk2-boot.expect ${QEMU_BIN} ${QEMU_ARGS}
+