[Skiboot] [PATCH] Support PowerNV Qemu for running tests
Stewart Smith
stewart at linux.vnet.ibm.com
Mon Oct 26 16:47:57 AEDT 2015
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 at linux.vnet.ibm.com>
---
.travis.yml | 2 ++
opal-ci/build-qemu-powernv.sh | 8 +++++
opal-ci/install-deps-qemu-powernv.sh | 5 +++
test/Makefile.check | 9 +++--
test/hello_world/Makefile.check | 11 +++---
test/hello_world/run_hello_world.sh | 49 -------------------------
test/hello_world/run_mambo_hello_world.sh | 49 +++++++++++++++++++++++++
test/hello_world/run_qemu_hello_world.sh | 45 +++++++++++++++++++++++
test/run_boot_test.sh | 59 ------------------------------
test/run_mambo_boot_test.sh | 59 ++++++++++++++++++++++++++++++
test/run_qemu_boot_test.sh | 60 +++++++++++++++++++++++++++++++
11 files changed, 241 insertions(+), 115 deletions(-)
create mode 100755 opal-ci/build-qemu-powernv.sh
create mode 100755 opal-ci/install-deps-qemu-powernv.sh
delete mode 100755 test/hello_world/run_hello_world.sh
create mode 100755 test/hello_world/run_mambo_hello_world.sh
create mode 100755 test/hello_world/run_qemu_hello_world.sh
delete mode 100755 test/run_boot_test.sh
create mode 100755 test/run_mambo_boot_test.sh
create mode 100755 test/run_qemu_boot_test.sh
diff --git a/.travis.yml b/.travis.yml
index b9f11cc9e6f6..841f754ca0f3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,6 +10,7 @@ before_install:
- sudo tar -C /opt/cross -xvf x86_64-gcc-4.8.0-nolibc_powerpc64-linux.tar.xz
- wget ftp://public.dhe.ibm.com/software/server/powerfuncsim/p8/packages/v1.0-2/systemsim-p8_1.0-2_amd64.deb
- sudo dpkg -i systemsim-p8_1.0-2_amd64.deb
+ - ./opal-ci/install-deps-qemu-powernv.sh
env:
global:
@@ -20,6 +21,7 @@ env:
- secure: "MpNEGFa1VrF/vsQq24n5UgfRbz1wVC6B8mubFnyK4gX0IuQ9xhWuTzMLUQF9UJxe5jnC2DTmVUvYTYN/hggw+PpYwbOOAE0QGR5pmPHA4PSRmc5pxt1q18/sv7EPFw66GFyWJq94nWjpigyKQ8KGtA67j1xFqrDoS43OA76WZgo="
script:
+ - (cd opal-ci; ./build-qemu-powernv.sh)
- make -j4 all check ; (make clean; cd external/gard && make) ; (make clean; cd external/pflash && make)
- make clean && SKIBOOT_GCOV=1 make && SKIBOOT_GCOV=1 make check
- make clean && rm -rf builddir && mkdir builddir && make SRC=`pwd` -f ../Makefile -C builddir
diff --git a/opal-ci/build-qemu-powernv.sh b/opal-ci/build-qemu-powernv.sh
new file mode 100755
index 000000000000..3b22b61b9487
--- /dev/null
+++ b/opal-ci/build-qemu-powernv.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+set -e
+
+git clone --depth=1 git://github.com/ozbenh/qemu.git
+cd qemu
+git submodule update --init dtc
+./configure --target-list=ppc64-softmmu --disable-werror
+make -j `grep -c processor /proc/cpuinfo`
diff --git a/opal-ci/install-deps-qemu-powernv.sh b/opal-ci/install-deps-qemu-powernv.sh
new file mode 100755
index 000000000000..a67daf40ab51
--- /dev/null
+++ b/opal-ci/install-deps-qemu-powernv.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+set -e
+sudo apt-get -y install eatmydata
+sudo eatmydata apt-get -y install gcc python g++ pkg-config \
+libz-dev libglib2.0-dev libpixman-1-dev libfdt-dev git
diff --git a/test/Makefile.check b/test/Makefile.check
index de23bfba7d74..429e3809af24 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 5b330ed3c60e..4191303546f8 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_hello_world.sh
deleted file mode 100755
index e6f4d860daed..000000000000
--- a/test/hello_world/run_hello_world.sh
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/bash
-
-
-if [ -z "$MAMBO_PATH" ]; then
- MAMBO_PATH=/opt/ibm/systemsim-p8/
-fi
-
-if [ -z "$MAMBO_BINARY" ]; then
- MAMBO_BINARY="/run/pegasus/power8"
-fi
-
-if [ ! -x "$MAMBO_PATH/$MAMBO_BINARY" ]; then
- echo 'Could not find executable MAMBO_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
-
-# Currently getting some core dumps from mambo, so disable them!
-OLD_ULIMIT_C=`ulimit -c`
-ulimit -c 0
-
-( cd external/mambo;
-cat <<EOF | expect
-set timeout 30
-spawn $MAMBO_PATH/$MAMBO_BINARY -n -f ../../test/hello_world/run_hello_world.tcl
-expect {
-timeout { send_user "\nTimeout waiting for hello world\n"; exit 1 }
-eof { send_user "\nUnexpected EOF\n;" exit 1 }
-"ATTN"
-}
-wait
-exit 0
-EOF
-)
-ulimit -c $OLD_ULIMIT_C
-echo
-exit 0;
diff --git a/test/hello_world/run_mambo_hello_world.sh b/test/hello_world/run_mambo_hello_world.sh
new file mode 100755
index 000000000000..e6f4d860daed
--- /dev/null
+++ b/test/hello_world/run_mambo_hello_world.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+
+if [ -z "$MAMBO_PATH" ]; then
+ MAMBO_PATH=/opt/ibm/systemsim-p8/
+fi
+
+if [ -z "$MAMBO_BINARY" ]; then
+ MAMBO_BINARY="/run/pegasus/power8"
+fi
+
+if [ ! -x "$MAMBO_PATH/$MAMBO_BINARY" ]; then
+ echo 'Could not find executable MAMBO_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
+
+# Currently getting some core dumps from mambo, so disable them!
+OLD_ULIMIT_C=`ulimit -c`
+ulimit -c 0
+
+( cd external/mambo;
+cat <<EOF | expect
+set timeout 30
+spawn $MAMBO_PATH/$MAMBO_BINARY -n -f ../../test/hello_world/run_hello_world.tcl
+expect {
+timeout { send_user "\nTimeout waiting for hello world\n"; exit 1 }
+eof { send_user "\nUnexpected EOF\n;" exit 1 }
+"ATTN"
+}
+wait
+exit 0
+EOF
+)
+ulimit -c $OLD_ULIMIT_C
+echo
+exit 0;
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 000000000000..32921785646a
--- /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_boot_test.sh
deleted file mode 100755
index 8ae7fdab5dfa..000000000000
--- a/test/run_boot_test.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/bash
-
-
-if [ -z "$MAMBO_PATH" ]; then
- MAMBO_PATH=/opt/ibm/systemsim-p8/
-fi
-
-if [ -z "$MAMBO_BINARY" ]; then
- MAMBO_BINARY="/run/pegasus/power8"
-fi
-
-if [ ! -x "$MAMBO_PATH/$MAMBO_BINARY" ]; then
- echo 'Could not find executable MAMBO_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
-
-if [ -z "$SKIBOOT_MEM_DUMP" ]; then
- export SKIBOOT_MEM_DUMP=skiboot-boot_test.dump
-fi
-
-# Currently getting some core dumps from mambo, so disable them!
-OLD_ULIMIT_C=`ulimit -c`
-ulimit -c 0
-
-( cd external/mambo;
-cat <<EOF | expect
-set timeout 600
-spawn $MAMBO_PATH/$MAMBO_BINARY -n -f ../../test/run_boot_test.tcl
-expect {
-timeout { send_user "\nTimeout waiting for petitboot\n"; exit 1 }
-eof { send_user "\nUnexpected EOF\n;" exit 1 }
-"Execution stopped: Sim Support exit requested stop"
-}
-wait
-exit 0
-EOF
-)
-ulimit -c $OLD_ULIMIT_C
-echo
-exit 0;
diff --git a/test/run_mambo_boot_test.sh b/test/run_mambo_boot_test.sh
new file mode 100755
index 000000000000..8ae7fdab5dfa
--- /dev/null
+++ b/test/run_mambo_boot_test.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+
+if [ -z "$MAMBO_PATH" ]; then
+ MAMBO_PATH=/opt/ibm/systemsim-p8/
+fi
+
+if [ -z "$MAMBO_BINARY" ]; then
+ MAMBO_BINARY="/run/pegasus/power8"
+fi
+
+if [ ! -x "$MAMBO_PATH/$MAMBO_BINARY" ]; then
+ echo 'Could not find executable MAMBO_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
+
+if [ -z "$SKIBOOT_MEM_DUMP" ]; then
+ export SKIBOOT_MEM_DUMP=skiboot-boot_test.dump
+fi
+
+# Currently getting some core dumps from mambo, so disable them!
+OLD_ULIMIT_C=`ulimit -c`
+ulimit -c 0
+
+( cd external/mambo;
+cat <<EOF | expect
+set timeout 600
+spawn $MAMBO_PATH/$MAMBO_BINARY -n -f ../../test/run_boot_test.tcl
+expect {
+timeout { send_user "\nTimeout waiting for petitboot\n"; exit 1 }
+eof { send_user "\nUnexpected EOF\n;" exit 1 }
+"Execution stopped: Sim Support exit requested stop"
+}
+wait
+exit 0
+EOF
+)
+ulimit -c $OLD_ULIMIT_C
+echo
+exit 0;
diff --git a/test/run_qemu_boot_test.sh b/test/run_qemu_boot_test.sh
new file mode 100755
index 000000000000..4809810fa551
--- /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;
--
2.1.4
More information about the Skiboot
mailing list