[PATCH v3 4/5] tests/functional/ppc64/pseries: Inherit from MigrationTest

Fabiano Rosas posted 5 patches 1 month, 1 week ago
Maintainers: Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Nicholas Piggin <npiggin@gmail.com>, Harsh Prateek Bora <harshpb@linux.ibm.com>
There is a newer version of this series
[PATCH v3 4/5] tests/functional/ppc64/pseries: Inherit from MigrationTest
Posted by Fabiano Rosas 1 month, 1 week ago
Make the PseriesMachine class inherit from MigrationTest so the next
patch can access migration routines without needing to instantiate a
MigrationTest object. This is just for cleanliness of the code.

Note that creating a separate class for migration wouldn't work quite
well because the class attributes of PseriesMachine would then have to
be exposed to that class somehow.

Suggested-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/functional/ppc64/test_pseries.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/functional/ppc64/test_pseries.py b/tests/functional/ppc64/test_pseries.py
index b45763c305..ce39e16a22 100755
--- a/tests/functional/ppc64/test_pseries.py
+++ b/tests/functional/ppc64/test_pseries.py
@@ -11,7 +11,7 @@
 from qemu_test import wait_for_console_pattern
 from test_migration import PpcMigrationTest
 
-class PseriesMachine(QemuSystemTest):
+class PseriesMachine(MigrationTest):
 
     timeout = 90
     KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
@@ -116,11 +116,11 @@ def test_ppc64_linux_migration(self):
         wait_for_console_pattern(self, console_pattern, self.panic_message,
                                  vm=source_vm)
 
-        PpcMigrationTest().do_migrate_ppc64_linux(source_vm, dest_vm);
+        self.do_migrate_ppc64_linux(source_vm, dest_vm);
 
         # ensure the boot proceeds after migration
         wait_for_console_pattern(self, self.good_message, self.panic_message,
                                  vm=dest_vm)
 
 if __name__ == '__main__':
-    QemuSystemTest.main()
+    MigrationTest.main()
-- 
2.51.0
Re: [PATCH v3 4/5] tests/functional/ppc64/pseries: Inherit from MigrationTest
Posted by Thomas Huth 1 month, 1 week ago
On 03/03/2026 14.43, Fabiano Rosas wrote:
> Make the PseriesMachine class inherit from MigrationTest so the next
> patch can access migration routines without needing to instantiate a
> MigrationTest object. This is just for cleanliness of the code.
> 
> Note that creating a separate class for migration wouldn't work quite
> well because the class attributes of PseriesMachine would then have to
> be exposed to that class somehow.
> 
> Suggested-by: Peter Xu <peterx@redhat.com>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   tests/functional/ppc64/test_pseries.py | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/functional/ppc64/test_pseries.py b/tests/functional/ppc64/test_pseries.py
> index b45763c305..ce39e16a22 100755
> --- a/tests/functional/ppc64/test_pseries.py
> +++ b/tests/functional/ppc64/test_pseries.py
> @@ -11,7 +11,7 @@
>   from qemu_test import wait_for_console_pattern
>   from test_migration import PpcMigrationTest
>   
> -class PseriesMachine(QemuSystemTest):
> +class PseriesMachine(MigrationTest):

This patch does not work (without the following one). You only import 
PpcMigrationTest, but not MigrationTest, so inheriting from MigrationTest is 
not possible here...

>       timeout = 90
>       KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
> @@ -116,11 +116,11 @@ def test_ppc64_linux_migration(self):
>           wait_for_console_pattern(self, console_pattern, self.panic_message,
>                                    vm=source_vm)
>   
> -        PpcMigrationTest().do_migrate_ppc64_linux(source_vm, dest_vm);
> +        self.do_migrate_ppc64_linux(source_vm, dest_vm);

... and do_migrate_ppc64_linux is also not a method of MigrationTest.

Easiest fix: Squash this patch with the next one. Otherwise you have to take 
the detour through inheriting from PpcMigrationTest here.

  Thomas


>           # ensure the boot proceeds after migration
>           wait_for_console_pattern(self, self.good_message, self.panic_message,
>                                    vm=dest_vm)
>   
>   if __name__ == '__main__':
> -    QemuSystemTest.main()
> +    MigrationTest.main()
Re: [PATCH v3 4/5] tests/functional/ppc64/pseries: Inherit from MigrationTest
Posted by Fabiano Rosas 1 month, 1 week ago
Thomas Huth <thuth@redhat.com> writes:

> On 03/03/2026 14.43, Fabiano Rosas wrote:
>> Make the PseriesMachine class inherit from MigrationTest so the next
>> patch can access migration routines without needing to instantiate a
>> MigrationTest object. This is just for cleanliness of the code.
>> 
>> Note that creating a separate class for migration wouldn't work quite
>> well because the class attributes of PseriesMachine would then have to
>> be exposed to that class somehow.
>> 
>> Suggested-by: Peter Xu <peterx@redhat.com>
>> Signed-off-by: Fabiano Rosas <farosas@suse.de>
>> ---
>>   tests/functional/ppc64/test_pseries.py | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>> 
>> diff --git a/tests/functional/ppc64/test_pseries.py b/tests/functional/ppc64/test_pseries.py
>> index b45763c305..ce39e16a22 100755
>> --- a/tests/functional/ppc64/test_pseries.py
>> +++ b/tests/functional/ppc64/test_pseries.py
>> @@ -11,7 +11,7 @@
>>   from qemu_test import wait_for_console_pattern
>>   from test_migration import PpcMigrationTest
>>   
>> -class PseriesMachine(QemuSystemTest):
>> +class PseriesMachine(MigrationTest):
>
> This patch does not work (without the following one). You only import 
> PpcMigrationTest, but not MigrationTest, so inheriting from MigrationTest is 
> not possible here...
>

Ouch, sorry. I'll repost.