diff options
Diffstat (limited to 'ubuntu/scripts')
-rwxr-xr-x | ubuntu/scripts/qemu-edk2-boot.expect | 29 | ||||
-rwxr-xr-x | ubuntu/scripts/qemu-edk2-boot.sh | 16 |
2 files changed, 45 insertions, 0 deletions
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} + |