1#!/bin/bash 2 3if [ -z "$STANDALONE" ]; then 4 if [ ! -f config.mak ]; then 5 echo "run ./configure && make first. See ./configure -h" 6 exit 2 7 fi 8 source config.mak 9fi 10 11if [ -c /dev/kvm ]; then 12 if [ "$HOST" = "ppc64" ] && [ "$ARCH" = "ppc64" ]; then 13 kvm_available=yes 14 fi 15fi 16 17if [ "$ACCEL" = "kvm" ] && [ "$kvm_available" != "yes" ]; then 18 echo "skip $TESTNAME (kvm only)" 19 exit 2 20fi 21 22if [ -z "$ACCEL" ]; then 23 if [ "$kvm_available" = "yes" ]; then 24 ACCEL="kvm" 25 else 26 ACCEL="tcg" 27 fi 28fi 29 30qemu="${QEMU:-qemu-system-$ARCH_NAME}" 31qpath=$(which $qemu 2>/dev/null) 32 33if [ -z "$qpath" ]; then 34 echo $qemu not found. 35 exit 2 36fi 37 38if ! $qemu -machine '?' 2>&1 | grep 'pseries' > /dev/null; then 39 echo "$qpath doesn't support pSeries ('-machine pseries'). Exiting." 40 exit 2 41fi 42 43M='-machine pseries' 44M+=",accel=$ACCEL" 45command="$qemu $M -bios $FIRMWARE" 46command+=" -display none -serial stdio -kernel" 47echo $command "$@" 48 49#FIXME: rtas-poweroff always exits with zero, so we have to parse 50# the true exit code from the output. 51lines=$($command "$@") 52echo "$lines" 53ret=$(grep '^EXIT: ' <<<"$lines" | sed 's/.*STATUS=\([0-9][0-9]*\).*/\1/') 54echo Return value from qemu: $ret 55exit $ret 56