* [PATCH] iotests: Fix test 104 under NBD
@ 2023-05-19 15:02 Eric Blake
2023-05-19 15:19 ` Daniel P. Berrangé
0 siblings, 1 reply; 2+ messages in thread
From: Eric Blake @ 2023-05-19 15:02 UTC (permalink / raw)
To: qemu-devel; +Cc: berrange, hreitz, thuth, qemu-block, Kevin Wolf
In the past, commit a231cb27 ("iotests: Fix 104 for NBD", v2.3.0)
added an additional filter to _filter_img_info to rewrite NBD URIs
into the expected output form. This recently broke when we tweaked
tests to run in a per-format directory, which did not match the regex,
because _img_info itself is now already changing
SOCK_DIR=/tmp/tmpphjfbphd/raw-nbd-104 into
/tmp/tmpphjfbphd/IMGFMT-nbd-104 prior to _img_info_filter getting a
chance to further filter things.
While diagnosing the problem, I also noticed some filter lines
rendered completely useless by a typo when we switched from TCP to
Unix sockets for NBD (in shell, '\\+' is different from "\\+" (one
gives two backslash to the regex, matching the literal 2-byte sequence
<\+> after a single digit; the other gives one backslash to the regex,
as the metacharacter \+ to match one or more of <[0-9]>); since the
literal string <nbd://127.0.0.1:0\+> is not a valid URI, that regex
hasn't been matching anything for years so it is fine to just drop it
rather than fix the typo.
Fixes: f3923a72 ("iotests: Switch nbd tests to use Unix rather than TCP", v4.2.0)
Fixes: 5ba7db09 ("iotests: always use a unique sub-directory per test", v8.0.0)
Signed-off-by: Eric Blake <eblake@redhat.com>
---
tests/qemu-iotests/common.filter | 4 +---
tests/qemu-iotests/common.rc | 3 ++-
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index 6b32c7fbfa1..fc3c64bcb8e 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
-# Copyright (C) 2009 Red Hat, Inc.
+# Copyright Red Hat
# Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
@@ -131,7 +131,6 @@ _filter_img_create_filenames()
-e "s#$SOCK_DIR#SOCK_DIR#g" \
-e 's#SOCK_DIR/fuse-#TEST_DIR/#g' \
-e "s#$IMGFMT#IMGFMT#g" \
- -e 's#nbd:127.0.0.1:[0-9]\\+#TEST_DIR/t.IMGFMT#g' \
-e 's#nbd+unix:///\??socket=SOCK_DIR/nbd#TEST_DIR/t.IMGFMT#g'
}
@@ -229,7 +228,6 @@ _filter_img_info()
-e "s#$TEST_DIR#TEST_DIR#g" \
-e "s#$SOCK_DIR#SOCK_DIR#g" \
-e "s#$IMGFMT#IMGFMT#g" \
- -e 's#nbd://127.0.0.1:[0-9]\\+$#TEST_DIR/t.IMGFMT#g' \
-e 's#nbd+unix:///\??socket=SOCK_DIR/nbd#TEST_DIR/t.IMGFMT#g' \
-e 's#SOCK_DIR/fuse-#TEST_DIR/#g' \
-e "/encrypted: yes/d" \
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index f4476b62f7d..d145f08201c 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
-# Copyright (C) 2009 Red Hat, Inc.
+# Copyright Red Hat
# Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify
@@ -717,6 +717,7 @@ _img_info()
-e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
-e "s#$TEST_DIR#TEST_DIR#g" \
-e "s#$SOCK_DIR/fuse-#TEST_DIR/#g" \
+ -e "s#$SOCK_DIR/#SOCK_DIR/#g" \
-e "s#$IMGFMT#IMGFMT#g" \
-e 's/\(compression type: \)\(zlib\|zstd\)/\1COMPRESSION_TYPE/' \
-e "/^disk size:/ D" \
--
2.40.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iotests: Fix test 104 under NBD
2023-05-19 15:02 [PATCH] iotests: Fix test 104 under NBD Eric Blake
@ 2023-05-19 15:19 ` Daniel P. Berrangé
0 siblings, 0 replies; 2+ messages in thread
From: Daniel P. Berrangé @ 2023-05-19 15:19 UTC (permalink / raw)
To: Eric Blake; +Cc: qemu-devel, hreitz, thuth, qemu-block, Kevin Wolf
On Fri, May 19, 2023 at 10:02:16AM -0500, Eric Blake wrote:
> In the past, commit a231cb27 ("iotests: Fix 104 for NBD", v2.3.0)
> added an additional filter to _filter_img_info to rewrite NBD URIs
> into the expected output form. This recently broke when we tweaked
> tests to run in a per-format directory, which did not match the regex,
> because _img_info itself is now already changing
> SOCK_DIR=/tmp/tmpphjfbphd/raw-nbd-104 into
> /tmp/tmpphjfbphd/IMGFMT-nbd-104 prior to _img_info_filter getting a
> chance to further filter things.
>
> While diagnosing the problem, I also noticed some filter lines
> rendered completely useless by a typo when we switched from TCP to
> Unix sockets for NBD (in shell, '\\+' is different from "\\+" (one
> gives two backslash to the regex, matching the literal 2-byte sequence
> <\+> after a single digit; the other gives one backslash to the regex,
> as the metacharacter \+ to match one or more of <[0-9]>); since the
> literal string <nbd://127.0.0.1:0\+> is not a valid URI, that regex
> hasn't been matching anything for years so it is fine to just drop it
> rather than fix the typo.
>
> Fixes: f3923a72 ("iotests: Switch nbd tests to use Unix rather than TCP", v4.2.0)
> Fixes: 5ba7db09 ("iotests: always use a unique sub-directory per test", v8.0.0)
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
> tests/qemu-iotests/common.filter | 4 +---
> tests/qemu-iotests/common.rc | 3 ++-
> 2 files changed, 3 insertions(+), 4 deletions(-)
I was about submit something similar to common.rc
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-19 15:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-19 15:02 [PATCH] iotests: Fix test 104 under NBD Eric Blake
2023-05-19 15:19 ` Daniel P. Berrangé
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).