scripts/migration: Fix analyze-migration.py and add a test
v2 cover scripts/migration: Fix analyze-migration.py and add a test
was: [PATCH] qtest/migration: Add a test for the analyze-migration script
https://lore.kernel.org/r/[email protected]
The analyze-migration.py script should be kept in sync with the code that generates the migration stream. The addition/removal of sections and flags from the stream can cause the script to break. Issues when parsing the stream mostly manifest in the form of cryptic python errors such as:
Looking at git log, it seems that this is a fairly useful script for people debugging issues with the migration stream. Let's add a test for it to catch bugs early avoid keeping a broken script in the tree.
People suggested putting this in avocado or a dedicated shell script. I hope looking at the patches it becomes clear that it's best to have this along with migration-test. Mostly to avoid duplicating capabilities code and arch-specific flags.
CI run: https://gitlab.com/farosas/qemu/-/pipelines/1030789937
Fabiano Rosas (5):
migration: Fix analyze-migration.py 'configuration' parsing
migration: Add capability parsing to analyze-migration.py
migration: Fix analyze-migration.py when ignore-shared is used
migration: Fix analyze-migration read operation signedness tests/qtest/migration: Add a test for the analyze-migration script
Nikolay Borisov (1):
migration: Add the configuration vmstate to the json writer
migration/migration.c | 1 + migration/savevm.c | 20 ++++++++--- scripts/analyze-migration.py | 67 ++++++++++++++++++++++++++++++++---- tests/qtest/meson.build | 2 ++ tests/qtest/migration-test.c | 60 ++++++++++++++++++++++++++++++++ 5 files changed, 139 insertions(+), 11 deletions(-)
Signature · 1 line
2.35.3
PATCH v2 1/6 migration: Add the configuration vmstate to the json writer
From: Nikolay Borisov <[email protected]>
Make the migration json writer part of MigrationState struct, allowing the 'configuration' object be serialized to json.
This will facilitate the parsing of the 'configuration' object in the next patch that fixes analyze-migration.py for arm.
---
farosas: rewrote the commit message. The previous one was tied to fixed-ram.
--- migration/migration.c | 1 + migration/savevm.c | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-)
migration/migration.c +1 -0
@@ -1430,6 +1430,7 @@ int migrate_init(MigrationState *s, Error **errp)error_free (s->error); s->error =NULL ; s->hostname =NULL ; + s->vmdesc =NULL ;migrate_set_state (&s->state,MIGRATION_STATUS_NONE ,MIGRATION_STATUS_SETUP );
migration/savevm.c +16 -4
@@ -1217,13 +1217,27 @@ void qemu_savevm_non_migratable_list(strList **reasons)void qemu_savevm_state_header (QEMUFile *f) { +MigrationState *s =migrate_get_current (); + + s->vmdesc =json_writer_new (false); +trace_savevm_state_header ();qemu_put_be32 (f,QEMU_VM_FILE_MAGIC );qemu_put_be32 (f,QEMU_VM_FILE_VERSION ); -if (migrate_get_current ()->send_configuration) { +if (s->send_configuration) {qemu_put_byte (f,QEMU_VM_CONFIGURATION ); -vmstate_save_state (f, &vmstate_configuration, &savevm_state,0 ); + +/* +* This starts the main json object and is paired with the +* json_writer_end_object in +* qemu_savevm_state_complete_precopy_non_iterable +*/ +json_writer_start_object (s->vmdesc,NULL ); + +json_writer_start_object (s->vmdesc,"configuration" ); +vmstate_save_state (f, &vmstate_configuration, &savevm_state, s->vmdesc); +json_writer_end_object (s->vmdesc); } }
@@ -1272,8 +1286,6 @@ void qemu_savevm_state_setup(QEMUFile *f)Error *local_err =NULL ;int ret; - ms->vmdesc =json_writer_new (false); -json_writer_start_object (ms->vmdesc,NULL );json_writer_int64 (ms->vmdesc,"page_size" ,qemu_target_page_size ());json_writer_start_array (ms->vmdesc,"devices" );
Signature · 1 line
2.35.3
Re: [PATCH v2 1/6] migration: Add the configuration vmstate to the json writer
Quoted 10 lines · Fabiano Rosas
From: Nikolay Borisov <[email protected]>
Make the migration json writer part of MigrationState struct, allowing the 'configuration' object be serialized to json.
This will facilitate the parsing of the 'configuration' object in the next patch that fixes
analyze-migration.pyfor arm.Signed-off-by Nikolay Borisov <[email protected]>Signed-off-by Fabiano Rosas <[email protected]>
queued.
migration/savevm.c void qemu_savevm_non_migratable_list(strList **reasons) · line 1236
Quoted 9 lines
qemu_put_byte(f, QEMU_VM_CONFIGURATION);migration/savevm.c +7
-1-vmstate_save_state (f, &vmstate_configuration, &savevm_state,0 ); + +/* +* This starts the main json object and is paired with the +* json_writer_end_object in +* qemu_savevm_state_complete_precopy_non_iterable +*/ +json_writer_start_object (s->vmdesc,NULL );
This don't depend of this patch, but it is ugly as hell.
Can we create:
json_write_start_main_object(s->vmdesc);
(equivalent for end)
And forbid json_writer_start_object() for taking a NULL parameter?
Later, Juan.
Re: [PATCH v2 1/6] migration: Add the configuration vmstate to the json writer
Quoted 30 lines · Juan Quintela
Quoted 10 lines · Fabiano Rosas
From: Nikolay Borisov <[email protected]>
Make the migration json writer part of MigrationState struct, allowing the 'configuration' object be serialized to json.
This will facilitate the parsing of the 'configuration' object in the next patch that fixes
analyze-migration.pyfor arm.Signed-off-by Nikolay Borisov <[email protected]>Signed-off-by Fabiano Rosas <[email protected]>Reviewed-by Juan Quintela <[email protected]>queued.
migration/savevm.c void qemu_savevm_non_migratable_list(strList **reasons) · line 1236
Quoted 9 lines
qemu_put_byte(f, QEMU_VM_CONFIGURATION);migration/savevm.c +7
-1-vmstate_save_state (f, &vmstate_configuration, &savevm_state,0 ); + +/* +* This starts the main json object and is paired with the +* json_writer_end_object in +* qemu_savevm_state_complete_precopy_non_iterable +*/ +json_writer_start_object (s->vmdesc,NULL );This don't depend of this patch, but it is ugly as hell.
Can we create:
Quoted 7 lines
json_write_start_main_object(s->vmdesc);(equivalent for end)
And forbid
json_writer_start_object()for taking a NULL parameter?Later, Juan.
Yep, I'll look into it.
PATCH v2 2/6 migration: Fix analyze-migration.py 'configuration' parsing
In reply to Fabiano RosasThe 'configuration' state subsections are currently not being parsed and the script fails when analyzing an aarch64 stream:
Traceback (most recent call last):
File "./scripts/analyze-migration.py", line 625, in <module>
dump.read(dump_memory = args.memory)
File "./scripts/analyze-migration.py", line 571, in read
raise Exception("Unknown section type: %d" % section_type)
Exception: Unknown section type: 5
--- scripts/analyze-migration.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
scripts/analyze-migration.py +14 -4
@@ -261,12 +261,21 @@ def getDict(self): class ConfigurationSection(object): - def __init__(self, file): + def __init__(self, file, desc): self.file = file + self.desc = desc def read(self): - name_len = self.file.read32() - name = self.file.readstr(len = name_len) + if self.desc: + version_id = self.desc['version'] + section = VMSDSection(self.file, version_id, self.desc, + 'configuration') + section.read() + else: + # backward compatibility for older streams that don't have + # the configuration section in the json + name_len = self.file.read32() + name = self.file.readstr(len = name_len) class VMSDFieldGeneric(object): def __init__(self, desc, file):
@@ -532,7 +541,8 @@ def read(self, desc_only = False, dump_memory = False, write_memory = False): if section_type == self.QEMU_VM_EOF: break elif section_type == self.QEMU_VM_CONFIGURATION: - section = ConfigurationSection(file) + config_desc = self.vmsd_desc.get('configuration') + section = ConfigurationSection(file, config_desc) section.read() elif section_type == self.QEMU_VM_SECTION_START or section_type == self.QEMU_VM_SECTION_FULL: section_id = file.read32()
Signature · 1 line
2.35.3
Re: [PATCH v2 2/6] migration: Fix analyze-migration.py 'configuration' parsing
Quoted 11 lines · Fabiano Rosas
The 'configuration' state subsections are currently not being parsed and the script fails when analyzing an aarch64 stream:
Traceback (most recent call last):
File "./scripts/analyze-migration.py", line 625, in <module>
dump.read(dump_memory = args.memory)
File "./scripts/analyze-migration.py", line 571, in read
raiseException("Unknown section type: %d" % section_type)
Exception: Unknown section type: 5Signed-off-by Fabiano Rosas <[email protected]>
PATCH v2 3/6 migration: Add capability parsing to analyze-migration.py
In reply to Fabiano RosasThe script is broken when the configuration/capabilities section is present. Add support for parsing the capabilities so we can fix it in the next patch.
--- scripts/analyze-migration.py | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
scripts/analyze-migration.py +38 -0
@@ -264,6 +264,24 @@ class ConfigurationSection(object): def __init__(self, file, desc): self.file = file self.desc = desc + self.caps = [] + + def parse_capabilities(self, vmsd_caps): + if not vmsd_caps: + return + + ncaps = vmsd_caps.data['caps_count'].data + self.caps = vmsd_caps.data['capabilities'] + + if type(self.caps) != list: + self.caps = [self.caps] + + if len(self.caps) != ncaps: + raise Exception("Number of capabilities doesn't match " + "caps_count field") + + def has_capability(self, cap): + return any([str(c) == cap for c in self.caps]) def read(self): if self.desc:
@@ -271,6 +289,8 @@ def read(self): section = VMSDSection(self.file, version_id, self.desc, 'configuration') section.read() + self.parse_capabilities( + section.data.get("configuration/capabilities")) else: # backward compatibility for older streams that don't have # the configuration section in the json
@@ -297,6 +317,23 @@ def read(self): self.data = self.file.readvar(size) return self.data +class VMSDFieldCap(object): + def __init__(self, desc, file): + self.file = file + self.desc = desc + self.data = "" + + def __repr__(self): + return self.data + + def __str__(self): + return self.data + + def read(self): + len = self.file.read8() + self.data = self.file.readstr(len) + + class VMSDFieldInt(VMSDFieldGeneric): def __init__(self, desc, file): super(VMSDFieldInt, self).__init__(desc, file)
@@ -471,6 +508,7 @@ def getDict(self): "unused_buffer" : VMSDFieldGeneric, "bitmap" : VMSDFieldGeneric, "struct" : VMSDFieldStruct, + "capability": VMSDFieldCap, "unknown" : VMSDFieldGeneric, }
Signature · 1 line
2.35.3
Re: [PATCH v2 3/6] migration: Add capability parsing to analyze-migration.py
Quoted 5 lines · Fabiano Rosas
The script is broken when the configuration/capabilities section is present. Add support for parsing the capabilities so we can fix it in the next patch.
Signed-off-by Fabiano Rosas <[email protected]>
PATCH v2 4/6 migration: Fix analyze-migration.py when ignore-shared is used
In reply to Fabiano RosasThe script is currently broken when the x-ignore-shared capability is used:
Traceback (most recent call last):
File "./scripts/analyze-migration.py", line 656, in <module>
dump.read(dump_memory = args.memory)
File "./scripts/analyze-migration.py", line 593, in read
section.read()
File "./scripts/analyze-migration.py", line 163, in read
self.name = self.file.readstr(len = namelen)
File "./scripts/analyze-migration.py", line 53, in readstr
return self.readvar(len).decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 55: invalid start byte
We're currently adding data to the middle of the ram section depending on the presence of the capability. As a consequence, any code loading the ram section needs to know about capabilities so it can interpret the stream.
Skip the byte that's added when x-ignore-shared is used to fix the script.
--- scripts/analyze-migration.py | 5 +++++ 1 file changed, 5 insertions(+)
scripts/analyze-migration.py +5 -0
@@ -123,6 +123,7 @@ def __init__(self, file, version_id, ramargs, section_key): self.TARGET_PAGE_SIZE = ramargs['page_size'] self.dump_memory = ramargs['dump_memory'] self.write_memory = ramargs['write_memory'] + self.ignore_shared = ramargs['ignore_shared'] self.sizeinfo = collections.OrderedDict() self.data = collections.OrderedDict() self.data['section sizes'] = self.sizeinfo
@@ -169,6 +170,8 @@ def read(self): f.truncate(0) f.truncate(len) self.files[self.name] = f + if self.ignore_shared: + mr_addr = self.file.read64() flags &= ~self.RAM_SAVE_FLAG_MEM_SIZE if flags & self.RAM_SAVE_FLAG_COMPRESS:
@@ -572,6 +575,7 @@ def read(self, desc_only = False, dump_memory = False, write_memory = False): ramargs['page_size'] = self.vmsd_desc['page_size'] ramargs['dump_memory'] = dump_memory ramargs['write_memory'] = write_memory + ramargs['ignore_shared'] = False self.section_classes[('ram',0)][1] = ramargs while True:
@@ -582,6 +586,7 @@ def read(self, desc_only = False, dump_memory = False, write_memory = False): config_desc = self.vmsd_desc.get('configuration') section = ConfigurationSection(file, config_desc) section.read() + ramargs['ignore_shared'] = section.has_capability('x-ignore-shared') elif section_type == self.QEMU_VM_SECTION_START or section_type == self.QEMU_VM_SECTION_FULL: section_id = file.read32() name = file.readstr()
Signature · 1 line
2.35.3
Re: [PATCH v2 4/6] migration: Fix analyze-migration.py when ignore-shared is used
Quoted 19 lines · Fabiano Rosas
The script is currently broken when the x-ignore-shared capability is used:
Traceback (most recent call last):
File "./scripts/analyze-migration.py", line 656, in <module>
dump.read(dump_memory = args.memory)
File "./scripts/analyze-migration.py", line 593, in read
section.read()
File "./scripts/analyze-migration.py", line 163, in read
self.name =self.file.readstr(len = namelen)
File "./scripts/analyze-migration.py", line 53, in readstr
return self.readvar(len).decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte0x82in position 55: invalid start byteWe're currently adding data to the middle of the ram section depending on the presence of the capability. As a consequence, any code loading the ram section needs to know about capabilities so it can interpret the stream.
Quoted 4 lines
Skip the byte that's added when x-ignore-shared is used to fix the script.
Signed-off-by Fabiano Rosas <[email protected]>
scripts/analyze-migration.py def read(self, desc_only = False, dump_memory = False, write_memory = False): · line 589
Quoted 5 lines
scripts/analyze-migration.py +1
-0@@ -582,6 +586,7 @@ def read(self, desc_only = False, dump_memory = False, write_memory = False): config_desc = self.vmsd_desc.get('configuration') section = ConfigurationSection(file, config_desc) section.read() + ramargs['ignore_shared'] = section.has_capability('x-ignore-shared')
should we consider s/x-ignore-shared/ignore-shared/?
Quoted 3 lines
scripts/analyze-migration.py +0
-0elif section_type == self.QEMU_VM_SECTION_START or section_type == self.QEMU_VM_SECTION_FULL: section_id = file.read32() name = file.readstr()
Re: [PATCH v2 4/6] migration: Fix analyze-migration.py when ignore-shared is used
Quoted 27 lines · Juan Quintela
Quoted 19 lines · Fabiano Rosas
The script is currently broken when the x-ignore-shared capability is used:
Traceback (most recent call last):
File "./scripts/analyze-migration.py", line 656, in <module>
dump.read(dump_memory = args.memory)
File "./scripts/analyze-migration.py", line 593, in read
section.read()
File "./scripts/analyze-migration.py", line 163, in read
self.name =self.file.readstr(len = namelen)
File "./scripts/analyze-migration.py", line 53, in readstr
return self.readvar(len).decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte0x82in position 55: invalid start byteWe're currently adding data to the middle of the ram section depending on the presence of the capability. As a consequence, any code loading the ram section needs to know about capabilities so it can interpret the stream.
Quoted 4 lines
Skip the byte that's added when x-ignore-shared is used to fix the script.
Signed-off-by Fabiano Rosas <[email protected]>Reviewed-by Juan Quintela <[email protected]>
Quoted 8 lines
scripts/analyze-migration.py def read(self, desc_only = False, dump_memory = False, write_memory = False): · line 589
Quoted 5 lines
scripts/analyze-migration.py +1
-0@@ -582,6 +586,7 @@ def read(self, desc_only = False, dump_memory = False, write_memory = False): config_desc = self.vmsd_desc.get('configuration') section = ConfigurationSection(file, config_desc) section.read() + ramargs['ignore_shared'] = section.has_capability('x-ignore-shared')should we consider s/x-ignore-shared/ignore-shared/?
We can consider s/ignore-shared/x-ignore-shared/ if that's what you mean. The way you suggested doesn't work because the cap name comes from QEMU with the "x-" part in it.
If you meant filtering the x out when parsing the capabilities in this script, I think that would cause a sort of a UX issue because we need to use x-ignore-shared to set the cap in QMP/HMP.
Re: [PATCH v2 4/6] migration: Fix analyze-migration.py when ignore-shared is used
Quoted 38 lines · Fabiano Rosas
Quoted 27 lines · Juan Quintela
Quoted 19 lines · Fabiano Rosas
The script is currently broken when the x-ignore-shared capability is used:
Traceback (most recent call last):
File "./scripts/analyze-migration.py", line 656, in <module>
dump.read(dump_memory = args.memory)
File "./scripts/analyze-migration.py", line 593, in read
section.read()
File "./scripts/analyze-migration.py", line 163, in read
self.name =self.file.readstr(len = namelen)
File "./scripts/analyze-migration.py", line 53, in readstr
return self.readvar(len).decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte0x82in position 55: invalid start byteWe're currently adding data to the middle of the ram section depending on the presence of the capability. As a consequence, any code loading the ram section needs to know about capabilities so it can interpret the stream.
Quoted 4 lines
Skip the byte that's added when x-ignore-shared is used to fix the script.
Signed-off-by Fabiano Rosas <[email protected]>Reviewed-by Juan Quintela <[email protected]>Quoted 8 lines
scripts/analyze-migration.py def read(self, desc_only = False, dump_memory = False, write_memory = False): · line 589
Quoted 5 lines
scripts/analyze-migration.py +1
-0@@ -582,6 +586,7 @@ def read(self, desc_only = False, dump_memory = False, write_memory = False): config_desc = self.vmsd_desc.get('configuration') section = ConfigurationSection(file, config_desc) section.read() + ramargs['ignore_shared'] = section.has_capability('x-ignore-shared')should we consider s/x-ignore-shared/ignore-shared/?
Quoted 7 lines
We can consider s/ignore-shared/x-ignore-shared/ if that's what you mean. The way you suggested doesn't work because the cap name comes from QEMU with the "x-" part in it.
If you meant filtering the x out when parsing the capabilities in this script, I think that would cause a sort of a UX issue because we need to use x-ignore-shared to set the cap in QMP/HMP.
No.
I mean if we should start supporting ignore-shared.
Later, Juan.
PATCH v2 5/6 migration: Fix analyze-migration read operation signedness
In reply to Fabiano RosasThe migration code uses unsigned values for 16, 32 and 64-bit operations. Fix the script to do the same.
This was causing an issue when parsing the migration stream generated on the ppc64 target because one of instance_ids was larger than the 32bit signed maximum:
Traceback (most recent call last):
File "/home/fabiano/kvm/qemu/build/scripts/analyze-migration.py", line 658, in <module>
dump.read(dump_memory = args.memory)
File "/home/fabiano/kvm/qemu/build/scripts/analyze-migration.py", line 592, in read
classdesc = self.section_classes[section_key]
KeyError: ('spapr_iommu', -2147483648)
--- scripts/analyze-migration.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/analyze-migration.py +3 -3
@@ -38,13 +38,13 @@ def __init__(self, filename): self.file = open(self.filename, "rb") def read64(self): - return int.from_bytes(self.file.read(8), byteorder='big', signed=True) + return int.from_bytes(self.file.read(8), byteorder='big', signed=False) def read32(self): - return int.from_bytes(self.file.read(4), byteorder='big', signed=True) + return int.from_bytes(self.file.read(4), byteorder='big', signed=False) def read16(self): - return int.from_bytes(self.file.read(2), byteorder='big', signed=True) + return int.from_bytes(self.file.read(2), byteorder='big', signed=False) def read8(self): return int.from_bytes(self.file.read(1), byteorder='big', signed=True)
Signature · 1 line
2.35.3
Re: [PATCH v2 5/6] migration: Fix analyze-migration read operation signedness
Quoted 7 lines · Fabiano Rosas
The migration code uses unsigned values for 16, 32 and 64-bit operations. Fix the script to do the same.
This was causing an issue when parsing the migration stream generated on the ppc64 target because one of
instance_idswas larger than the 32bit signed maximum:
Quoted 8 lines
Traceback (most recent call last):
File "/home/fabiano/kvm/qemu/build/scripts/analyze-migration.py", line 658, in <module>
dump.read(dump_memory = args.memory)
File "/home/fabiano/kvm/qemu/build/scripts/analyze-migration.py", line 592, in read
classdesc = self.section_classes[section_key]
KeyError: ('spapr_iommu', -2147483648)Signed-off-by Fabiano Rosas <[email protected]>
PATCH v2 6/6 tests/qtest/migration: Add a test for the analyze-migration script
In reply to Fabiano RosasAdd a smoke test that migrates to a file and gives it to the script. It should catch the most annoying errors such as changes in the ram flags.
After code has been merged it becomes way harder to figure out what is causing the script to fail, the person making the change is the most likely to know right away what the problem is.
--- tests/qtest/meson.build | 2 ++ tests/qtest/migration-test.c | 60 ++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)
tests/qtest/meson.build +2 -0
@@ -356,6 +356,8 @@ foreach dir : target_dirs test_deps += [qsd] endif + qtest_env.set('PYTHON', python.full_path()) + foreach test : target_qtests # Executables are shared across targets, declare them only the first time we # encounter them
tests/qtest/migration-test.c +60 -0
78 lines not on this page · raw message
Signature · 1 line
2.35.3
Re: [PATCH v2 6/6] tests/qtest/migration: Add a test for the analyze-migration script
Quoted 8 lines · Fabiano Rosas
Add a smoke test that migrates to a file and gives it to the script. It should catch the most annoying errors such as changes in the ram flags.
After code has been merged it becomes way harder to figure out what is causing the script to fail, the person making the change is the most likely to know right away what the problem is.
Quoted 5 lines
Signed-off-by Fabiano Rosas <[email protected]>--- tests/qtest/meson.build | 2 ++ tests/qtest/migration-test.c | 60 ++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)
Re: [PATCH v2 6/6] tests/qtest/migration: Add a test for the analyze-migration script
In reply to Fabiano RosasQuoted 9 lines · Fabiano Rosas
Add a smoke test that migrates to a file and gives it to the script. It should catch the most annoying errors such as changes in the ram flags.
After code has been merged it becomes way harder to figure out what is causing the script to fail, the person making the change is the most likely to know right away what the problem is.
Signed-off-by Fabiano Rosas <[email protected]>
Quoted 10 lines
--- tests/qtest/meson.build | 2 ++ tests/qtest/migration-test.c | 60 ++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)tests/qtest/meson.build +0
-0
tests/qtest/meson.build foreach dir : target_dirs · line 360
Quoted 5 lines
tests/qtest/meson.build +2
-0@@ -356,6 +356,8 @@ foreach dir : target_dirs test_deps += [qsd] endif + qtest_env.set('PYTHON', python.full_path()) +
I accept it, but I think that this part of the test should be in a different patch so meson people could comment O:-)
tests/qtest/meson.build foreach dir : target_dirs · line 362
Quoted 2 lines
tests/qtest/meson.build +2
-0+ + pid = fork();
live and see, g_test and qemu don't have a function to execute a script? Wow.
Re: [PATCH v2 6/6] tests/qtest/migration: Add a test for the analyze-migration script
Quoted 33 lines · Juan Quintela
Quoted 9 lines · Fabiano Rosas
Add a smoke test that migrates to a file and gives it to the script. It should catch the most annoying errors such as changes in the ram flags.
After code has been merged it becomes way harder to figure out what is causing the script to fail, the person making the change is the most likely to know right away what the problem is.
Signed-off-by Fabiano Rosas <[email protected]>Reviewed-by Juan Quintela <[email protected]>Quoted 10 lines
--- tests/qtest/meson.build | 2 ++ tests/qtest/migration-test.c | 60 ++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)tests/qtest/meson.build +0
-0tests/qtest/meson.build foreach dir : target_dirs · line 360
Quoted 5 lines
tests/qtest/meson.build +2
-0@@ -356,6 +356,8 @@ foreach dir : target_dirs test_deps += [qsd] endif + qtest_env.set('PYTHON', python.full_path()) +I accept it, but I think that this part of the test should be in a different patch so meson people could comment O:-)
Quoted 4 lines
tests/qtest/meson.build foreach dir : target_dirs · line 362
Quoted 2 lines
tests/qtest/meson.build +2
-0+ + pid = fork();live and see,
g_testand qemu don't have a function to execute a script?
gtest has one to execute a _function_ in a fork, but fork+exec no.
Quoted 8 lines · Fabiano Rosas
was: [PATCH] qtest/migration: Add a test for the analyze-migration script
https://lore.kernel.org/r/[email protected]The
analyze-migration.pyscript should be kept in sync with the code that generates the migration stream. The addition/removal of sections and flags from the stream can cause the script to break. Issues when parsing the stream mostly manifest in the form of cryptic python errors such as:
Well, not _that_ cryptic. =)
I meant to add this:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 55:
invalid start byte