Skip to contentSkip to conversation

iotest: Fix 241 to run in generic directory

PATCH Applied Eric Blake 3 participants 5 messages Apr 10, 2019 – Apr 12, 2019

lore
Share & tools
lore

Eric Blake

author
#0 lore raw

PATCH 1/1 iotest: Fix 241 to run in generic directory

Filter the qemu-nbd server output to get rid of a direct reference to my build directory.

---

Not worth -rc4 on its own, but if something else pops up that requires another spin, I plan on a pull request for this one. Otherwise it slips to 4.1, and 4.0 just has a broken iotest.

 tests/qemu-iotests/241     | 4 +++-
 tests/qemu-iotests/241.out | 6 +++---
 2 files changed, 6 insertions(+), 4 deletions(-)
tests/qemu-iotests/241 +3 -1
index 4b196857387..017a736aaba 100755
@@ -28,6 +28,7 @@ nbd_unix_socket=$TEST_DIR/test_qemu_nbd_socket
 _cleanup()
 {
     _cleanup_test_img
+    rm -f "$TEST_DIR/server.log"
     nbd_server_stop
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
@@ -69,12 +70,13 @@ echo
 
 # Intentionally omit '-f' to force image probing, which in turn forces
 # sector alignment, here at the server.
-nbd_server_start_unix_socket "$TEST_IMG_FILE"
+nbd_server_start_unix_socket "$TEST_IMG_FILE" 2> "$TEST_DIR/server.log"
 
 $QEMU_NBD_PROG --list -k $nbd_unix_socket | grep '\(size\|min\)'
 $QEMU_IMG map -f raw --output=json "$TEST_IMG" | _filter_qemu_img_map
 $QEMU_IO -f raw -c map "$TEST_IMG"
 nbd_server_stop
+cat "$TEST_DIR/server.log" | _filter_testdir
 
 echo
 echo "=== Exporting unaligned raw image, forced client sector alignment ==="
tests/qemu-iotests/241.out +3 -3
index f481074a02e..75f9f465e52 100644
@@ -10,13 +10,13 @@ QA output created by 241
 
 === Exporting unaligned raw image, forced server sector alignment ===
 
-WARNING: Image format was not specified for '/home/eblake/qemu/tests/qemu-iotests/scratch/t.raw' and probing guessed raw.
-         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
-         Specify the 'raw' format explicitly to remove the restrictions.
   size:  1024
   min block: 512
 [{ "start": 0, "length": 1024, "depth": 0, "zero": false, "data": true, "offset": OFFSET}]
 1 KiB (0x400) bytes     allocated at offset 0 bytes (0x0)
+WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed raw.
+         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
+         Specify the 'raw' format explicitly to remove the restrictions.
 
 === Exporting unaligned raw image, forced client sector alignment ===
 
Signature · 1 line
2.20.1
#1 lore raw
Quoted 51 lines · Eric Blake

Filter the qemu-nbd server output to get rid of a direct reference to my build directory.

---

Not worth -rc4 on its own, but if something else pops up that requires another spin, I plan on a pull request for this one. Otherwise it slips to 4.1, and 4.0 just has a broken iotest.

  tests/qemu-iotests/241     | 4 +++-
  tests/qemu-iotests/241.out | 6 +++---
  2 files changed, 6 insertions(+), 4 deletions(-)
tests/qemu-iotests/241 +3 -1
index 4b196857387..017a736aaba 100755
@@ -28,6 +28,7 @@ nbd_unix_socket=$TEST_DIR/test_qemu_nbd_socket
  _cleanup()
  {
      _cleanup_test_img
+    rm -f "$TEST_DIR/server.log"
      nbd_server_stop
  }
  trap "_cleanup; exit \$status" 0 1 2 3 15
@@ -69,12 +70,13 @@ echo
 
  # Intentionally omit '-f' to force image probing, which in turn forces
  # sector alignment, here at the server.
-nbd_server_start_unix_socket "$TEST_IMG_FILE"
+nbd_server_start_unix_socket "$TEST_IMG_FILE" 2> "$TEST_DIR/server.log"
 
  $QEMU_NBD_PROG --list -k $nbd_unix_socket | grep '\(size\|min\)'
  $QEMU_IMG map -f raw --output=json "$TEST_IMG" | _filter_qemu_img_map
  $QEMU_IO -f raw -c map "$TEST_IMG"
  nbd_server_stop
+cat "$TEST_DIR/server.log" | _filter_testdir
 
  echo
  echo "=== Exporting unaligned raw image, forced client sector alignment ==="
tests/qemu-iotests/241.out +0 -0
index f481074a02e..75f9f465e52 100644
@@ -10,13 +10,13 @@ QA output created by 241
 
  === Exporting unaligned raw image, forced server sector alignment ===
 

tests/qemu-iotests/241.out QA output created by 241 · line 19

Quoted 10 lines
tests/qemu-iotests/241.out +3 -3
-WARNING: Image format was not specified for '/home/eblake/qemu/tests/qemu-iotests/scratch/t.raw' and probing guessed raw.
-         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
-         Specify the 'raw' format explicitly to remove the restrictions.
    size:  1024
    min block: 512
  [{ "start": 0, "length": 1024, "depth": 0, "zero": false, "data": true, "offset": OFFSET}]
  1 KiB (0x400) bytes     allocated at offset 0 bytes (0x0)
+WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed raw.
+         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
+         Specify the 'raw' format explicitly to remove the restrictions.

May be, just add -f raw to nbd server, to make this message disappear? And than, don't do any redirections, as if there will be failed unfiltered output it is OK?

Quoted 3 lines
tests/qemu-iotests/241.out +0 -0
  === Exporting unaligned raw image, forced client sector alignment ===
 
Signature · 2 lines
Best regards,
Vladimir
author
#2 lore raw
Quoted 22 lines · Vladimir Sementsov-Ogievskiy
Quoted 20 lines · Eric Blake

Filter the qemu-nbd server output to get rid of a direct reference to my build directory.

---

Not worth -rc4 on its own, but if something else pops up that requires another spin, I plan on a pull request for this one. Otherwise it slips to 4.1, and 4.0 just has a broken iotest.

tests/qemu-iotests/241 +1 -1
@@ -69,12 +70,13 @@ echo
 
  # Intentionally omit '-f' to force image probing, which in turn forces
  # sector alignment, here at the server.
-nbd_server_start_unix_socket "$TEST_IMG_FILE"
+nbd_server_start_unix_socket "$TEST_IMG_FILE" 2> "$TEST_DIR/server.log"
 
Quoted 7 lines

tests/qemu-iotests/241.out QA output created by 241 · line 19

Quoted 4 lines
tests/qemu-iotests/241.out +3 -0
  1 KiB (0x400) bytes     allocated at offset 0 bytes (0x0)
+WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed raw.
+         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
+         Specify the 'raw' format explicitly to remove the restrictions.

May be, just add -f raw to nbd server, to make this message disappear? And than, don't do any redirections, as if there will be failed unfiltered output it is OK?

No. See the comment in the test - it is intentional that we are omitting -f, in two different places, in order to get three test scenarios:

normal: server '-f raw' 1-byte align, client '-f raw' 1-byte align
server-constrained: server omit for 512-byte align, client '-f raw' obeys server align
client-constrained: server '-f raw' 1-byte align, client omit for intentional 512-byte align

in order to show both that the server with forced alignment is able to round requests correctly before sending to the client, and to show that the client with forced alignment is able to round requests correctly in spite of the server sending answers narrower than the client wants.

In 4.1, when Max's filter handling patches land, it will be possible to use the blkdebug driver to force alignment instead of omitting '-f raw'; at which point we can take away the server.log file. But until the filter handling patches land, any use of blkdebug causes odd test misbehaviors because not everything in the block layer properly sees through filter nodes.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#3 lore raw
Quoted 45 lines · Eric Blake
Quoted 22 lines · Vladimir Sementsov-Ogievskiy
Quoted 20 lines · Eric Blake

Filter the qemu-nbd server output to get rid of a direct reference to my build directory.

---

Not worth -rc4 on its own, but if something else pops up that requires another spin, I plan on a pull request for this one. Otherwise it slips to 4.1, and 4.0 just has a broken iotest.

tests/qemu-iotests/241 +1 -1
@@ -69,12 +70,13 @@ echo
 
   # Intentionally omit '-f' to force image probing, which in turn forces
   # sector alignment, here at the server.
-nbd_server_start_unix_socket "$TEST_IMG_FILE"
+nbd_server_start_unix_socket "$TEST_IMG_FILE" 2> "$TEST_DIR/server.log"
 
Quoted 7 lines

tests/qemu-iotests/241.out QA output created by 241 · line 19

Quoted 4 lines
tests/qemu-iotests/241.out +3 -0
   1 KiB (0x400) bytes     allocated at offset 0 bytes (0x0)
+WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed raw.
+         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
+         Specify the 'raw' format explicitly to remove the restrictions.

May be, just add -f raw to nbd server, to make this message disappear? And than, don't do any redirections, as if there will be failed unfiltered output it is OK?

No. See the comment in the test - it is intentional that we are omitting -f, in two different places, in order to get three test scenarios:

normal: server '-f raw' 1-byte align, client '-f raw' 1-byte align
server-constrained: server omit for 512-byte align, client '-f raw' obeys server align
client-constrained: server '-f raw' 1-byte align, client omit for intentional 512-byte align

in order to show both that the server with forced alignment is able to round requests correctly before sending to the client, and to show that the client with forced alignment is able to round requests correctly in spite of the server sending answers narrower than the client wants.

Quoted 7 lines

In 4.1, when Max's filter handling patches land, it will be possible to use the blkdebug driver to force alignment instead of omitting '-f raw'; at which point we can take away the server.log file. But until the filter handling patches land, any use of blkdebug causes odd test misbehaviors because not everything in the block layer properly sees through filter nodes.

Understand now, thanks.

Signature · 2 lines
Best regards,
Vladimir