@@ -71,12 +71,9 @@ if $qemu $M -device '?' 2>&1 | grep pci-testdev > /dev/null; then
pci_testdev="-device pci-testdev"
fi
-initrd_create
-
M+=",accel=$ACCEL"
command="$qemu -nodefaults $M -cpu $processor $chr_testdev $pci_testdev"
-command+=" -display none -serial stdio $INITRD -kernel"
+command+=" -display none -serial stdio -kernel"
command="$(timeout_cmd) $command"
-echo $command "$@"
run_qemu $command "$@"
@@ -35,14 +35,11 @@ if ! $qemu -machine '?' 2>&1 | grep 'pseries' > /dev/null; then
exit 2
fi
-initrd_create
-
M='-machine pseries'
M+=",accel=$ACCEL"
command="$qemu -nodefaults $M -bios $FIRMWARE"
-command+=" -display none -serial stdio $INITRD -kernel"
+command+=" -display none -serial stdio -kernel"
command="$(migration_cmd) $(timeout_cmd) $command"
-echo $command "$@"
# powerpc tests currently exit with rtas-poweroff, which exits with 0.
# run_qemu treats that as a failure exit and returns 1, so we need
@@ -34,10 +34,8 @@ M='-machine s390-ccw-virtio'
M+=",accel=$ACCEL"
command="$qemu -nodefaults -nographic $M"
command+=" -chardev stdio,id=con0 -device sclpconsole,chardev=con0"
-[ -f "$ENV" ] && command+=" -initrd $ENV"
command+=" -kernel"
command="$(timeout_cmd) $command"
-echo $command "$@"
# We return the exit code via stdout, not via the QEMU return code
lines=$(run_qemu $command "$@")
@@ -28,9 +28,14 @@ run_qemu ()
{
local stdout errors ret sig
+ echo -n $@
+ initrd_create &&
+ echo -n " #"
+ echo " $INITRD"
+
# stdout to {stdout}, stderr to $errors and stderr
exec {stdout}>&1
- errors=$("${@}" </dev/null 2> >(tee /dev/stderr) > /dev/fd/$stdout)
+ errors=$("${@}" $INITRD </dev/null 2> >(tee /dev/stderr) > /dev/fd/$stdout)
ret=$?
exec {stdout}>&-
@@ -158,14 +163,20 @@ search_qemu_binary ()
initrd_create ()
{
+ local ret
+
env_add_errata
+ ret=$?
+
unset INITRD
[ -f "$ENV" ] && INITRD="-initrd $ENV"
+
+ return $ret
}
env_add_errata ()
{
- local line errata
+ local line errata ret=1
if [ -f "$ENV" ] && grep -q '^ERRATA_' <(env); then
for line in $(grep '^ERRATA_' "$ENV"); do
@@ -183,7 +194,10 @@ env_add_errata ()
trap_exit_push 'rm -f $ENV; [ "$ENV_OLD" ] && export ENV="$ENV_OLD" || unset ENV; unset ENV_OLD'
[ -f "$ENV_OLD" ] && grep -v '^ERRATA_' "$ENV_OLD" > $ENV
grep '^ERRATA_' <(env) >> $ENV
+ ret=0
fi
+
+ return $ret
}
env_generate_errata ()
@@ -33,11 +33,8 @@ else
pc_testdev="-device testdev,chardev=testlog -chardev file,id=testlog,path=msr.out"
fi
-initrd_create
-
command="${qemu} -nodefaults -enable-kvm $pc_testdev -vnc none -serial stdio $pci_testdev $hyperv_testdev"
-command+=" $INITRD -kernel"
+command+=" -kernel"
command="$(timeout_cmd) $command"
-echo ${command} "$@"
run_qemu ${command} "$@"
The major annoyance coming from errata was "-initrd `mktemp`" that had to be removed before running the copy-pasted command line. Move "-initrd ..." part at the end of the line and hide it behind "#" if the initird file is a temporary one. This patch also brings s390 to use the same code as other architectures and eliminates code duplication. Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> --- Adding the arch/run command line might also be worth it (i.e. adding echo $0 $@ to arch/run). --- arm/run | 5 +---- powerpc/run | 5 +---- s390x/run | 2 -- scripts/arch-run.bash | 18 ++++++++++++++++-- x86/run | 5 +---- 5 files changed, 19 insertions(+), 16 deletions(-)