Skip to contentSkip to conversation

qemu-iotests: workaround to avoid Python3 while running tests on Fedora Docker image

Qemu-devel Philippe Mathieu-Daudé 3 participants 4 messages Jul 17, 2018 – Jul 18, 2018

lore
Share & tools
lore
#0 lore raw

I noticed this while running "make docker-test-block@fedora":

$ make docker-test-block@fedora NETWORK=1
  BUILD   fedora
    RUN test-block in qemu:fedora
Configure options:
--enable-werror --prefix=/tmp/qemu-test/install
--python=/usr/bin/python3 --target-list=x86_64-softmmu
...
python            /usr/bin/python3 -B
...

194 - output mismatch (see 194.out.bad)
--- /tmp/qemu-test/src/tests/qemu-iotests/194.out 2018-07-17
22:51:10.000000000 +0000
+++ /tmp/qemu-test/build/tests/qemu-iotests/194.out.bad 2018-07-17 22:58:01.646916625 +0000
@@ -1,18 +1,18 @@
Launching VMs...
Launching NBD server on destination...
-{u'return': {}}
-{u'return': {}}
+{'return': {}}
+{'return': {}}

and many more errors, until:

Failures: 045 132 148 152 162 169 194 205 208 218 222 Failed 11 of 49 tests
Test failed: iotests raw

All failures are due to Python2 syntax.
I started to fix but noticed there are too many and this isn't to correct fix for this release.

I suppose we don't want to use Py3 for iotests.

The bisect was obvious =)

commit 356dc290f0ef930a24b6af3a0908b1cb58ad47c9
Author: Daniel P. Berrange <[email protected]>
Date: Tue Jan 16 13:42:17 2018 +0000

docker: change Fedora images to run with python3

Fedora has switched to Python 3 by default, so it makes sense to use that for testing QEMU builds, so we get testing of Python 3 compatibility.

which added:

ENV QEMU_CONFIGURE_OPTS --python=/usr/bin/python3

I then figured out we can use EXTRA_CONFIGURE_OPTS:

$ make docker-test-block@fedora NETWORK=1 \
  EXTRA_CONFIGURE_OPTS=--python=/usr/bin/python2
  COPY    RUNNER
    RUN test-block in qemu:fedora
Configure options:
--enable-werror --prefix=/tmp/qemu-test/install
--python=/usr/bin/python3 --python=/usr/bin/python2
--target-list=x86_64-softmmu
...
python            /usr/bin/python2 -B
...
Passed all 48 tests
PLATFORM      -- Linux/aarch64 757be6ea0325 4.15.0-20-generic

So let's use this simple workaround :)

EXTRA_CONFIGURE_OPTS=--python=/usr/bin/python2

Regards,

Phil.

#1 lore raw
Quoted 27 lines · Philippe Mathieu-Daudé

I noticed this while running "make docker-test-block@fedora":

$ make docker-test-block@fedora NETWORK=1
  BUILD   fedora
    RUN test-block in qemu:fedora
Configure options:
--enable-werror --prefix=/tmp/qemu-test/install
--python=/usr/bin/python3 --target-list=x86_64-softmmu
...
python            /usr/bin/python3 -B
...

194 - output mismatch (see 194.out.bad)
--- /tmp/qemu-test/src/tests/qemu-iotests/194.out 2018-07-17
22:51:10.000000000 +0000
+++ /tmp/qemu-test/build/tests/qemu-iotests/194.out.bad 2018-07-17 22:58:01.646916625 +0000

(quoted diff) +2 -2
@@ -1,18 +1,18 @@
 Launching VMs...
 Launching NBD server on destination...
-{u'return': {}}
-{u'return': {}}
+{'return': {}}
+{'return': {}}
 

and many more errors, until:

Quoted 7 lines

Failures: 045 132 148 152 162 169 194 205 208 218 222 Failed 11 of 49 tests
Test failed: iotests raw

All failures are due to Python2 syntax.
I started to fix but noticed there are too many and this isn't to correct fix for this release.

Were they all due to the unicode string prefix, or where there difference failures too ?

The unicode string prefix could probably be fixed once by changing the log() method in iotests.py to have a built-in filter that chomps the leading 'u'

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#2 lore raw
Quoted 39 lines · Daniel P. Berrangé
Quoted 27 lines · Philippe Mathieu-Daudé

I noticed this while running "make docker-test-block@fedora":

$ make docker-test-block@fedora NETWORK=1
  BUILD   fedora
    RUN test-block in qemu:fedora
Configure options:
--enable-werror --prefix=/tmp/qemu-test/install
--python=/usr/bin/python3 --target-list=x86_64-softmmu
...
python            /usr/bin/python3 -B
...

194 - output mismatch (see 194.out.bad)
--- /tmp/qemu-test/src/tests/qemu-iotests/194.out 2018-07-17
22:51:10.000000000 +0000
+++ /tmp/qemu-test/build/tests/qemu-iotests/194.out.bad 2018-07-17 22:58:01.646916625 +0000

(quoted diff) +2 -2
@@ -1,18 +1,18 @@
 Launching VMs...
 Launching NBD server on destination...
