Skip to contentSkip to conversation

iotests fixes

PATCH In review Eric Farman 2 participants 11 messages Sep 25 – Oct 8

lore
Share & tools
lore
#3 lore raw

PATCH v4 3/5 iotests/fuse-truncate: skip if FUSE is not usable

In reply to Eric Farman

Commit 951227d3755 ("iotests: skip FUSE tests when FUSE is not usable") reworked some of the fuse-related tests to skip where needed, but the new test fuse-truncate raced with that and missed out on the same treatment. Add that same python-esque skip logic to this test.

Fixes 7d06bbb2d9 ("iotests: test O_TRUNC behavior for fuse exports")
---
 tests/qemu-iotests/tests/fuse-truncate | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
tests/qemu-iotests/tests/fuse-truncate +6 -3
index 7eee35111c8..f3d2f1866c8 100755
@@ -32,9 +32,12 @@ def check_fuse_support():
     test_qsd.stop()
     os.remove(fuse_mount_point)
     if 'error' in res:
-        assert (res['error']['desc'] ==
-                "Parameter 'type' does not accept value 'fuse'")
-        iotests.notrun('No FUSE support')
+        desc = res['error']['desc']
+        if desc == "Parameter 'type' does not accept value 'fuse'":
+            iotests.notrun('No FUSE support')
+        if 'Failed to mount FUSE session' in desc:
+            iotests.notrun('FUSE not usable in this environment')
+        assert False, desc
 
 def check_sudo_support():
     try:
Signature · 1 line
2.53.0
#2 lore raw

PATCH v4 2/5 iotests/nbd-tls-iothread: skip on non-x86 hardware

In reply to Eric Farman

Like nbd-in-qcow2-chain, this test assumes a q35 machine is present, which might not be available on other hosts. Unlike that test, simply allowing it to run with the default machine still throws an errors. Fence this to PC-only machines for now.

---
 tests/qemu-iotests/tests/nbd-tls-iothread | 4 ++++
 1 file changed, 4 insertions(+)
tests/qemu-iotests/tests/nbd-tls-iothread +4 -0
index a2fb07206e5..4326e2d3e5c 100755
@@ -47,6 +47,10 @@ cd ..
 _supported_fmt qcow2  # Hardcoded to qcow2 command line and QMP below
 _supported_proto file
 
+if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
+    _notrun "Requires a PC machine"
+fi
+
 # pick_unused_port
 #
 # Picks and returns an "unused" port, setting the global variable
Signature · 1 line
2.53.0
#6 lore raw

PATCH v4 5/5 iotests/iothreads-nbd-export: Skip on s390

In reply to Eric Farman

Running this test on s390 causes long python exception tracebacks at the beginning of the system_reset loop. The problem appears to be the same one described by commit ad302b21aab6, in that QEMU will exit on s390 without any kernel or boot disk.

In other tests, this is addressed by adding -no-shutdown to the command line, and that does create a clean failure instead of a long line of python exceptions:

--- /home/farman/git/qemu/tests/qemu-iotests/tests/iothreads-nbd-export.out
+++ /home/farman/git/qemu/build/scratch/qcow2-file-iothreads-nbd-export/iothreads-nbd-export.out.bad @@ -16,4 +16,4 @@
{"return": {}}
{"return": {}}
Checking that it is still alive...
-{"return": {"running": true, "status": "running"}}
+{"return": {"running": false, "status": "prelaunch"}}
Failures: iothreads-nbd-export
Failed 1 of 1 iotests

...but obviously this isn't still a successful test, since it is expected that the guest will be still be usable after the reset loop. So, barring a solution to that, just skip this test on s390.

---
 tests/qemu-iotests/tests/iothreads-nbd-export | 5 +++++
 1 file changed, 5 insertions(+)
tests/qemu-iotests/tests/iothreads-nbd-export +5 -0
index 037260729c7..72493ad2279 100755
@@ -25,6 +25,11 @@ import iotests
 iotests.script_initialize(supported_fmts=['qcow2'],
                           supported_platforms=['linux'])
 
+# QEMU on s390 will exit without any sort of backing disk,
+# so the reset loop requested by this test will fail.
+if iotests.qemu_default_machine == 's390-ccw-virtio':
+    iotests.notrun('Cannot run test on s390')
+
 with iotests.FilePath('disk1.img') as path, \
      iotests.FilePath('nbd.sock', base_dir=iotests.sock_dir) as nbd_sock, \
      qemu.machine.QEMUMachine(iotests.qemu_prog) as vm:
Signature · 1 line
2.53.0
#4 lore raw

PATCH v4 4/5 iotests/108: skip if fuse is unusable

In reply to Eric Farman

It is possible that the ability to fusermount is restricted to privileged users. Rather than waiting for this test to perform a mount and subsequently fail, perform a dummy mount early on and skip the tests if fuse is not usable.

