Skip to contentSkip to conversation

iotests/162: Fix for newer Linux 5.3+

PATCH In review Max Reitz 2 participants 2 messages Oct 2, 2019

lore
Share & tools
lore

Max Reitz

author
#0 lore raw

PATCH 1/1 iotests/162: Fix for newer Linux 5.3+

Linux 5.3 has made 0.0.0.0/8 a working IPv4 subnet. As such, "42" is now a valid host, and the connection to it will (hopefully) time out over a long period rather than quickly return with EINVAL.

So let us use a negative integer for testing that NBD will not crash when it receives integer hosts. This way, the connection will again fail quickly and reliably.

---
 tests/qemu-iotests/162     | 2 +-
 tests/qemu-iotests/162.out | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tests/qemu-iotests/162 +1 -1
index 2d719afbed..c0053ed975 100755
@@ -46,7 +46,7 @@ echo '=== NBD ==='
 # NBD expects all of its arguments to be strings
 
 # So this should not crash
-$QEMU_IMG info 'json:{"driver": "nbd", "host": 42}'
+$QEMU_IMG info 'json:{"driver": "nbd", "host": -1}'
 
 # And this should not treat @port as if it had not been specified
 # (We need to set up a server here, because the error message for "Connection
tests/qemu-iotests/162.out +1 -1
index 3c5be2c569..5a00d36d17 100644
@@ -1,7 +1,7 @@
 QA output created by 162
 
 === NBD ===
-qemu-img: Could not open 'json:{"driver": "nbd", "host": 42}': Failed to connect socket: Invalid argument
+qemu-img: Could not open 'json:{"driver": "nbd", "host": -1}': address resolution failed for -1:10809: Name or service not known
 image: nbd://localhost:PORT
 image: nbd+unix://?socket=42
 
Signature · 1 line
2.21.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Max Reitz

Linux 5.3 has made 0.0.0.0/8 a working IPv4 subnet. As such, "42" is now a valid host, and the connection to it will (hopefully) time out over a long period rather than quickly return with EINVAL.

So let us use a negative integer for testing that NBD will not crash when it receives integer hosts. This way, the connection will again fail quickly and reliably.

Quoted 5 lines
---
  tests/qemu-iotests/162     | 2 +-
  tests/qemu-iotests/162.out | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

I'm happy to take this through my NBD tree, or it can go with other batched iotests, whichever path is easier.

Quoted 28 lines
tests/qemu-iotests/162 +1 -1
index 2d719afbed..c0053ed975 100755
@@ -46,7 +46,7 @@ echo '=== NBD ==='
  # NBD expects all of its arguments to be strings
 
  # So this should not crash
-$QEMU_IMG info 'json:{"driver": "nbd", "host": 42}'
+$QEMU_IMG info 'json:{"driver": "nbd", "host": -1}'
 
  # And this should not treat @port as if it had not been specified
  # (We need to set up a server here, because the error message for "Connection
tests/qemu-iotests/162.out +1 -1
index 3c5be2c569..5a00d36d17 100644
@@ -1,7 +1,7 @@
  QA output created by 162
 
  === NBD ===
-qemu-img: Could not open 'json:{"driver": "nbd", "host": 42}': Failed to connect socket: Invalid argument
+qemu-img: Could not open 'json:{"driver": "nbd", "host": -1}': address resolution failed for -1:10809: Name or service not known
  image: nbd://localhost:PORT
  image: nbd+unix://?socket=42
 
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org