-{u'return': {}}
-{u'return': {}}
+{'return': {}}
+{'return': {}}
 

and many more errors, until:

Quoted 7 lines

Failures: 045 132 148 152 162 169 194 205 208 218 222 Failed 11 of 49 tests
Test failed: iotests raw

All failures are due to Python2 syntax.
I started to fix but noticed there are too many and this isn't to correct fix for this release.

Were they all due to the unicode string prefix, or where there difference failures too ?

Quoted 3 lines

The unicode string prefix could probably be fixed once by changing the log() method in iotests.py to have a built-in filter that chomps the leading 'u'

We can implement more consistent behavior by making the QMP methods return a dictionary object with a custom __unicode__() method.

Using JSON when printing QMP messages (instead of the default repr() output) is probably a good idea everywhere (not just on iotests).

Signature · 1 line
Eduardo
#3 lore raw
In reply to Daniel P. Berrangé

Hi Daniel,

Quoted 32 lines · Daniel P. Berrangé
Quoted 31 lines · Philippe Mathieu-Daudé

I noticed this while running "make docker-test-block@fedora":

$ make docker-test-block@fedora NETWORK=1
  BUILD   fedora
    RUN test-block in qemu:fedora
Configure options:
--enable-werror --prefix=/tmp/qemu-test/install
--python=/usr/bin/python3 --target-list=x86_64-softmmu
...
python            /usr/bin/python3 -B
...

194 - output mismatch (see 194.out.bad)
--- /tmp/qemu-test/src/tests/qemu-iotests/194.out 2018-07-17
22:51:10.000000000 +0000
+++ /tmp/qemu-test/build/tests/qemu-iotests/194.out.bad 2018-07-17 22:58:01.646916625 +0000

(quoted diff) +2 -2
@@ -1,18 +1,18 @@
 Launching VMs...
 Launching NBD server on destination...
-{u'return': {}}
-{u'return': {}}
+{'return': {}}
+{'return': {}}
 

and many more errors, until:

Failures: 045 132 148 152 162 169 194 205 208 218 222 Failed 11 of 49 tests
Test failed: iotests raw

Quoted 6 lines
Quoted 3 lines

All failures are due to Python2 syntax.
I started to fix but noticed there are too many and this isn't to correct fix for this release.

Were they all due to the unicode string prefix, or where there difference failures too ?

3 more kinds:

148 [failed, exit status 1] - output mismatch (see 148.out.bad)
--- /tmp/qemu-test/src/tests/qemu-iotests/148.out 2018-07-18
13:20:17.000000000 +0000
+++ /tmp/qemu-test/build/tests/qemu-iotests/148.out.bad 2018-07-18
13:25:58.649302935 +0000
@@ -1,5 +1,8 @@
-..
-----------------------------------------------------------------------
-Ran 2 tests
-
-OK
+Traceback (most recent call last):
+ File "148", line 139, in <module>
+ iotests.verify_quorum()
+ File "/tmp/qemu-test/src/tests/qemu-iotests/iotests.py", line 657, in verify_quorum
+ if not supports_quorum():
+ File "/tmp/qemu-test/src/tests/qemu-iotests/iotests.py", line 653, in supports_quorum
+ return 'quorum' in qemu_img_pipe('--help')
+TypeError: a bytes-like object is required, not 'str'

169 [failed, exit status 1] - output mismatch (see 169.out.bad)
--- /tmp/qemu-test/src/tests/qemu-iotests/169.out 2018-07-18
13:20:17.000000000 +0000
+++ /tmp/qemu-test/build/tests/qemu-iotests/169.out.bad 2018-07-18
13:26:49.594192720 +0000
@@ -1,5 +1,4 @@
-................
-----------------------------------------------------------------------
-Ran 16 tests
-
-OK
+Traceback (most recent call last):
+ File "169", line 26, in <module>
+ import new
+ModuleNotFoundError: No module named 'new'

205 [failed, exit status 1] - output mismatch (see 205.out.bad)
--- /tmp/qemu-test/src/tests/qemu-iotests/205.out 2018-07-18
13:20:17.000000000 +0000
+++ /tmp/qemu-test/build/tests/qemu-iotests/205.out.bad 2018-07-18
13:27:46.775187975 +0000
@@ -1,5 +1,97 @@
-.......
+EEEFFFF
+======================================================================
+ERROR: test_connect_after_remove_default (__main__.TestNbdServerRemove)
+----------------------------------------------------------------------
+Traceback (most recent call last):
+ File "205", line 96, in test_connect_after_remove_default
+ self.do_test_connect_after_remove()
+ File "205", line 87, in do_test_connect_after_remove
+ self.assertReadOk(qemu_io(*args))
+ File "205", line 71, in assertReadOk
+ filter_qemu_io(qemu_io_output).strip(),
+ File "/tmp/qemu-test/src/tests/qemu-iotests/iotests.py", line 218, in filter_qemu_io
+ msg = filter_win32(msg)
+ File "/tmp/qemu-test/src/tests/qemu-iotests/iotests.py", line 214, in filter_win32
+ return win32_re.sub("", msg)
+TypeError: cannot use a string pattern on a bytes-like object