Skip to contentSkip to conversation

iotests: Revert emulator selection to old behaviour

PATCH In review Kevin Wolf 5 participants 10 messages Feb 2, 2021

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 iotests: Revert emulator selection to old behaviour

If the qemu-system-{arch} binary for the host architecture can't be found, the old 'check' implementation selected the alphabetically first system emulator binary that it could find. The new Python implementation just uses the first result of glob.iglob(), which has an undefined order.

This is a problem that breaks CI because the iotests aren't actually prepared to run on any emulator. They should be, so this is really a bug in the failing test cases that should be fixed there, but as a quick fix, let's revert to the old behaviour to let CI runs succeed again.

---
 tests/qemu-iotests/testenv.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/testenv.py +1 -1
index b31275f518..1fbec854c1 100644
@@ -135,7 +135,7 @@ class TestEnv(ContextManager['TestEnv']):
         if not os.path.exists(self.qemu_prog):
             pattern = root('qemu-system-*')
             try:
-                progs = glob.iglob(pattern)
+                progs = sorted(glob.iglob(pattern))
                 self.qemu_prog = next(p for p in progs if isxfile(p))
             except StopIteration:
                 sys.exit("Not found any Qemu executable binary by pattern "
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Kevin Wolf

If the qemu-system-{arch} binary for the host architecture can't be found, the old 'check' implementation selected the alphabetically first system emulator binary that it could find. The new Python implementation just uses the first result of glob.iglob(), which has an undefined order.

This is a problem that breaks CI because the iotests aren't actually prepared to run on any emulator. They should be, so this is really a bug in the failing test cases that should be fixed there, but as a quick fix, let's revert to the old behaviour to let CI runs succeed again.

Quoted 4 lines
---
 tests/qemu-iotests/testenv.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by on v1 1/1
#2 lore raw
In reply to Kevin Wolf
Quoted 10 lines · Kevin Wolf

If the qemu-system-{arch} binary for the host architecture can't be found, the old 'check' implementation selected the alphabetically first system emulator binary that it could find. The new Python implementation just uses the first result of glob.iglob(), which has an undefined order.

This is a problem that breaks CI because the iotests aren't actually prepared to run on any emulator. They should be, so this is really a bug in the failing test cases that should be fixed there, but as a quick fix, let's revert to the old behaviour to let CI runs succeed again.

Deterministic CI is critically important.

Quoted 5 lines
---
 tests/qemu-iotests/testenv.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines
tests/qemu-iotests/testenv.py +1 -1
index b31275f518..1fbec854c1 100644
@@ -135,7 +135,7 @@ class TestEnv(ContextManager['TestEnv']):
         if not os.path.exists(self.qemu_prog):
             pattern = root('qemu-system-*')
             try:
-                progs = glob.iglob(pattern)
+                progs = sorted(glob.iglob(pattern))
                 self.qemu_prog = next(p for p in progs if isxfile(p))
             except StopIteration:
                 sys.exit("Not found any Qemu executable binary by pattern "
Signature · 1 line
2.29.2

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 :|
author
#3 lore raw

Am 02.02.2021 um 15:41 hat Daniel P. Berrangé geschrieben:

Quoted 7 lines · Kevin Wolf
Quoted 6 lines

If the qemu-system-{arch} binary for the host architecture can't be found, the old 'check' implementation selected the alphabetically first system emulator binary that it could find. The new Python implementation just uses the first result of glob.iglob(), which has an undefined order.

Quoted 6 lines
Quoted 4 lines

This is a problem that breaks CI because the iotests aren't actually prepared to run on any emulator. They should be, so this is really a bug in the failing test cases that should be fixed there, but as a quick fix, let's revert to the old behaviour to let CI runs succeed again.

Deterministic CI is critically important.

True. I didn't mean to imply that we don't want deterministic behaviour, but just that this hides some bugs in the test cases that we'll want to have fixed eventually, too.

Maybe we should rely on automatic picking less and specify different emulators explicitly in different CI jobs so that we don't only test the same binary over and over again and others not at all.

Kevin

#4 lore raw
In reply to Kevin Wolf
Quoted 10 lines · Kevin Wolf

If the qemu-system-{arch} binary for the host architecture can't be found, the old 'check' implementation selected the alphabetically first system emulator binary that it could find. The new Python implementation just uses the first result of glob.iglob(), which has an undefined order.

This is a problem that breaks CI because the iotests aren't actually prepared to run on any emulator. They should be, so this is really a bug in the failing test cases that should be fixed there, but as a quick fix, let's revert to the old behaviour to let CI runs succeed again.

FWIW this is the same problem I had 1 year ago and tried to fix it by sending QMP 'query-version' (introduced in v0.14):
https://www.mail-archive.com/[email protected]/msg675075.html

Quoted 20 lines
---
 tests/qemu-iotests/testenv.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/testenv.py +1 -1
index b31275f518..1fbec854c1 100644
@@ -135,7 +135,7 @@ class TestEnv(ContextManager['TestEnv']):
         if not os.path.exists(self.qemu_prog):
             pattern = root('qemu-system-*')
             try:
-                progs = glob.iglob(pattern)
+                progs = sorted(glob.iglob(pattern))
                 self.qemu_prog = next(p for p in progs if isxfile(p))
             except StopIteration:
                 sys.exit("Not found any Qemu executable binary by pattern "
#5 lore raw

Forgot to Cc Wainer & Willian in case they are interested in providing a better long term fix.

Quoted 15 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Kevin Wolf

If the qemu-system-{arch} binary for the host architecture can't be found, the old 'check' implementation selected the alphabetically first system emulator binary that it could find. The new Python implementation just uses the first result of glob.iglob(), which has an undefined order.

This is a problem that breaks CI because the iotests aren't actually prepared to run on any emulator. They should be, so this is really a bug in the failing test cases that should be fixed there, but as a quick fix, let's revert to the old behaviour to let CI runs succeed again.

FWIW this is the same problem I had 1 year ago and tried to fix it by sending QMP 'query-version' (introduced in v0.14):
https://www.mail-archive.com/[email protected]/msg675075.html

#6 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé
Quoted 6 lines · Kevin Wolf

If the qemu-system-{arch} binary for the host architecture can't be found, the old 'check' implementation selected the alphabetically first system emulator binary that it could find. The new Python implementation just uses the first result of glob.iglob(), which has an undefined order.

Quoted 8 lines
Quoted 4 lines

This is a problem that breaks CI because the iotests aren't actually prepared to run on any emulator. They should be, so this is really a bug in the failing test cases that should be fixed there, but as a quick fix, let's revert to the old behaviour to let CI runs succeed again.

FWIW this is the same problem I had 1 year ago and tried to fix it by sending QMP 'query-version' (introduced in v0.14):
https://www.mail-archive.com/[email protected]/msg675075.html

In the current failures the issue isn't the version number. Rather some of the tests (mistakenly) assume the emulator supports PCI, and we're randomly sometimes picking emulator targets that lack PCI.

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 :|
#7 lore raw
Quoted 13 lines · Daniel P. Berrangé
Quoted 12 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Kevin Wolf

If the qemu-system-{arch} binary for the host architecture can't be found, the old 'check' implementation selected the alphabetically first system emulator binary that it could find. The new Python implementation just uses the first result of glob.iglob(), which has an undefined order.

This is a problem that breaks CI because the iotests aren't actually prepared to run on any emulator. They should be, so this is really a bug in the failing test cases that should be fixed there, but as a quick fix, let's revert to the old behaviour to let CI runs succeed again.

Quoted 7 lines
Quoted 3 lines

FWIW this is the same problem I had 1 year ago and tried to fix it by sending QMP 'query-version' (introduced in v0.14):
https://www.mail-archive.com/[email protected]/msg675075.html

In the current failures the issue isn't the version number. Rather some of the tests (mistakenly) assume the emulator supports PCI, and we're randomly sometimes picking emulator targets that lack PCI.

Then this patch from the same series:
https://www.mail-archive.com/[email protected]/msg675088.html

It queries TYPE_DEVICE, but we can query TYPE_PCI_DEVICE too, which should be selected if a machine have a TYPE_PCI_HOST_BRIDGE providing a TYPE_PCI_BUS.

Anyway the idea is to query the binary with QMP to see if it makes sens to run the test with it.

Regards,

Phil.

Reviewed-by on v1 1/1
#8 lore raw
In reply to Kevin Wolf
Quoted 11 lines · Kevin Wolf

If the qemu-system-{arch} binary for the host architecture can't be found, the old 'check' implementation selected the alphabetically first system emulator binary that it could find. The new Python implementation just uses the first result of glob.iglob(), which has an undefined order.

This is a problem that breaks CI because the iotests aren't actually prepared to run on any emulator. They should be, so this is really a bug in the failing test cases that should be fixed there, but as a quick fix, let's revert to the old behaviour to let CI runs succeed again.

Quoted 4 lines
---
 tests/qemu-iotests/testenv.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

As fixing the tests is indeed more work than sorting the glob results, this one-liner is worth checking.

Quoted 15 lines
tests/qemu-iotests/testenv.py +1 -1
index b31275f518..1fbec854c1 100644
@@ -135,7 +135,7 @@ class TestEnv(ContextManager['TestEnv']):
         if not os.path.exists(self.qemu_prog):
             pattern = root('qemu-system-*')
             try:
-                progs = glob.iglob(pattern)
+                progs = sorted(glob.iglob(pattern))
                 self.qemu_prog = next(p for p in progs if isxfile(p))
             except StopIteration:
                 sys.exit("Not found any Qemu executable binary by pattern "
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
Reviewed-by on v1 1/1
#9 lore raw
In reply to Kevin Wolf
Quoted 22 lines · Kevin Wolf

If the qemu-system-{arch} binary for the host architecture can't be found, the old 'check' implementation selected the alphabetically first system emulator binary that it could find. The new Python implementation just uses the first result of glob.iglob(), which has an undefined order.

This is a problem that breaks CI because the iotests aren't actually prepared to run on any emulator. They should be, so this is really a bug in the failing test cases that should be fixed there, but as a quick fix, let's revert to the old behaviour to let CI runs succeed again.

---
  tests/qemu-iotests/testenv.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/testenv.py +0 -0
index b31275f518..1fbec854c1 100644

tests/qemu-iotests/testenv.py class TestEnv(ContextManager['TestEnv']): · line 141

Quoted 8 lines
tests/qemu-iotests/testenv.py +1 -1
@@ -135,7 +135,7 @@ class TestEnv(ContextManager['TestEnv']):
          if not os.path.exists(self.qemu_prog):
              pattern = root('qemu-system-*')
              try:
-                progs = glob.iglob(pattern)
+                progs = sorted(glob.iglob(pattern))
                  self.qemu_prog = next(p for p in progs if isxfile(p))
              except StopIteration:
                  sys.exit("Not found any Qemu executable binary by pattern "

Great that you find the problem! Anyway sorted is better than random. Probably we should print some warning when we have to chose from several binaries.. But nobody will read it anyway.

Signature · 2 lines
Best regards,
Vladimir