aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2015-10-26 16:08:46 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-10-26 16:48:58 +1100
commitd8830fde02f498cf657fd3141370289173688970 (patch)
tree4b2db196606020f70e24734fa7bfc34e205d2b83 /test
parent5a76659c0c2322f7c70d634cc51779582d25174d (diff)
downloadskiboot-d8830fde02f498cf657fd3141370289173688970.zip
skiboot-d8830fde02f498cf657fd3141370289173688970.tar.gz
skiboot-d8830fde02f498cf657fd3141370289173688970.tar.bz2
Support PowerNV Qemu for running tests
We now run tests under both Mambo and QEMU PowerNV model. Also added are scripts in opal-ci/ for building powernv model qemu. Currently, this is not yet in upstream qemu, so we build from Ben's branch. You can start using qemu along with/instead of Mambo by: 1) (cd ./opal-ci; sudo ./install-deps-qemu-powernv.sh; ./build-qemu-powernv.sh) 2) Pointing QEMU_PATH and QEMU_BINARY environment variables to appropriate qemu binary with powernv model When building qemu ourselves, we build a *specific* known good tag from the open-power tree. This should ensure that into the future existing test scripts should continue to function. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.check9
-rw-r--r--test/hello_world/Makefile.check11
-rwxr-xr-xtest/hello_world/run_mambo_hello_world.sh (renamed from test/hello_world/run_hello_world.sh)0
-rwxr-xr-xtest/hello_world/run_qemu_hello_world.sh45
-rwxr-xr-xtest/run_mambo_boot_test.sh (renamed from test/run_boot_test.sh)0
-rwxr-xr-xtest/run_qemu_boot_test.sh60
6 files changed, 118 insertions, 7 deletions
diff --git a/test/Makefile.check b/test/Makefile.check
index de23bfb..429e380 100644
--- a/test/Makefile.check
+++ b/test/Makefile.check
@@ -1,12 +1,15 @@
-check: boot-check
+check: boot-check qemu-boot-check
boot-check: skiboot.lid
- ./test/run_boot_test.sh
+ ./test/run_mambo_boot_test.sh
+
+qemu-boot-check: skiboot.lid
+ ./test/run_qemu_boot_test.sh
OP_BUILD_BOOT_CHECK=op-build-v1.0 op-build-v1.1 op-build-v1.2 op-build-v1.2.1
boot-check-%: skiboot.lid skiboot.map
- SKIBOOT_MEM_DUMP=skiboot-$(@:boot-check-%=%).dump SKIBOOT_ZIMAGE=`pwd`/opal-ci/images/$(@:boot-check-%=%)/zImage.epapr ./test/run_boot_test.sh
+ SKIBOOT_MEM_DUMP=skiboot-$(@:boot-check-%=%).dump SKIBOOT_ZIMAGE=`pwd`/opal-ci/images/$(@:boot-check-%=%)/zImage.epapr ./test/run_mambo_boot_test.sh
boot-tests: boot-check $(OP_BUILD_BOOT_CHECK:%=boot-check-%)
diff --git a/test/hello_world/Makefile.check b/test/hello_world/Makefile.check
index 5b330ed..4191303 100644
--- a/test/hello_world/Makefile.check
+++ b/test/hello_world/Makefile.check
@@ -1,11 +1,14 @@
HELLO_WORLD_TEST := test/hello_world/hello_kernel/hello_kernel
-check: $(HELLO_WORLD_TEST:%=%-check)
+check: $(HELLO_WORLD_TEST:%=%-check-mambo) $(HELLO_WORLD_TEST:%=%-check-qemu)
-boot-tests: $(HELLO_WORLD_TEST:%=%-check)
+boot-tests: $(HELLO_WORLD_TEST:%=%-check-mambo) $(HELLO_WORLD_TEST:%=%-check-qemu)
-$(HELLO_WORLD_TEST:%=%-check) : %-check: % skiboot.lid
- ./test/hello_world/run_hello_world.sh
+$(HELLO_WORLD_TEST:%=%-check-mambo) : %-check-mambo: % skiboot.lid
+ ./test/hello_world/run_mambo_hello_world.sh
+
+$(HELLO_WORLD_TEST:%=%-check-qemu) : %-check-qemu: % skiboot.lid
+ ./test/hello_world/run_qemu_hello_world.sh
test/hello_world/hello_kernel/hello_kernel.o: test/hello_world/hello_kernel/hello_kernel.S test/hello_world/hello_kernel/hello_kernel.ld
$(call Q,CC, $(CC) -m64 -c -MMD -o $@ $< ,$@)
diff --git a/test/hello_world/run_hello_world.sh b/test/hello_world/run_mambo_hello_world.sh
index e6f4d86..e6f4d86 100755
--- a/test/hello_world/run_hello_world.sh
+++ b/test/hello_world/run_mambo_hello_world.sh
diff --git a/test/hello_world/run_qemu_hello_world.sh b/test/hello_world/run_qemu_hello_world.sh
new file mode 100755
index 0000000..3292178
--- /dev/null
+++ b/test/hello_world/run_qemu_hello_world.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+
+if [ -z "$QEMU_PATH" ]; then
+ QEMU_PATH=`pwd`/opal-ci/qemu/ppc64-softmmu/
+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';
+ exit 0;
+fi
+
+if [ -n "$KERNEL" ]; then
+ echo 'Please rebuild skiboot without KERNEL set. Skipping hello_world test';
+ exit 0;
+fi
+
+if [ ! `command -v expect` ]; then
+ echo 'Could not find expect binary. Skipping hello_world test';
+ exit 0;
+fi
+
+
+export SKIBOOT_ZIMAGE=`pwd`/test/hello_world/hello_kernel/hello_kernel
+
+
+(
+cat <<EOF | expect
+set timeout 30
+spawn $QEMU_PATH/$QEMU_BINARY -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 }
+"Hello World!"
+}
+close
+wait
+exit 0
+EOF
+)
+exit 0;
diff --git a/test/run_boot_test.sh b/test/run_mambo_boot_test.sh
index 8ae7fda..8ae7fda 100755
--- a/test/run_boot_test.sh
+++ b/test/run_mambo_boot_test.sh
diff --git a/test/run_qemu_boot_test.sh b/test/run_qemu_boot_test.sh
new file mode 100755
index 0000000..4809810
--- /dev/null
+++ b/test/run_qemu_boot_test.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+
+if [ -z "$QEMU_PATH" ]; then
+ QEMU_PATH=`pwd`/opal-ci/qemu/ppc64-softmmu/
+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';
+ exit 0;
+fi
+
+if [ -n "$KERNEL" ]; then
+ echo 'Please rebuild skiboot without KERNEL set. Skipping hello_world test';
+ exit 0;
+fi
+
+if [ ! `command -v expect` ]; then
+ echo 'Could not find expect binary. Skipping hello_world test';
+ exit 0;
+fi
+
+if [ -z "$SKIBOOT_ZIMAGE" ]; then
+ export SKIBOOT_ZIMAGE=`pwd`/zImage.epapr
+fi
+
+if [ ! -f "$SKIBOOT_ZIMAGE" ]; then
+ echo "No $SKIBOOT_ZIMAGE, skipping boot test";
+ exit 0;
+fi
+
+T=`mktemp --tmpdir skiboot_qemu_boot_test.XXXXXXXXXX`
+
+( cat <<EOF | expect
+set timeout 600
+spawn $QEMU_PATH/$QEMU_BINARY -m 1G -M powernv -kernel $SKIBOOT_ZIMAGE -nographic
+expect {
+timeout { send_user "\nTimeout waiting for petitboot\n"; exit 1 }
+eof { send_user "\nUnexpected EOF\n;" exit 1 }
+"Welcome to Petitboot"
+}
+close
+wait
+exit 0
+EOF
+) 2>&1 > $T
+E=$?
+
+if [ $E -eq 0 ]; then
+ rm $T
+else
+ echo "Boot Test FAILED. Results in $T";
+fi
+
+echo
+exit $E;