@@ -29,5 +29,9 @@ void puts(const char *s)
void exit(int code)
{
+// FIXME: change this print-exit/rtas-poweroff to chr_testdev_exit(),
+// maybe by plugging chr-testdev into a spapr-vty.
+ printf("\nEXIT: STATUS=%d\n", ((code) << 1) | 1);
+ rtas_power_off();
halt(code);
}
@@ -46,7 +46,10 @@ command="$qemu $M -bios $FIRMWARE"
command+=" -display none -serial stdio -kernel"
echo $command "$@"
-$command "$@"
-ret=$?
+#FIXME: rtas-poweroff always exits with zero, so we have to parse
+# the true exit code from the output.
+lines=$($command "$@")
+echo "$lines"
+ret=$(grep '^EXIT: ' <<<"$lines" | sed 's/.*STATUS=\([0-9][0-9]*\).*/\1/')
echo Return value from qemu: $ret
exit $ret