
On 7/31/19 4:58 PM, Daniel Henrique Barboza wrote:
There is a chance that the current sed filtering used in these new tests might fail in some machines due to the repetition of the 'virsh #' prompt at the same line, together with valid output that shouldn't be filtered.
Ah, so it is a data race where the prompts produced by virsh don't always flush in relation to other data being output.
There are 3 valid lines missing. This is the unfiltered output:
=== out === Welcome to lt-virsh, the virtualization interactive terminal.
Type: 'help' for help with commands 'quit' to quit
virsh # virsh # virsh # virsh # virsh # Domain snapshot s3 created from 's3.xml' virsh # Domain snapshot s2 created from 's2.xml' virsh # Name: s2
This patch makes the 'sed' filtering less elegant and more crude than the current version, but more reliable to these outputs that may vary from each dev machine. We're also removing the blank lines in the expected output to make it less prone to errors as well.
Yes, eating all blank lines and just the prompt sub-string rather than the entire line with a prompt is a nice fix, and safe for freeze.
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> ---
Eric, feel free to accept this patch, tweak it, discard it and try something else or whatever. I was going to send the commit msg as a reply to your query in the ML, then realized that I might as well propose a fix for it.
ACK.
EOF -sed '1,/^virsh #/d; /virsh #/d' < out > out.cooked || fail=1 +sed '1,/^virsh #/d; s/virsh #\s//g; /^$/d' < out > out.cooked || fail=1
So this is now: delete the welcome message up to the first prompt, then remove all prompts and blank lines.
compare exp out.cooked || fail=1
cat <<EOF > exp || fail=1 diff --git a/tests/virsh-snapshot b/tests/virsh-snapshot index 20ff966a51..874093ea3c 100755 --- a/tests/virsh-snapshot +++ b/tests/virsh-snapshot @@ -201,9 +201,8 @@ $abs_top_builddir/tools/virsh -c test:///default >out 2>err <<EOF || fail=1 snapshot-info test --current EOF
-cat <<\EOF > exp || fail=1 -
+cat <<\EOF > exp || fail=1
Looks like you actually added a blank line between the previous EOF and the cat. Easy enough to tweak; I'll push this soon. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org