From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: [kvm-unit-tests PATCH 14/14] mkstandalone: add support for powerpc Date: Mon, 3 Aug 2015 16:41:31 +0200 Message-ID: <1438612891-3718-15-git-send-email-drjones@redhat.com> References: <1438612891-3718-1-git-send-email-drjones@redhat.com> Cc: dgibson@redhat.com, david@gibson.dropbear.id.au, agraf@suse.de, thuth@redhat.com, lvivier@redhat.com, pbonzini@redhat.com To: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:51139 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754053AbbHCOmJ (ORCPT ); Mon, 3 Aug 2015 10:42:09 -0400 In-Reply-To: <1438612891-3718-1-git-send-email-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: PowerPC needs firmware and an exit code snooper. Signed-off-by: Andrew Jones --- configure | 3 +++ powerpc/run | 2 +- scripts/mkstandalone.sh | 50 +++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/configure b/configure index e1f70bd79d4f7..7b332269e0d2e 100755 --- a/configure +++ b/configure @@ -11,6 +11,7 @@ arch=`uname -m | sed -e s/i.86/i386/ | sed -e 's/arm.*/arm/'` host=$arch cross_prefix= snooper= +firmware= usage() { cat <<-EOF @@ -85,6 +86,7 @@ elif [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then elif [ "$arch" = "powerpc" ] || [ "$arch" = "ppc64" ]; then testdir=powerpc snooper=snoop_exitcode + firmware=$testdir/boot_rom.bin else testdir=$arch fi @@ -140,4 +142,5 @@ AR=$cross_prefix$ar API=$api TEST_DIR=$testdir SNOOPER="$snooper" +FIRMWARE=$firmware EOF diff --git a/powerpc/run b/powerpc/run index 5bc826765eff8..1d5b1c9135299 100755 --- a/powerpc/run +++ b/powerpc/run @@ -29,7 +29,7 @@ if ! $qemu -machine '?' 2>&1 | grep 'pseries' > /dev/null; then exit 2 fi -boot_rom='powerpc/boot_rom.bin' +boot_rom=$FIRMWARE if [ -f powerpc/rom/boot_rom.bin ]; then boot_rom='powerpc/rom/boot_rom.bin' fi diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh index 4a6e4a3ada1a3..dd10ece6940de 100755 --- a/scripts/mkstandalone.sh +++ b/scripts/mkstandalone.sh @@ -17,6 +17,10 @@ elif [ -n "$one_kernel" ] && [ -z "$one_testname" ]; then one_testname="${one_kernel_base%.*}" fi +if [ "$SNOOPER" ]; then + snooper="| $SNOOPER" +fi + unittests=$TEST_DIR/unittests.cfg mkdir -p tests @@ -51,6 +55,22 @@ function mkstandalone() #!/bin/sh EOF +if [ "$SNOOPER" = "snoop_exitcode" ]; then + cat <> $standalone +snoop_exitcode() +{ + while read line; do + if echo \$line | grep 'EXIT: STATUS=' > /dev/null; then + code=\`echo \$line | cut -d= -f2\` + fi + echo \$line + done + exit \$code +} + +EOF +fi + if [ "$arch" ]; then cat <> $standalone ARCH=\`uname -m | sed -e s/i.86/i386/ | sed -e 's/arm.*/arm/'\` @@ -82,7 +102,21 @@ exit 1 EOF else cat <> $standalone -trap 'rm -f \$bin; exit 1' HUP INT TERM +trap 'rm -f \$fwbin \$bin; exit 1' HUP INT TERM + +EOF +if [ -f "$FIRMWARE" ]; then + cat <> $standalone +fwbin=\`mktemp\` +base64 -d << 'BIN_EOF' | zcat > \$fwbin && +EOF +gzip - < $FIRMWARE | base64 >> $standalone + cat <> $standalone +BIN_EOF + +EOF +fi + cat <> $standalone bin=\`mktemp\` base64 -d << 'BIN_EOF' | zcat > \$bin && EOF @@ -101,9 +135,17 @@ while \$qemu \$cmdline -smp \$MAX_SMP 2>&1 | grep 'exceeds max cpus' > /dev/null MAX_SMP=\`expr \$MAX_SMP - 1\` done -cmdline="\`echo '$cmdline' | sed s%$kernel%\$bin%\`" +cmdline='$cmdline' +EOF +if [ "$FIRMWARE" ]; then + cat <> $standalone +cmdline="\`echo \$cmdline | sed s%$FIRMWARE%\$fwbin%\`" +EOF +fi + cat <> $standalone +cmdline="\`echo \$cmdline | sed s%$kernel%\$bin%\`" echo \$qemu $cmdline -smp $smp $opts -\$qemu \$cmdline -smp $smp $opts +\$qemu \$cmdline -smp $smp $opts $snooper ret=\$? echo Return value from qemu: \$ret if [ \$ret -le 1 ]; then @@ -111,7 +153,7 @@ if [ \$ret -le 1 ]; then else echo FAIL $testname 1>&2 fi -rm -f \$bin +rm -f \$fwbin \$bin exit 0 EOF fi -- 2.4.3