* [PATCH kvm-unit-tests 0/2] A couple runtime fixes
@ 2020-04-04 15:47 Andrew Jones
2020-04-04 15:47 ` [PATCH kvm-unit-tests 1/2] run_migration: Implement our own wait Andrew Jones
2020-04-04 15:47 ` [PATCH kvm-unit-tests 2/2] runtime: Always honor the unittests.cfg accel requirement Andrew Jones
0 siblings, 2 replies; 4+ messages in thread
From: Andrew Jones @ 2020-04-04 15:47 UTC (permalink / raw)
To: kvm; +Cc: lvivier, thuth, david, frankja, pbonzini
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(-)
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH kvm-unit-tests 1/2] run_migration: Implement our own wait
2020-04-04 15:47 [PATCH kvm-unit-tests 0/2] A couple runtime fixes Andrew Jones
@ 2020-04-04 15:47 ` Andrew Jones
2020-04-07 15:36 ` Paolo Bonzini
2020-04-04 15:47 ` [PATCH kvm-unit-tests 2/2] runtime: Always honor the unittests.cfg accel requirement Andrew Jones
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Jones @ 2020-04-04 15:47 UTC (permalink / raw)
To: kvm; +Cc: lvivier, thuth, david, frankja, pbonzini
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@redhat.com>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH kvm-unit-tests 2/2] runtime: Always honor the unittests.cfg accel requirement
2020-04-04 15:47 [PATCH kvm-unit-tests 0/2] A couple runtime fixes Andrew Jones
2020-04-04 15:47 ` [PATCH kvm-unit-tests 1/2] run_migration: Implement our own wait Andrew Jones
@ 2020-04-04 15:47 ` Andrew Jones
1 sibling, 0 replies; 4+ messages in thread
From: Andrew Jones @ 2020-04-04 15:47 UTC (permalink / raw)
To: kvm; +Cc: lvivier, thuth, david, frankja, pbonzini
If the unittests.cfg file specifies an accel parameter then don't
let the user override it.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
scripts/runtime.bash | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index eb6089091e23..8bfe31cb9f66 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -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>
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH kvm-unit-tests 1/2] run_migration: Implement our own wait
2020-04-04 15:47 ` [PATCH kvm-unit-tests 1/2] run_migration: Implement our own wait Andrew Jones
@ 2020-04-07 15:36 ` Paolo Bonzini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2020-04-07 15:36 UTC (permalink / raw)
To: Andrew Jones, kvm; +Cc: lvivier, thuth, david, frankja
On 04/04/20 17:47, Andrew Jones wrote:
> 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@redhat.com>
> ---
> 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
> }
>
>
Ouch. Queued both, thanks.
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-07 15:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-04 15:47 [PATCH kvm-unit-tests 0/2] A couple runtime fixes Andrew Jones
2020-04-04 15:47 ` [PATCH kvm-unit-tests 1/2] run_migration: Implement our own wait Andrew Jones
2020-04-07 15:36 ` Paolo Bonzini
2020-04-04 15:47 ` [PATCH kvm-unit-tests 2/2] runtime: Always honor the unittests.cfg accel requirement Andrew Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).