[kvm-unit-tests PATCH] arch-run: fix test skips when /dev/stderr does not point to /proc/self/fd/2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In configurations where /dev/stderr does not link to /proc/self/fd/2,
run_qemu in arch-run.bash leaks the stderr of the invoked qemu command
to /dev/stderr, instead of it being captured to the log variable in
premature_failure in runtime.bash.

This causes all tests to be skipped since the output required for the
grep command in that function to indicate success is never present.

As a possible fix, this patch gives stderr the same treatment as stdout
in run_qemu, producing a dedicated file descriptor and handing it into
the subshell.

Signed-off-by: Andreas Grapentin <gra@xxxxxxxxxxxxx>
---
 scripts/arch-run.bash | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
index 2e4820c2..362aa1c5 100644
--- a/scripts/arch-run.bash
+++ b/scripts/arch-run.bash
@@ -33,11 +33,13 @@ run_qemu ()
 	[ "$ENVIRON_DEFAULT" = "yes" ] && echo -n " #"
 	echo " $INITRD"
 
-	# stdout to {stdout}, stderr to $errors and stderr
+	# stdout to {stdout}, stderr to $errors and {stderr}
 	exec {stdout}>&1
-	errors=$("${@}" $INITRD </dev/null 2> >(tee /dev/stderr) > /dev/fd/$stdout)
+	exec {stderr}>&2
+	errors=$("${@}" $INITRD </dev/null 2> >(tee /dev/fd/$stderr) > /dev/fd/$stdout)
 	ret=$?
 	exec {stdout}>&-
+	exec {stderr}>&-
 
 	[ $ret -eq 134 ] && echo "QEMU Aborted" >&2
 
-- 
2.48.1





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux