mbox series

[00/23] iotests: Add and use $SOCK_DIR

Message ID 20191010152457.17713-1-mreitz@redhat.com (mailing list archive)
Headers show
Series iotests: Add and use $SOCK_DIR | expand

Message

Max Reitz Oct. 10, 2019, 3:24 p.m. UTC
Hi,

Perhaps the main reason we cannot run important tests such as 041 in CI
is that when they care Unix sockets in $TEST_DIR, the path may become
too long to connect to them.

To get by this problem, this series lets the check script create a new
temporary directory (mktemp -d) and then makes the iotests use it for
all Unix sockets.


Max Reitz (23):
  iotests: Introduce $SOCK_DIR
  iotests.py: Store socket files in $SOCK_DIR
  iotests.py: Add @base_dir to FilePaths etc.
  iotests: Filter $SOCK_DIR
  iotests: Let common.nbd create socket in $SOCK_DIR
  iotests/083: Create socket in $SOCK_DIR
  iotests/140: Create socket in $SOCK_DIR
  iotests/143: Create socket in $SOCK_DIR
  iotests/147: Create socket in $SOCK_DIR
  iotests/181: Create socket in $SOCK_DIR
  iotests/182: Create socket in $SOCK_DIR
  iotests/183: Create socket in $SOCK_DIR
  iotests/192: Create socket in $SOCK_DIR
  iotests/194: Create sockets in $SOCK_DIR
  iotests/201: Create socket in $SOCK_DIR
  iotests/205: Create socket in $SOCK_DIR
  iotests/208: Create socket in $SOCK_DIR
  iotests/209: Create socket in $SOCK_DIR
  iotests/222: Create socket in $SOCK_DIR
  iotests/223: Create socket in $SOCK_DIR
  iotests/240: Create socket in $SOCK_DIR
  iotests/267: Create socket in $SOCK_DIR
  iotests: Drop TEST_DIR filter from _filter_nbd

 python/qemu/machine.py           | 15 +++++++++++---
 python/qemu/qtest.py             |  9 ++++++---
 tests/qemu-iotests/083           |  6 +++---
 tests/qemu-iotests/083.out       | 34 ++++++++++++++++----------------
 tests/qemu-iotests/140           |  8 ++++----
 tests/qemu-iotests/140.out       |  2 +-
 tests/qemu-iotests/143           |  6 +++---
 tests/qemu-iotests/143.out       |  2 +-
 tests/qemu-iotests/147           |  2 +-
 tests/qemu-iotests/181           |  2 +-
 tests/qemu-iotests/182           |  4 ++--
 tests/qemu-iotests/183           |  2 +-
 tests/qemu-iotests/192           |  4 ++--
 tests/qemu-iotests/192.out       |  2 +-
 tests/qemu-iotests/194           |  4 ++--
 tests/qemu-iotests/201           |  2 +-
 tests/qemu-iotests/205           |  2 +-
 tests/qemu-iotests/208           |  2 +-
 tests/qemu-iotests/209           |  3 ++-
 tests/qemu-iotests/222           |  2 +-
 tests/qemu-iotests/223           | 14 ++++++-------
 tests/qemu-iotests/240           |  4 ++--
 tests/qemu-iotests/241           |  2 --
 tests/qemu-iotests/267           |  4 ++--
 tests/qemu-iotests/267.out       |  2 +-
 tests/qemu-iotests/check         | 17 ++++++++++++++++
 tests/qemu-iotests/common.filter |  7 +++++--
 tests/qemu-iotests/common.nbd    |  2 +-
 tests/qemu-iotests/iotests.py    | 16 ++++++++-------
 29 files changed, 107 insertions(+), 74 deletions(-)

Comments

Thomas Huth Oct. 11, 2019, 7:27 a.m. UTC | #1
On 10/10/2019 17.24, Max Reitz wrote:
> Hi,
> 
> Perhaps the main reason we cannot run important tests such as 041 in CI
> is that when they care Unix sockets in $TEST_DIR, the path may become
> too long to connect to them.
> 
> To get by this problem, this series lets the check script create a new
> temporary directory (mktemp -d) and then makes the iotests use it for
> all Unix sockets.

Thanks a lot for tackling this!

I gave it a try, and most tests work fine now indeed when I run them in
a directory with a veeeery long file name.

I still get an error with 028 though:


$ ./check -qcow2 028
QEMU          --
"/home/thuth/tmp/qemu-with-very-long-directory-name-01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/tests/qemu-iotests/../../x86_64-softmmu/qemu-system-x86_64"
-nodefaults -display none -machine accel=qtest
QEMU_IMG      --
"/home/thuth/tmp/qemu-with-very-long-directory-name-01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/tests/qemu-iotests/../../qemu-img"

