mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
iotests: Add filter_qtest()
The open-coded form of this filter has been copied into enough tests that it's better to move it into iotests.py. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Eric Blake <eblake@redhat.com> Message-ID: <20250204211407.381505-15-kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
2e73a17c68
commit
ed26db8367
5 changed files with 10 additions and 12 deletions
|
@ -1100,10 +1100,8 @@ class TestRepairQuorum(iotests.QMPTestCase):
|
|||
|
||||
# Check the full error message now
|
||||
self.vm.shutdown()
|
||||
log = self.vm.get_log()
|
||||
log = re.sub(r'^\[I \d+\.\d+\] OPENED\n', '', log)
|
||||
log = iotests.filter_qtest(self.vm.get_log())
|
||||
log = re.sub(r'^Formatting.*\n', '', log)
|
||||
log = re.sub(r'\n\[I \+\d+\.\d+\] CLOSED\n?$', '', log)
|
||||
log = re.sub(r'^%s: ' % os.path.basename(iotests.qemu_prog), '', log)
|
||||
|
||||
self.assertEqual(log,
|
||||
|
|
|
@ -82,9 +82,7 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase):
|
|||
self.vm.shutdown()
|
||||
|
||||
#catch 'Persistent bitmaps are lost' possible error
|
||||
log = self.vm.get_log()
|
||||
log = re.sub(r'^\[I \d+\.\d+\] OPENED\n', '', log)
|
||||
log = re.sub(r'\[I \+\d+\.\d+\] CLOSED\n?$', '', log)
|
||||
log = iotests.filter_qtest(self.vm.get_log())
|
||||
if log:
|
||||
print(log)
|
||||
|
||||
|
|
|
@ -701,6 +701,10 @@ def filter_qmp_imgfmt(qmsg):
|
|||
def filter_nbd_exports(output: str) -> str:
|
||||
return re.sub(r'((min|opt|max) block): [0-9]+', r'\1: XXX', output)
|
||||
|
||||
def filter_qtest(output: str) -> str:
|
||||
output = re.sub(r'^\[I \d+\.\d+\] OPENED\n', '', output)
|
||||
output = re.sub(r'\n?\[I \+\d+\.\d+\] CLOSED\n?$', '', output)
|
||||
return output
|
||||
|
||||
Msg = TypeVar('Msg', Dict[str, Any], List[Any], str)
|
||||
|
||||
|
|
|
@ -95,8 +95,7 @@ class TestCbwError(iotests.QMPTestCase):
|
|||
|
||||
self.vm.shutdown()
|
||||
log = self.vm.get_log()
|
||||
log = re.sub(r'^\[I \d+\.\d+\] OPENED\n', '', log)
|
||||
log = re.sub(r'\[I \+\d+\.\d+\] CLOSED\n?$', '', log)
|
||||
log = iotests.filter_qtest(log)
|
||||
log = iotests.filter_qemu_io(log)
|
||||
return log
|
||||
|
||||
|
|
|
@ -122,11 +122,10 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase):
|
|||
|
||||
# catch 'Could not reopen qcow2 layer: Bitmap already exists'
|
||||
# possible error
|
||||
log = self.vm_a.get_log()
|
||||
log = re.sub(r'^\[I \d+\.\d+\] OPENED\n', '', log)
|
||||
log = re.sub(r'^(wrote .* bytes at offset .*\n.*KiB.*ops.*sec.*\n){3}',
|
||||
log = iotests.filter_qtest(self.vm_a.get_log())
|
||||
log = re.sub(r'^(wrote .* bytes at offset .*\n'
|
||||
r'.*KiB.*ops.*sec.*\n?){3}',
|
||||
'', log)
|
||||
log = re.sub(r'\[I \+\d+\.\d+\] CLOSED\n?$', '', log)
|
||||
self.assertEqual(log, '')
|
||||
|
||||
# test that bitmap is still persistent
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue