[PATCH kvm-unit-tests 1/2] run_migration: Implement our own wait

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

 



Bash 5.0 changed 'wait' with no arguments to also wait for all
process substitutions. For example, with Bash 4.4 this completes,
after waiting for the sleep

  (
    sleep 1 &
    wait
  ) > >(tee /dev/null)

but with Bash 5.0 it does not. The kvm-unit-tests (overly) complex
bash scripts have a 'run_migration ... 2> >(tee /dev/stderr)'
where the '2> >(tee /dev/stderr)' comes from 'run_qemu'. Since
'run_migration' calls 'wait' it will never complete with Bash 5.0.
Resolve by implementing our own wait; just a loop on job count.

Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
---
 scripts/arch-run.bash | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
index d3ca19d49952..da1a9d7871e5 100644
--- a/scripts/arch-run.bash
+++ b/scripts/arch-run.bash
@@ -156,7 +156,11 @@ run_migration ()
 	echo > ${fifo}
 	wait $incoming_pid
 	ret=$?
-	wait
+
+	while (( $(jobs -r | wc -l) > 0 )); do
+		sleep 0.5
+	done
+
 	return $ret
 }
 
-- 
2.25.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