Skip to contentSkip to conversation

iotests: More _filter_img_create fixes

PATCH In review Max Reitz 4 participants 10 messages Jul 10, 2020 – Jul 13, 2020

lore
Share & tools
lore

Max Reitz

author
#0 lore raw

cover iotests: More _filter_img_create fixes

Hi,

I’m sorry.

John, could I ask you to test whether this series fixes the problems you’re seeing?

Max Reitz (2):
iotests: Drop readarray from _do_filter_img_create
iotests: Set LC_ALL=C for sort

 tests/qemu-iotests/common.filter | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
2.26.2
author
#1 lore raw

PATCH 1/2 iotests: Drop readarray from _do_filter_img_create

Some systems where we run tests on do not have a 4.x bash, so they do not have readarray. While it looked a bit nicer than messing with head and tail, we do not really need it, so we might as well not use it.

---
 tests/qemu-iotests/common.filter | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
tests/qemu-iotests/common.filter +5 -5
index 3833206327..345c3ca03e 100644
@@ -138,13 +138,13 @@ _do_filter_img_create()
     # Split the line into the pre-options part ($filename_part, which
     # precedes ", fmt=") and the options part ($options, which starts
     # with "fmt=")
-    # (And just echo everything before the first "^Formatting")
-    readarray formatting_line < <($SED -e 's/, fmt=/\n/')
+    read formatting_line
 
-    filename_part=${formatting_line[0]}
-    unset formatting_line[0]
+    # Split line at the first ", fmt="
+    formatting_line=$(echo "$formatting_line" | $SED -e 's/, fmt=/\nfmt=/')
 
-    options="fmt=${formatting_line[@]}"
+    filename_part=$(echo "$formatting_line" | head -n 1)
+    options=$(echo "$formatting_line" | tail -n +2)
 
     # Set grep_data_file to '\|data_file' to keep it; make it empty
     # to drop it.
Signature · 1 line
2.26.2
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] iotests: Drop readarray from _do_filter_img_create

Quoted 11 lines · Max Reitz

Some systems where we run tests on do not have a 4.x bash, so they do not have readarray. While it looked a bit nicer than messing with head and tail, we do not really need it, so we might as well not use it.

---
  tests/qemu-iotests/common.filter | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#3 lore raw

Re: [PATCH 1/2] iotests: Drop readarray from _do_filter_img_create

In reply to Max Reitz
Quoted 4 lines · Max Reitz

Some systems where we run tests on do not have a 4.x bash, so they do not have readarray. While it looked a bit nicer than messing with head and tail, we do not really need it, so we might as well not use it.

I've fixed the cirrus build failure by brew installing a more recent bash. However if we prefer we could do this.

Quoted 30 lines
---
 tests/qemu-iotests/common.filter | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
tests/qemu-iotests/common.filter +5 -5
index 3833206327..345c3ca03e 100644
@@ -138,13 +138,13 @@ _do_filter_img_create()
     # Split the line into the pre-options part ($filename_part, which
     # precedes ", fmt=") and the options part ($options, which starts
     # with "fmt=")
-    # (And just echo everything before the first "^Formatting")
-    readarray formatting_line < <($SED -e 's/, fmt=/\n/')
+    read formatting_line
 
-    filename_part=${formatting_line[0]}
-    unset formatting_line[0]
+    # Split line at the first ", fmt="
+    formatting_line=$(echo "$formatting_line" | $SED -e 's/, fmt=/\nfmt=/')
 
-    options="fmt=${formatting_line[@]}"
+    filename_part=$(echo "$formatting_line" | head -n 1)
+    options=$(echo "$formatting_line" | tail -n +2)
 
     # Set grep_data_file to '\|data_file' to keep it; make it empty
     # to drop it.
Signature · 1 line
Alex Bennée
author
#4 lore raw

PATCH 2/2 iotests: Set LC_ALL=C for sort

In reply to Max Reitz

Otherwise the result is basically unpredictable.

(Note that the precise environment variable to control sorting order is LC_COLLATE, but LC_ALL overrides LC_COLLATE, and we do not want the sorting order to be messed up if LC_ALL is set in the environment.)

---
 tests/qemu-iotests/common.filter | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/common.filter +1 -1
index 345c3ca03e..4fd5c29b2a 100644
@@ -177,7 +177,7 @@ _do_filter_img_create()
             -e 's/^\(data_file\)/3-\1/' \
             -e 's/^\(encryption\)/4-\1/' \
             -e 's/^\(preallocation\)/8-\1/' \