---
 tests/qemu-iotests/108 | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
tests/qemu-iotests/108 +20 -0
index bf808b35125..fc3f7322678 100755
@@ -73,6 +73,26 @@ else
         _notrun 'Passwordless sudo for losetup or FUSE support required, but' \
                 'neither is available'
     fi
+
+    # Test to see if fuse is usable or not (permissions, etc.)
+    export_mp="$TEST_DIR/fuse-export"
+    touch "$export_mp"
+
+    response=$($QSD \
+        --blockdev null-co,node-name=export-node \
+        --export fuse,id=fuse-export,node-name=export-node,mountpoint="$export_mp",allow-other=off \
+        --daemonize \
+        --pidfile "$TEST_DIR/qsd.pid" 2>&1)
+    _notrun_on_fuse_error "$response"
+
+    if [ -f "$TEST_DIR/qsd.pid" ]; then
+        qsd_pid=$(cat "$TEST_DIR/qsd.pid")
+        kill -KILL "$qsd_pid"
+        # Wait for process to exit (cannot `wait` because the QSD is daemonized)
+        while [ -f "$TEST_DIR/qsd.pid" ]; do
+            true
+        done
+    fi
 fi
 
 echo
Signature · 1 line
2.53.0
#1 lore raw

PATCH v4 1/5 iotests/nbd-in-qcow2-chain: use default machine

In reply to Eric Farman

Some of the NBD tests explicitly specify -machine q35 which won't work when running against, say, qemu-system-s390x.

The nbd-in-qcow2-chain test runs fine with the default machine on a z16 host, so allow it to run in other configurations.

Fixes 24fd6d75b3 ("iotests: Add coverage of recent NBD qio deadlock fix")
---
 tests/qemu-iotests/tests/nbd-in-qcow2-chain | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/tests/nbd-in-qcow2-chain +1 -1
index 455ddfa86fe..e35f072eba4 100755
@@ -43,7 +43,7 @@ TEST_IMG="$TEST_IMG.base" _make_test_img $size
 echo
 echo "=== Starting QEMU and exposing base image ==="
 
-_launch_qemu -machine q35
+_launch_qemu
 h1=$QEMU_HANDLE
 _send_qemu_cmd $QEMU_HANDLE '{"execute": "qmp_capabilities"}' 'return'
 _send_qemu_cmd $QEMU_HANDLE '{"execute": "blockdev-add",
Signature · 1 line
2.53.0
#0 lore raw

v4 cover iotests fixes

Hi Kevin, Hanna,

Here is a new version of iotests fixes from our s390x systems. They aren't related, just came up walking through the failures.

I saw you asked Eric Blake about the nbd-in-qcow2-chain patch. I left it as-is, but I am fine with skipping it if that's easier.

I added a new patch at the end of this series, which skips the last remaining failure I can create out-of-the-box on s390. I had hoped that I could get that one to work, but it doesn't appear to be trivial.

Regardless, I now get a clean run on an s390 host:

Not run: 045 059 064 070 075 076 077 078 081 083 084 088 092 093 094 101 106 108 109 113 116 118 119 123 128 131 135 136 146 147 148 149 160 162 171 172 173 175 181 185 186 192 201 205 207 210 211 212 213 221 225 231 233 237 239 241 253 259 266 282 288 294 296 301 308 block-status-cache file-io-error fuse-allow-other fuse-mmap-shared fuse-truncate iothreads-nbd-export iov-padding loop-create-file luks-detached-header migration-permissions mirror-top-perms nbd-commands nbd-multiconn nbd-tls-iothread parallels-bitmap parallels-checks resize-below-raw vvfat write-zeroes-unmap zoned Some cases not run in: /home/farman/git/qemu/tests/qemu-iotests/151 /home/farman/git/qemu/tests/qemu-iotests/297
Passed all 261 iotests

I look forward to your feedback...

v1: https://lore.kernel.org/r/[email protected]/
v2: https://lore.kernel.org/r/[email protected]/
v3: https://lore.kernel.org/r/[email protected]/
v3->v4:
- [KW] Rework patch 4 to use --daemonize and _notrun_on_fuse_error()
- [EF] Add patch 5 to skip iothread-nbd-export on s390

Eric Farman (5):
iotests/nbd-in-qcow2-chain: use default machine iotests/nbd-tls-iothread: skip on non-x86 hardware iotests/fuse-truncate: skip if FUSE is not usable iotests/108: skip if fuse is unusable iotests/iothreads-nbd-export: Skip on s390

 tests/qemu-iotests/108                        | 20 +++++++++++++++++++
 tests/qemu-iotests/tests/fuse-truncate        |  9 ++++++---
 tests/qemu-iotests/tests/iothreads-nbd-export |  5 +++++
 tests/qemu-iotests/tests/nbd-in-qcow2-chain   |  2 +-
 tests/qemu-iotests/tests/nbd-tls-iothread     |  4 ++++
 5 files changed, 36 insertions(+), 4 deletions(-)
