diff options
author | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-10-26 16:08:46 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-10-26 16:48:58 +1100 |
commit | d8830fde02f498cf657fd3141370289173688970 (patch) | |
tree | 4b2db196606020f70e24734fa7bfc34e205d2b83 | |
parent | 5a76659c0c2322f7c70d634cc51779582d25174d (diff) | |
download | skiboot-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>
-rw-r--r-- | .travis.yml | 2 | ||||
-rwxr-xr-x | opal-ci/build-qemu-powernv.sh | 8 | ||||
-rwxr-xr-x | opal-ci/install-deps-qemu-powernv.sh | 5 | ||||
-rw-r--r-- | test/Makefile.check | 9 | ||||
-rw-r--r-- | test/hello_world/Makefile.check | 11 | ||||
-rwxr-xr-x | test/hello_world/run_mambo_hello_world.sh (renamed from test/hello_world/run_hello_world.sh) | 0 | ||||
-rwxr-xr-x | test/hello_world/run_qemu_hello_world.sh | 45 | ||||
-rwxr-xr-x | test/run_mambo_boot_test.sh (renamed from test/run_boot_test.sh) | 0 | ||||
-rwxr-xr-x | test/run_qemu_boot_test.sh | 60 |
9 files changed, 133 insertions, 7 deletions
diff --git a/.travis.yml b/.travis.yml index b9f11cc..841f754 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 0000000..5b9a4f4 --- /dev/null +++ b/opal-ci/build-qemu-powernv.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -e + +git clone --depth=1 -b qemu-powernv-for-skiboot-1 git://github.com/open-power/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 0000000..a67daf4 --- /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 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; |