* [PATCH] iotests/common.pattern: Quote echos
@ 2020-04-03 10:11 Max Reitz
2020-04-03 10:20 ` Philippe Mathieu-Daudé
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Max Reitz @ 2020-04-03 10:11 UTC (permalink / raw)
To: qemu-block; +Cc: Kevin Wolf, qemu-devel, Max Reitz
From time to time, my shell decides to repace the bracketed numbers here
by the numbers inside (i.e., "=== Clusters to be compressed [1]" is
printed as "=== Clusters to be compressed 1"). That makes tests that
use common.pattern fail. Prevent that from happening by quoting the
arguments to all echos in common.pattern.
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
tests/qemu-iotests/common.pattern | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/tests/qemu-iotests/common.pattern b/tests/qemu-iotests/common.pattern
index 4f5e5bcea0..4caa5de187 100644
--- a/tests/qemu-iotests/common.pattern
+++ b/tests/qemu-iotests/common.pattern
@@ -23,7 +23,7 @@ do_is_allocated() {
local count=$4
for ((i=1;i<=$count;i++)); do
- echo alloc $(( start + (i - 1) * step )) $size
+ echo "alloc $(( start + (i - 1) * step )) $size"
done
}
@@ -39,9 +39,9 @@ do_io() {
local count=$5
local pattern=$6
- echo === IO: pattern $pattern >&2
+ echo "=== IO: pattern $pattern" >&2
for ((i=1;i<=$count;i++)); do
- echo $op -P $pattern $(( start + (i - 1) * step )) $size
+ echo "$op -P $pattern $(( start + (i - 1) * step )) $size"
done
}
@@ -110,31 +110,31 @@ io_test2() {
# free - free - compressed
# Write the clusters to be compressed
- echo === Clusters to be compressed [1]
+ echo '=== Clusters to be compressed [1]'
io_pattern writev $((offset + 4 * $cluster_size)) $cluster_size $((9 * $cluster_size)) $num 165
- echo === Clusters to be compressed [2]
+ echo '=== Clusters to be compressed [2]'
io_pattern writev $((offset + 5 * $cluster_size)) $cluster_size $((9 * $cluster_size)) $num 165
- echo === Clusters to be compressed [3]
+ echo '=== Clusters to be compressed [3]'
io_pattern writev $((offset + 8 * $cluster_size)) $cluster_size $((9 * $cluster_size)) $num 165
mv "$TEST_IMG" "$TEST_IMG.orig"
$QEMU_IMG convert -f $IMGFMT -O $IMGFMT -c "$TEST_IMG.orig" "$TEST_IMG"
# Write the used clusters
- echo === Used clusters [1]
+ echo '=== Used clusters [1]'
io_pattern writev $((offset + 0 * $cluster_size)) $cluster_size $((9 * $cluster_size)) $num 165
- echo === Used clusters [2]
+ echo '=== Used clusters [2]'
io_pattern writev $((offset + 1 * $cluster_size)) $cluster_size $((9 * $cluster_size)) $num 165
- echo === Used clusters [3]
+ echo '=== Used clusters [3]'
io_pattern writev $((offset + 3 * $cluster_size)) $cluster_size $((9 * $cluster_size)) $num 165
# Read them
- echo === Read used/compressed clusters
+ echo '=== Read used/compressed clusters'
io_pattern readv $((offset + 0 * $cluster_size)) $((2 * $cluster_size)) $((9 * $cluster_size)) $num 165
io_pattern readv $((offset + 3 * $cluster_size)) $((3 * $cluster_size)) $((9 * $cluster_size)) $num 165
io_pattern readv $((offset + 8 * $cluster_size)) $((1 * $cluster_size)) $((9 * $cluster_size)) $num 165
- echo === Read zeros
+ echo '=== Read zeros'
io_zero readv $((offset + 2 * $cluster_size)) $((1 * $cluster_size)) $((9 * $cluster_size)) $num
io_zero readv $((offset + 6 * $cluster_size)) $((2 * $cluster_size)) $((9 * $cluster_size)) $num
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] iotests/common.pattern: Quote echos
2020-04-03 10:11 [PATCH] iotests/common.pattern: Quote echos Max Reitz
@ 2020-04-03 10:20 ` Philippe Mathieu-Daudé
2020-04-03 13:39 ` Eric Blake
2020-04-07 8:59 ` Max Reitz
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-03 10:20 UTC (permalink / raw)
To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel
On 4/3/20 12:11 PM, Max Reitz wrote:
> From time to time, my shell decides to repace the bracketed numbers here
> by the numbers inside (i.e., "=== Clusters to be compressed [1]" is
> printed as "=== Clusters to be compressed 1"). That makes tests that
> use common.pattern fail. Prevent that from happening by quoting the
> arguments to all echos in common.pattern.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> tests/qemu-iotests/common.pattern | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/tests/qemu-iotests/common.pattern b/tests/qemu-iotests/common.pattern
> index 4f5e5bcea0..4caa5de187 100644
> --- a/tests/qemu-iotests/common.pattern
> +++ b/tests/qemu-iotests/common.pattern
> @@ -23,7 +23,7 @@ do_is_allocated() {
> local count=$4
>
> for ((i=1;i<=$count;i++)); do
> - echo alloc $(( start + (i - 1) * step )) $size
> + echo "alloc $(( start + (i - 1) * step )) $size"
> done
> }
>
> @@ -39,9 +39,9 @@ do_io() {
> local count=$5
> local pattern=$6
>
> - echo === IO: pattern $pattern >&2
> + echo "=== IO: pattern $pattern" >&2
> for ((i=1;i<=$count;i++)); do
> - echo $op -P $pattern $(( start + (i - 1) * step )) $size
> + echo "$op -P $pattern $(( start + (i - 1) * step )) $size"
> done
> }
>
> @@ -110,31 +110,31 @@ io_test2() {
> # free - free - compressed
>
> # Write the clusters to be compressed
> - echo === Clusters to be compressed [1]
> + echo '=== Clusters to be compressed [1]'
> io_pattern writev $((offset + 4 * $cluster_size)) $cluster_size $((9 * $cluster_size)) $num 165
> - echo === Clusters to be compressed [2]
> + echo '=== Clusters to be compressed [2]'
> io_pattern writev $((offset + 5 * $cluster_size)) $cluster_size $((9 * $cluster_size)) $num 165
> - echo === Clusters to be compressed [3]
> + echo '=== Clusters to be compressed [3]'
> io_pattern writev $((offset + 8 * $cluster_size)) $cluster_size $((9 * $cluster_size)) $num 165
>
> mv "$TEST_IMG" "$TEST_IMG.orig"
> $QEMU_IMG convert -f $IMGFMT -O $IMGFMT -c "$TEST_IMG.orig" "$TEST_IMG"
>
> # Write the used clusters
> - echo === Used clusters [1]
> + echo '=== Used clusters [1]'
> io_pattern writev $((offset + 0 * $cluster_size)) $cluster_size $((9 * $cluster_size)) $num 165
> - echo === Used clusters [2]
> + echo '=== Used clusters [2]'
> io_pattern writev $((offset + 1 * $cluster_size)) $cluster_size $((9 * $cluster_size)) $num 165
> - echo === Used clusters [3]
> + echo '=== Used clusters [3]'
> io_pattern writev $((offset + 3 * $cluster_size)) $cluster_size $((9 * $cluster_size)) $num 165
>
> # Read them
> - echo === Read used/compressed clusters
> + echo '=== Read used/compressed clusters'
> io_pattern readv $((offset + 0 * $cluster_size)) $((2 * $cluster_size)) $((9 * $cluster_size)) $num 165
> io_pattern readv $((offset + 3 * $cluster_size)) $((3 * $cluster_size)) $((9 * $cluster_size)) $num 165
> io_pattern readv $((offset + 8 * $cluster_size)) $((1 * $cluster_size)) $((9 * $cluster_size)) $num 165
>
> - echo === Read zeros
> + echo '=== Read zeros'
> io_zero readv $((offset + 2 * $cluster_size)) $((1 * $cluster_size)) $((9 * $cluster_size)) $num
> io_zero readv $((offset + 6 * $cluster_size)) $((2 * $cluster_size)) $((9 * $cluster_size)) $num
> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iotests/common.pattern: Quote echos
2020-04-03 10:11 [PATCH] iotests/common.pattern: Quote echos Max Reitz
2020-04-03 10:20 ` Philippe Mathieu-Daudé
@ 2020-04-03 13:39 ` Eric Blake
2020-04-07 8:59 ` Max Reitz
2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2020-04-03 13:39 UTC (permalink / raw)
To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel
On 4/3/20 5:11 AM, Max Reitz wrote:
>>From time to time, my shell decides to repace the bracketed numbers here
> by the numbers inside (i.e., "=== Clusters to be compressed [1]" is
> printed as "=== Clusters to be compressed 1"). That makes tests that
Namely, any time your environment has a file named '1' in the directory
where you are running iotests.
> use common.pattern fail. Prevent that from happening by quoting the
> arguments to all echos in common.pattern.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> tests/qemu-iotests/common.pattern | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/tests/qemu-iotests/common.pattern b/tests/qemu-iotests/common.pattern
> index 4f5e5bcea0..4caa5de187 100644
> --- a/tests/qemu-iotests/common.pattern
> +++ b/tests/qemu-iotests/common.pattern
> @@ -23,7 +23,7 @@ do_is_allocated() {
> local count=$4
>
> for ((i=1;i<=$count;i++)); do
> - echo alloc $(( start + (i - 1) * step )) $size
> + echo "alloc $(( start + (i - 1) * step )) $size"
No real change on this line because $size is safe, but also no harm at
being consistent, and makes it easier to not have to audit $size for
being safe.
> # Write the clusters to be compressed
> - echo === Clusters to be compressed [1]
> + echo '=== Clusters to be compressed [1]'
This one is definitely needed to avoid inadvertent globbing.
> # Read them
> - echo === Read used/compressed clusters
> + echo '=== Read used/compressed clusters'
And this one does not buy any safety, but again consistency doesn't hurt.
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iotests/common.pattern: Quote echos
2020-04-03 10:11 [PATCH] iotests/common.pattern: Quote echos Max Reitz
2020-04-03 10:20 ` Philippe Mathieu-Daudé
2020-04-03 13:39 ` Eric Blake
@ 2020-04-07 8:59 ` Max Reitz
2 siblings, 0 replies; 4+ messages in thread
From: Max Reitz @ 2020-04-07 8:59 UTC (permalink / raw)
To: qemu-block; +Cc: Kevin Wolf, qemu-devel
[-- Attachment #1.1: Type: text/plain, Size: 617 bytes --]
On 03.04.20 12:11, Max Reitz wrote:
> From time to time, my shell decides to repace the bracketed numbers here
> by the numbers inside (i.e., "=== Clusters to be compressed [1]" is
> printed as "=== Clusters to be compressed 1"). That makes tests that
> use common.pattern fail. Prevent that from happening by quoting the
> arguments to all echos in common.pattern.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> tests/qemu-iotests/common.pattern | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
Thanks for the reviews, applied to my block branch.
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-07 9:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-03 10:11 [PATCH] iotests/common.pattern: Quote echos Max Reitz
2020-04-03 10:20 ` Philippe Mathieu-Daudé
2020-04-03 13:39 ` Eric Blake
2020-04-07 8:59 ` Max Reitz
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).