A couple runtime fixes
cover A couple runtime fixes
While testing the recent arm pull request I stumbled on to a couple issues with the runtime scripts.
Andrew Jones (2):
run_migration: Implement our own wait
runtime: Always honor the unittests.cfg accel requirement
scripts/arch-run.bash | 6 +++++- scripts/runtime.bash | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/2 run_migration: Implement our own wait
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.
--- scripts/arch-run.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/arch-run.bash +5 -1
@@ -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 }
Signature · 1 line
2.25.1
Paolo Bonzini
maintainerRe: [PATCH kvm-unit-tests 1/2] run_migration: Implement our own wait
Quoted 28 lines · Andrew Jones
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 <[email protected]>--- scripts/arch-run.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)scripts/arch-run.bash +0
-0@@ -156,7 +156,11 @@ run_migration () echo > ${fifo} wait $incoming_pid
scripts/arch-run.bash run_migration () · line 166
Quoted 10 lines
scripts/arch-run.bash +5
-1ret=$? - wait + + while (( $(jobs -r | wc -l) > 0 )); do + sleep 0.5 + done + return $ret }
Ouch. Queued both, thanks.
Paolo
PATCH 2/2 runtime: Always honor the unittests.cfg accel requirement
In reply to Andrew JonesIf the unittests.cfg file specifies an accel parameter then don't let the user override it.
--- scripts/runtime.bash | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
scripts/runtime.bash +8 -1
@@ -77,7 +77,7 @@ function run() local opts="$5" local arch="$6" local check="${CHECK:-$7}" - local accel="${ACCEL:-$8}" + local accel="$8" local timeout="${9:-$TIMEOUT}" # unittests.cfg overrides the default if [ -z "$testname" ]; then
@@ -103,6 +103,13 @@ function run() return 2 fi + if [ -n "$accel" ] && [ -n "$ACCEL" ] && [ "$accel" != "$ACCEL" ]; then + print_result "SKIP" $testname "" "$accel only, but ACCEL=$ACCEL" + return 2 + elif [ -n "$ACCEL" ]; then + accel="$ACCEL" + fi + # check a file for a particular value before running a test # the check line can contain multiple files to check separated by a space # but each check parameter needs to be of the form <path>=<value>
Signature · 1 line
2.25.1