1#!/usr/bin/env 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 9 source scripts/arch-run.bash 10fi 11 12if [ -c /dev/kvm ]; then 13 if [ "$HOST" = "ppc64" ] && [ "$ARCH" = "ppc64" ]; then 14 kvm_available=yes 15 fi 16fi 17 18if [ "$ACCEL" = "kvm" ] && [ "$kvm_available" != "yes" ]; then 19 echo "KVM is needed, but not available on this host" 20 exit 2 21fi 22 23if [ -z "$ACCEL" ]; then 24 if [ "$kvm_available" = "yes" ]; then 25 ACCEL="kvm" 26 else 27 ACCEL="tcg" 28 fi 29fi 30 31qemu=$(search_qemu_binary) 32 33if ! $qemu -machine '?' 2>&1 | grep 'pseries' > /dev/null; then 34 echo "$qemu doesn't support pSeries ('-machine pseries'). Exiting." 35 exit 2 36fi 37 38M='-machine pseries' 39M+=",accel=$ACCEL" 40command="$qemu -nodefaults $M -bios $FIRMWARE" 41command+=" -display none -serial stdio -kernel" 42command="$(migration_cmd) $(timeout_cmd) $command" 43 44# powerpc tests currently exit with rtas-poweroff, which exits with 0. 45# run_qemu treats that as a failure exit and returns 1, so we need 46# to fixup the fixup below by parsing the true exit code from the output. 47# The second fixup is also a FIXME, because once we add chr-testdev 48# support for powerpc, we won't need the second fixup. 49run_qemu_status $command "$@" 50