Signed-off-by: Ryan Harper <ry...@us.ibm.com> --- qemu-test | 62 ++++++++++++++++++++++++++++++------------------------------ 1 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/qemu-test b/qemu-test index 71c1ba1..445ca6d 100755 --- a/qemu-test +++ b/qemu-test @@ -29,9 +29,9 @@ if ! which qmp >/dev/null 2>/dev/null; then qmp="${QEMU_SRC}/QMP/qmp" if ! test -x "${qmp}"; then - echo "Please set QEMU_SRC to set to a recent qemu.git tree" + echo "Please set QEMU_SRC to set to a recent qemu.git tree" cleanup - exit 1 + exit 1 fi else qmp=`which qmp | head -1` @@ -74,13 +74,13 @@ qmp() { qmp_pid=$! count=0 while checkpid $qmp_pid; do - sleep 1 - count=$(($count + 1)) - if test $count -gt $QMP_TIMEOUT; then - echo $count, $QMP_TIMEOUT - kill -9 $qmp_pid - return 1 - fi + sleep 1 + count=$(($count + 1)) + if test $count -gt $QMP_TIMEOUT; then + echo $count, $QMP_TIMEOUT + kill -9 $qmp_pid + return 1 + fi done return 0 } @@ -104,11 +104,11 @@ choose() { target=$(($RANDOM % $#)) count=0 for i in "$@"; do - if test $count = $target; then - echo $i - return 0 - fi - count=$(($count + 1)) + if test $count = $target; then + echo $i + return 0 + fi + count=$(($count + 1)) done # not supposed to happen... @@ -117,7 +117,7 @@ choose() { choose_bool() { if test `choose yes no` = "yes"; then - return 0 + return 0 fi return 1 } @@ -135,34 +135,34 @@ start_qemu() { qemu_is_okay() { # it's stopped, that's not necessarly bad if ! checkpid $pid; then - return 1 + return 1 fi log_size=`get_file_size $tmplog` if test $last_log_size = $log_size; then - freeze_count=$(($freeze_count + 1)) + freeze_count=$(($freeze_count + 1)) else - freeze_count=0 - last_log_size=$log_size + freeze_count=0 + last_log_size=$log_size fi if test $freeze_count -gt $FREEZE_THRESHOLD && checkpid $pid; then - qemu_pid=`cat $tmppid` - kill -9 $qemu_pid - echo "Guest ($qemu_pid) has not had output in $FREEZE_THRESHOLD seconds!" - return 2 + qemu_pid=`cat $tmppid` + kill -9 $qemu_pid + echo "Guest ($qemu_pid) has not had output in $FREEZE_THRESHOLD seconds!" + return 2 fi if ! qmp query-status >/dev/null 2>/dev/null && checkpid $pid; then - qemu_pid=`cat $tmppid` - - kill -9 $qemu_pid - echo "QEMU is hung!" - return 3 + qemu_pid=`cat $tmppid` + + kill -9 $qemu_pid + echo "QEMU is hung!" + return 3 fi # it's stopped, that's not necessarly bad if ! checkpid $pid; then - return 1 + return 1 fi } @@ -170,7 +170,7 @@ get_qemu_status() { wait $pid rc=`cat $tmprc` if test $(($rc & 1)) = 1; then - rc=$(($rc / 2)) + rc=$(($rc / 2)) fi return $rc } @@ -179,7 +179,7 @@ qemu() { start_qemu "$@" while qemu_is_okay; do - sleep 1 + sleep 1 done get_qemu_status -- 1.7.6