Signature · 1 line
2.53.0
Reviewed-by on the v4 series
#7 lore raw
Quoted 11 lines · Eric Farman

Hi Kevin, Hanna,

Here is a new version of iotests fixes from our s390x systems. They aren't related, just came up walking through the failures.

I saw you asked Eric Blake about the nbd-in-qcow2-chain patch. I left it as-is, but I am fine with skipping it if that's easier.

I added a new patch at the end of this series, which skips the last remaining failure I can create out-of-the-box on s390. I had hoped that I could get that one to work, but it doesn't appear to be trivial.

Series:

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org
#8 lore raw
Quoted 9 lines · Eric Blake
Quoted 8 lines · Eric Farman

Hi Kevin, Hanna,

Here is a new version of iotests fixes from our s390x systems. They aren't related, just came up walking through the failures.

I saw you asked Eric Blake about the nbd-in-qcow2-chain patch. I left it as-is, but I am fine with skipping it if that's easier.

Quoted 7 lines
Quoted 3 lines

I added a new patch at the end of this series, which skips the last remaining failure I can create out-of-the-box on s390. I had hoped that I could get that one to work, but it doesn't appear to be trivial.

Series:

Thanks, Eric!

@Kevin, @Hanna... Any concerns with this series?

#9 lore raw
Quoted 16 lines · Eric Farman
Quoted 13 lines · Eric Blake
Quoted 11 lines · Eric Farman

Hi Kevin, Hanna,

Here is a new version of iotests fixes from our s390x systems. They aren't related, just came up walking through the failures.

I saw you asked Eric Blake about the nbd-in-qcow2-chain patch. I left it as-is, but I am fine with skipping it if that's easier.

I added a new patch at the end of this series, which skips the last remaining failure I can create out-of-the-box on s390. I had hoped that I could get that one to work, but it doesn't appear to be trivial.

Quoted 7 lines
Quoted 3 lines

Series:

Thanks, Eric!

@Kevin, @Hanna... Any concerns with this series?

At this point, I plan on queuing this in my next NBD pull request.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org
#10 lore raw
Quoted 21 lines · Eric Blake
Quoted 20 lines · Eric Farman
Quoted 16 lines · Eric Blake
Quoted 11 lines · Eric Farman

Hi Kevin, Hanna,

Here is a new version of iotests fixes from our s390x systems. They aren't related, just came up walking through the failures.

I saw you asked Eric Blake about the nbd-in-qcow2-chain patch. I left it as-is, but I am fine with skipping it if that's easier.

I added a new patch at the end of this series, which skips the last remaining failure I can create out-of-the-box on s390. I had hoped that I could get that one to work, but it doesn't appear to be trivial.

Series:

Quoted 6 lines
Quoted 3 lines

Thanks, Eric!

@Kevin, @Hanna... Any concerns with this series?

At this point, I plan on queuing this in my next NBD pull request.

Thank you!

#5 lore raw

Re: [PATCH v4 4/5] iotests/108: skip if fuse is unusable

In reply to Eric Farman
Quoted 27 lines · Eric Farman

It is possible that the ability to fusermount is restricted to privileged users. Rather than waiting for this test to perform a mount and subsequently fail, perform a dummy mount early on and skip the tests if fuse is not usable.

---
 tests/qemu-iotests/108 | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
tests/qemu-iotests/108 +9 -0
index bf808b35125..fc3f7322678 100755
@@ -73,6 +73,26 @@ else
         _notrun 'Passwordless sudo for losetup or FUSE support required, but' \
                 'neither is available'
     fi
+
+    # Test to see if fuse is usable or not (permissions, etc.)
+    export_mp="$TEST_DIR/fuse-export"
+    touch "$export_mp"
+
+    response=$($QSD \
+        --blockdev null-co,node-name=export-node \
+        --export fuse,id=fuse-export,node-name=export-node,mountpoint="$export_mp",allow-other=off \
+        --daemonize \

tests/qemu-iotests/108 else · line 94

Quoted 10 lines
tests/qemu-iotests/108 +10 -0
+        --pidfile "$TEST_DIR/qsd.pid" 2>&1)
+    _notrun_on_fuse_error "$response"
+
+    if [ -f "$TEST_DIR/qsd.pid" ]; then
+        qsd_pid=$(cat "$TEST_DIR/qsd.pid")
+        kill -KILL "$qsd_pid"
+        # Wait for process to exit (cannot `wait` because the QSD is daemonized)
+        while [ -f "$TEST_DIR/qsd.pid" ]; do
+            true
+        done

This appears to go into an infinite loop on a machine I tested where corporate policy software held the fuse mountpoint open long enough that it caused a race condition in tearing things down. I'm dropping this one from my pull request, but 1-3 and 5 remain.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org