-        | sort \
+        | LC_ALL=C sort \
         | $SED -e 's/^[0-9]-//' \
         | tr '\n\0' ' \n' \
         | $SED -e 's/^ *$//' -e 's/ *$//'
Signature · 1 line
2.26.2
Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] iotests: Set LC_ALL=C for sort

Quoted 5 lines · Max Reitz

Otherwise the result is basically unpredictable.

(Note that the precise environment variable to control sorting order is LC_COLLATE, but LC_ALL overrides LC_COLLATE, and we do not want the sorting order to be messed up if LC_ALL is set in the environment.)

Yep, that logic is correct.

Quoted 6 lines
---
  tests/qemu-iotests/common.filter | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines
tests/qemu-iotests/common.filter +1 -1
index 345c3ca03e..4fd5c29b2a 100644
@@ -177,7 +177,7 @@ _do_filter_img_create()
              -e 's/^\(data_file\)/3-\1/' \
              -e 's/^\(encryption\)/4-\1/' \
              -e 's/^\(preallocation\)/8-\1/' \
-        | sort \
+        | LC_ALL=C sort \
          | $SED -e 's/^[0-9]-//' \
          | tr '\n\0' ' \n' \
          | $SED -e 's/^ *$//' -e 's/ *$//'
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#6 lore raw

Re: [PATCH 2/2] iotests: Set LC_ALL=C for sort

In reply to Max Reitz
Quoted 8 lines · Max Reitz

Otherwise the result is basically unpredictable.

(Note that the precise environment variable to control sorting order is LC_COLLATE, but LC_ALL overrides LC_COLLATE, and we do not want the sorting order to be messed up if LC_ALL is set in the environment.)

Queued to pr/100720-testing-and-misc-2, thanks.

I've skipped patch 1/2 for now as I have an alternative fix but we can switch it back if you prefer?

Quoted 17 lines
---
 tests/qemu-iotests/common.filter | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/common.filter +1 -1
index 345c3ca03e..4fd5c29b2a 100644
@@ -177,7 +177,7 @@ _do_filter_img_create()
             -e 's/^\(data_file\)/3-\1/' \
             -e 's/^\(encryption\)/4-\1/' \
             -e 's/^\(preallocation\)/8-\1/' \
-        | sort \
+        | LC_ALL=C sort \
         | $SED -e 's/^[0-9]-//' \
         | tr '\n\0' ' \n' \
         | $SED -e 's/^ *$//' -e 's/ *$//'
Signature · 1 line
Alex Bennée
author
#7 lore raw

Re: [PATCH 2/2] iotests: Set LC_ALL=C for sort

Quoted 9 lines · Alex Bennée
Quoted 6 lines · Max Reitz

Otherwise the result is basically unpredictable.

(Note that the precise environment variable to control sorting order is LC_COLLATE, but LC_ALL overrides LC_COLLATE, and we do not want the sorting order to be messed up if LC_ALL is set in the environment.)

Quoted 7 lines
Quoted 2 lines

Queued to pr/100720-testing-and-misc-2, thanks.

I've skipped patch 1/2 for now as I have an alternative fix but we can switch it back if you prefer?

I see you’ve sent your pull request already, so I’ll see whether I’ll include 1/2 in some block pull request. Maybe, maybe not.

Thanks for queuing 2/2, anyway. :)

Max

#8 lore raw
In reply to Max Reitz
Quoted 7 lines · Max Reitz

Hi,

I’m sorry.

John, could I ask you to test whether this series fixes the problems you’re seeing?

This is based on kwolf/block, I see.

By the time you return to reading work email, this link will have information for you:

https://travis-ci.org/github/jnsnow/qemu/jobs/706960907

Quoted 8 lines

Max Reitz (2):
iotests: Drop readarray from _do_filter_img_create
iotests: Set LC_ALL=C for sort

 tests/qemu-iotests/common.filter | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
—js
author
#9 lore raw
Quoted 11 lines · John Snow
Quoted 7 lines · Max Reitz

Hi,

I’m sorry.

John, could I ask you to test whether this series fixes the problems you’re seeing?

Quoted 6 lines

This is based on kwolf/block, I see.

By the time you return to reading work email, this link will have information for you:

https://travis-ci.org/github/jnsnow/qemu/jobs/706960907

:)

I thank you, John from the past. Though only future John will ever know.

Max