1#!/usr/bin/env bash 2 3get_qemu_machine () 4{ 5 if [ "$MACHINE" ]; then 6 echo $MACHINE 7 else 8 echo pseries 9 fi 10} 11 12if [ -z "$KUT_STANDALONE" ]; then 13 if [ ! -f config.mak ]; then 14 echo "run ./configure && make first. See ./configure -h" 15 exit 2 16 fi 17 source config.mak 18 source scripts/arch-run.bash 19 source scripts/vmm.bash 20fi 21 22set_qemu_accelerator || exit $? 23 24MACHINE=$(get_qemu_machine) || 25 exit $? 26 27if [[ "$MACHINE" == "powernv"* ]] && [ "$ACCEL" = "kvm" ]; then 28 echo "PowerNV machine does not support KVM. ACCEL=tcg must be specified." 29 exit 2 30fi 31 32qemu=$(search_qemu_binary) || 33 exit $? 34 35if ! $qemu -machine '?' 2>&1 | grep $MACHINE > /dev/null; then 36 echo "$qemu doesn't support '-machine $MACHINE'. Exiting." 37 exit 2 38fi 39 40A="-accel $ACCEL$ACCEL_PROPS" 41M="-machine $MACHINE" 42B="" 43D="" 44 45if [[ "$MACHINE" == "pseries"* ]] ; then 46 if [[ "$ACCEL" == "tcg" ]] ; then 47 M+=",cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken,cap-ccf-assist=off" 48 elif [[ "$ACCEL" == "kvm" ]] ; then 49 M+=",cap-ccf-assist=off" 50 fi 51 B+="-bios $FIRMWARE" 52fi 53 54if [[ "$MACHINE" == "powernv"* ]] ; then 55 D+="-device ipmi-bmc-sim,id=bmc0 -device isa-ipmi-bt,bmc=bmc0,irq=10" 56fi 57 58command="$qemu -nodefaults $A $M $B $D" 59command+=" -display none -serial stdio -kernel" 60command="$(migration_cmd) $(timeout_cmd) $command" 61 62# powerpc tests currently exit with rtas-poweroff, which exits with 0. 63# run_test treats that as a failure exit and returns 1, so we need 64# to fixup the fixup below by parsing the true exit code from the output. 65# The second fixup is also a FIXME, because once we add chr-testdev 66# support for powerpc, we won't need the second fixup. 67run_test_status $command "$@" 68