QEMU_IO       --
"/home/thuth/tmp/qemu-with-very-long-directory-name-01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/tests/qemu-iotests/../../qemu-io"
 --cache writeback -f qcow2
QEMU_NBD      --
"/home/thuth/tmp/qemu-with-very-long-directory-name-01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/tests/qemu-iotests/../../qemu-nbd"

IMGFMT        -- qcow2 (compat=1.1)
IMGPROTO      -- file
PLATFORM      -- Linux/x86_64 thuth 4.18.0-80.11.2.el8_0.x86_64
TEST_DIR      --
/home/thuth/tmp/qemu-with-very-long-directory-name-01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/tests/qemu-iotests/scratch
SOCK_DIR      -- /tmp/tmp.YEmubpCxRH
SOCKET_SCM_HELPER --
/home/thuth/tmp/qemu-with-very-long-directory-name-01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/tests/qemu-iotests/socket_scm_helper

028      fail       [09:11:52] [09:11:53]                    output
mismatch (see 028.out.bad)
--- /home/thuth/devel/qemu/tests/qemu-iotests/028.out	2019-08-16
18:00:39.258741027 +0200
+++
/home/thuth/tmp/qemu-with-very-long-directory-name-01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/tests/qemu-iotests/028.out.bad
2019-10-11 09:11:53.822111901 +0200
@@ -468,7 +468,8 @@

 block-backup

-Formatting 'TEST_DIR/t.IMGFMT.copy', fmt=IMGFMT size=4294968832
backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=IMGFMT
+(qemu)
+Timeout waiting for Formatting on handle 0
 (qemu) info block-jobs
 No active jobs
 === IO: pattern 195
Failures: 028
Failed 1 of 1 iotests


028 works fine if I start it from a directory with a short filename.


I also saw an error with "./check -raw 055" once, but it does not seem
to be reproducible:


055      fail       [09:08:28] [09:10:57]                    output
mismatch (see 055.out.bad)
--- /home/thuth/devel/qemu/tests/qemu-iotests/055.out	2019-08-16
18:00:39.262741079 +0200
+++
/home/thuth/tmp/qemu-with-very-long-directory-name-01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/tests/qemu-iotests/055.out.bad
2019-10-11 09:10:57.059254617 +0200
@@ -1,5 +1,35 @@
-..............................
+WARNING:qemu.machine:qemu received signal 9:
/home/thuth/tmp/qemu-with-very-long-directory-name-01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/tests/qemu-iotests/../../x86_64-softmmu/qemu-system-x86_64
-chardev socket,id=mon,path=/tmp/tmp.3mKmQDU7Ft/qemu-24878-monitor.sock
-mon chardev=mon,mode=control -display none -vga none -qtest
unix:path=/tmp/tmp.3mKmQDU7Ft/qemu-24878-qtest.sock -accel qtest
-nodefaults -display none -machine accel=qtest -drive
if=virtio,id=drive0,file=blkdebug::/home/thuth/tmp/qemu-with-very-long-directory-name-01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/tests/qemu-iotests/scratch/test.img,format=raw,cache=writeback
-drive
if=none,id=drive1,file=/home/thuth/tmp/qemu-with-very-long-directory-name-01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/tests/qemu-iotests/scratch/blockdev-target.img,format=vmdk,cache=writeback
+E.............................
+======================================================================
+ERROR: test_complete_compress_blockdev_backup
(__main__.TestDriveCompression)
+----------------------------------------------------------------------
+Traceback (most recent call last):
+  File
"/home/thuth/devel/qemu/tests/qemu-iotests/../../python/qemu/qmp.py",
line 122, in __get_events
+    ret = self.__json_read(only_event=True)
+  File
"/home/thuth/devel/qemu/tests/qemu-iotests/../../python/qemu/qmp.py",
line 82, in __json_read
+    data = self.__sockfile.readline()
+  File "/usr/lib64/python3.6/socket.py", line 586, in readinto
+    return self._sock.recv_into(b)
+socket.timeout: timed out
+
+During handling of the above exception, another exception occurred:
+
+Traceback (most recent call last):
+  File "055", line 499, in test_complete_compress_blockdev_backup
+    target='drive1')
+  File "055", line 484, in do_test_compress_complete
+    self.wait_until_completed()
+  File "/home/thuth/devel/qemu/tests/qemu-iotests/iotests.py", line
751, in wait_until_completed
+    for event in self.vm.get_qmp_events(wait=wait):
+  File
"/home/thuth/devel/qemu/tests/qemu-iotests/../../python/qemu/machine.py", line
406, in get_qmp_events
+    events = self._qmp.get_events(wait=wait)
+  File
"/home/thuth/devel/qemu/tests/qemu-iotests/../../python/qemu/qmp.py",
line 236, in get_events
+    self.__get_events(wait)
+  File
"/home/thuth/devel/qemu/tests/qemu-iotests/../../python/qemu/qmp.py",
line 124, in __get_events
+    raise QMPTimeoutError("Timeout waiting for event")
+qemu.qmp.QMPTimeoutError: Timeout waiting for event
+
 ----------------------------------------------------------------------
 Ran 30 tests

