@@ -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
@@ -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
@@ -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 <<EOF >> $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 <<EOF >> $standalone
ARCH=\`uname -m | sed -e s/i.86/i386/ | sed -e 's/arm.*/arm/'\`
@@ -82,7 +102,21 @@ exit 1
EOF
else
cat <<EOF >> $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 <<EOF >> $standalone
+fwbin=\`mktemp\`
+base64 -d << 'BIN_EOF' | zcat > \$fwbin &&
+EOF
+gzip - < $FIRMWARE | base64 >> $standalone
+ cat <<EOF >> $standalone
+BIN_EOF
+
+EOF
+fi
+ cat <<EOF >> $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 <<EOF >> $standalone
+cmdline="\`echo \$cmdline | sed s%$FIRMWARE%\$fwbin%\`"
+EOF
+fi
+ cat <<EOF >> $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
PowerPC needs firmware and an exit code snooper. Signed-off-by: Andrew Jones <drjones@redhat.com> --- configure | 3 +++ powerpc/run | 2 +- scripts/mkstandalone.sh | 50 +++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 50 insertions(+), 5 deletions(-)