-OK
+FAILED (errors=1)

 Thomas
Max Reitz Oct. 11, 2019, 8:03 a.m. UTC | #2
On 11.10.19 09:27, Thomas Huth wrote:
> On 10/10/2019 17.24, Max Reitz wrote:
>> Hi,
>>
>> Perhaps the main reason we cannot run important tests such as 041 in CI
>> is that when they care Unix sockets in $TEST_DIR, the path may become
>> too long to connect to them.
>>
>> To get by this problem, this series lets the check script create a new
>> temporary directory (mktemp -d) and then makes the iotests use it for
>> all Unix sockets.
> 
> Thanks a lot for tackling this!
> 
> I gave it a try, and most tests work fine now indeed when I run them in
> a directory with a veeeery long file name.
> 
> I still get an error with 028 though:

Hm, I didn’t see any error for 028 or 055 myself.  028 makes use of
common.qemu, which uses FIFOs, and I thought there were exempt from this
problem.  And for 055 I have no idea.

Maybe just bugs in qemu? :-)

Max
Thomas Huth Oct. 11, 2019, 8:13 a.m. UTC | #3
On 11/10/2019 10.03, Max Reitz wrote:
> On 11.10.19 09:27, Thomas Huth wrote:
>> On 10/10/2019 17.24, Max Reitz wrote:
>>> Hi,
>>>
>>> Perhaps the main reason we cannot run important tests such as 041 in CI
>>> is that when they care Unix sockets in $TEST_DIR, the path may become
>>> too long to connect to them.
>>>
>>> To get by this problem, this series lets the check script create a new
>>> temporary directory (mktemp -d) and then makes the iotests use it for
>>> all Unix sockets.
>>
>> Thanks a lot for tackling this!
>>
>> I gave it a try, and most tests work fine now indeed when I run them in
>> a directory with a veeeery long file name.
>>
>> I still get an error with 028 though:
> 
> Hm, I didn’t see any error for 028 or 055 myself.  028 makes use of
> common.qemu, which uses FIFOs, and I thought there were exempt from this
> problem.  And for 055 I have no idea.
> 
> Maybe just bugs in qemu? :-)

Yeah, maybe... anyway, both, 028 and 055, are not in the auto group, so
I think we simply could ignore these bugs for now.

 Thomas
Max Reitz Oct. 11, 2019, 8:54 a.m. UTC | #4
On 11.10.19 09:27, Thomas Huth wrote:
> On 10/10/2019 17.24, Max Reitz wrote:
>> Hi,
>>
>> Perhaps the main reason we cannot run important tests such as 041 in CI
>> is that when they care Unix sockets in $TEST_DIR, the path may become
>> too long to connect to them.
>>
>> To get by this problem, this series lets the check script create a new
>> temporary directory (mktemp -d) and then makes the iotests use it for
>> all Unix sockets.
> 
> Thanks a lot for tackling this!
> 
> I gave it a try, and most tests work fine now indeed when I run them in
> a directory with a veeeery long file name.
> 
> I still get an error with 028 though:

I still don’t know about 055, but for 028 it looks like a race.

We have this:

> _send_qemu_cmd $h "drive_backup disk ${TEST_IMG}.copy" "(qemu)" >/dev/null
> _send_qemu_cmd $h "" "Formatting" | _filter_img_create

But it looks to me like the “Formatting” line comes earlier when the
path is longer.  No, I don’t know.

What I do know is that this looks wrong altogether.  Why would the
(qemu) prompt necessarily appear before the “Formatting” message?  I
think the drive-backup job creates the image before it is guaranteed to
yield.

So I think the solution is to s/(qemu)/Formatting/ in the expected
return value, replace the “"" "Formatting"” line by “"" "(qemu)"”, and
drop the “Formatting” output from the reference output.  (And add an
empty “(qemu)” line to the reference output.)

Max