diff mbox series

[RFC,07/11] tests/avocado: Add ppc boot tests for non-free AIX images

Message ID 20231010075238.95646-8-npiggin@gmail.com
State New
Headers show
Series ppc: avocado test additions and new defaults | expand

Commit Message

Nicholas Piggin Oct. 10, 2023, 7:52 a.m. UTC
An AIX image can be provided by setting AIX_IMAGE environment
variable when running avocado.

It's questionable whether we should carry these in upstream QEMU.
It's convenient to see how to run these things, but simple enough
to maintain in out of tree branch. I just wanted to see opinions
about it.
---
 tests/avocado/ppc_aix.py | 63 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 tests/avocado/ppc_aix.py

Comments

Alex Bennée Oct. 10, 2023, 12:43 p.m. UTC | #1
Nicholas Piggin <npiggin@gmail.com> writes:

> An AIX image can be provided by setting AIX_IMAGE environment
> variable when running avocado.
>
> It's questionable whether we should carry these in upstream QEMU.
> It's convenient to see how to run these things, but simple enough
> to maintain in out of tree branch. I just wanted to see opinions
> about it.

Yeah there is no point adding a test no one else can run. We already
have tests that utilise dead URLs that can only run if you happen to
have the image in the avocado cache which should arguably be removed.

> ---
>  tests/avocado/ppc_aix.py | 63 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 63 insertions(+)
>  create mode 100644 tests/avocado/ppc_aix.py
>
> diff --git a/tests/avocado/ppc_aix.py b/tests/avocado/ppc_aix.py
> new file mode 100644
> index 0000000000..b8d5d4cc38
> --- /dev/null
> +++ b/tests/avocado/ppc_aix.py
> @@ -0,0 +1,63 @@
> +# Functional test that boots AIX on ppc pseries TCG and KVM
> +#
> +# Copyright (c) 2023 IBM Corporation
> +#
> +# This work is licensed under the terms of the GNU GPL, version 2 or
> +# later.  See the COPYING file in the top-level directory.
> +
> +import os
> +from avocado.utils import archive
> +from avocado_qemu import QemuSystemTest
> +from avocado_qemu import wait_for_console_pattern
> +
> +class pseriesMachine(QemuSystemTest):
> +
> +    timeout = 600
> +
> +    def do_test_ppc64_aix_boot(self):
> +        """
> +        :avocado: tags=arch:ppc64
> +        :avocado: tags=machine:pseries
> +        """
> +
> +        image = os.getenv('AIX_IMAGE')
> +        if not image:
> +            self.cancel('No AIX_IMAGE environment variable defined')
> +
> +        _hash = os.getenv('AIX_HASH')
> +        if _hash:
> +            aix_disk = self.fetch_asset(image, asset_hash=_hash)
> +        else:
> +            aix_disk = self.fetch_asset(image)
> +
> +        self.vm.set_console()
> +        self.vm.add_args('-machine', 'ic-mode=xics',
> +                         '-smp', '16,threads=8,cores=2',
> +                         '-m', '4g',
> +#                         '-device', 'spapr-vlan,netdev=net0,mac=52:54:00:49:53:14',
> +#                         '-netdev', 'tap,id=net0,helper=/usr/libexec/qemu-bridge-helper,br=virbr0',
> +                         '-device', 'qemu-xhci',
> +                         '-device', 'virtio-scsi,id=scsi0',
> + '-drive',
> f'file={aix_disk},if=none,id=drive-scsi0-0-0-0,format=qcow2,cache=none',
> + '-device',
> 'scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1',
> +                         '-nodefaults')
> +        self.vm.launch()
> +        wait_for_console_pattern(self, 'AIX Version 7')
> +
> +    def test_ppc64_aix_boot_tcg(self):
> +        """
> +        :avocado: tags=arch:ppc64
> +        :avocado: tags=machine:pseries
> +        :avocado: tags=accel:tcg
> +        """
> +        self.require_accelerator("tcg")
> +        self.do_test_ppc64_aix_boot()
> +
> +    def test_ppc64_aix_boot_kvm(self):
> +        """
> +        :avocado: tags=arch:ppc64
> +        :avocado: tags=machine:pseries
> +        :avocado: tags=accel:kvm
> +        """
> +        self.require_accelerator("kvm")
> +        self.do_test_ppc64_aix_boot()
Philippe Mathieu-Daudé Oct. 10, 2023, 12:49 p.m. UTC | #2
On 10/10/23 14:43, Alex Bennée wrote:
> 
> Nicholas Piggin <npiggin@gmail.com> writes:
> 
>> An AIX image can be provided by setting AIX_IMAGE environment
>> variable when running avocado.
>>
>> It's questionable whether we should carry these in upstream QEMU.
>> It's convenient to see how to run these things, but simple enough
>> to maintain in out of tree branch. I just wanted to see opinions
>> about it.
> 
> Yeah there is no point adding a test no one else can run. We already
> have tests that utilise dead URLs that can only run if you happen to
> have the image in the avocado cache which should arguably be removed.

This isn't quite the same problem. This test image can possibly be
shared among developers within the IBM realm.

>> ---
>>   tests/avocado/ppc_aix.py | 63 ++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 63 insertions(+)
>>   create mode 100644 tests/avocado/ppc_aix.py
Daniel P. Berrangé Oct. 10, 2023, 1:01 p.m. UTC | #3
On Tue, Oct 10, 2023 at 01:43:16PM +0100, Alex Bennée wrote:
> 
> Nicholas Piggin <npiggin@gmail.com> writes:
> 
> > An AIX image can be provided by setting AIX_IMAGE environment
> > variable when running avocado.
> >
> > It's questionable whether we should carry these in upstream QEMU.
> > It's convenient to see how to run these things, but simple enough
> > to maintain in out of tree branch. I just wanted to see opinions
> > about it.
> 
> Yeah there is no point adding a test no one else can run. We already
> have tests that utilise dead URLs that can only run if you happen to
> have the image in the avocado cache which should arguably be removed.

I can understand the appeal of wanting to sanity check QEMU
with esentially arbitrary guest OS, whether modern, or obsolete,
whether OSS or proprietary.

The appeal of getting the test integrated into QEMU is you don't
have to worry about rebasing / merging local git changes forever
more.

I feel like this tells us we should not require users to be writing
new avocado python test code merely to get a boring old guest OS
boot up smoke test integrated into avocado.

I think we ought to have a 'guest_smoke_test.py' avocado test, that
pulls in guest OS scenarios from external YAML/JSON files. eg

  $ cat ppc_aix.yaml
  image:
    url: https:////some/path
    checksum: xxxxxx
  console:
    expect: ...some console message...
  vm:
    arch: ppc64
    machine: pseries
    ....something something extra cli args something something...

Users could then set

  export  QEMU_SMOKE_TEST_PATHS=$HOME/my-guestos-library:$HOME/shared-guestos-library
  make check-avocado

to load all the guest OS scenarios from these dirs, in addition to
any scenarios that are shipped in qemu.git by default.

With regards,
Daniel
Nicholas Piggin Oct. 10, 2023, 9:14 p.m. UTC | #4
On Tue Oct 10, 2023 at 11:01 PM AEST, Daniel P. Berrangé wrote:
> On Tue, Oct 10, 2023 at 01:43:16PM +0100, Alex Bennée wrote:
> > 
> > Nicholas Piggin <npiggin@gmail.com> writes:
> > 
> > > An AIX image can be provided by setting AIX_IMAGE environment
> > > variable when running avocado.
> > >
> > > It's questionable whether we should carry these in upstream QEMU.
> > > It's convenient to see how to run these things, but simple enough
> > > to maintain in out of tree branch. I just wanted to see opinions
> > > about it.
> > 
> > Yeah there is no point adding a test no one else can run. We already
> > have tests that utilise dead URLs that can only run if you happen to
> > have the image in the avocado cache which should arguably be removed.
>
> I can understand the appeal of wanting to sanity check QEMU
> with esentially arbitrary guest OS, whether modern, or obsolete,
> whether OSS or proprietary.
>
> The appeal of getting the test integrated into QEMU is you don't
> have to worry about rebasing / merging local git changes forever
> more.
>
> I feel like this tells us we should not require users to be writing
> new avocado python test code merely to get a boring old guest OS
> boot up smoke test integrated into avocado.

Interesting thought. It is easier to be able to specify images
location, qemu command line, and some expected output and input
than to write an avocado test entirely. OTOH if you copy an
existing one and don't need to do anything different then it is
not so hard.

>
> I think we ought to have a 'guest_smoke_test.py' avocado test, that
> pulls in guest OS scenarios from external YAML/JSON files. eg
>
>   $ cat ppc_aix.yaml
>   image:
>     url: https:////some/path
>     checksum: xxxxxx
>   console:
>     expect: ...some console message...
>   vm:
>     arch: ppc64
>     machine: pseries
>     ....something something extra cli args something something...
>
> Users could then set
>
>   export  QEMU_SMOKE_TEST_PATHS=$HOME/my-guestos-library:$HOME/shared-guestos-library
>   make check-avocado
>
> to load all the guest OS scenarios from these dirs, in addition to
> any scenarios that are shipped in qemu.git by default.

There would be a bunch of upstream avocado tests that could be
converted to such a format.

Thanks,
Nick
Nicholas Piggin Oct. 10, 2023, 9:21 p.m. UTC | #5
On Tue Oct 10, 2023 at 10:49 PM AEST, Philippe Mathieu-Daudé wrote:
> On 10/10/23 14:43, Alex Bennée wrote:
> > 
> > Nicholas Piggin <npiggin@gmail.com> writes:
> > 
> >> An AIX image can be provided by setting AIX_IMAGE environment
> >> variable when running avocado.
> >>
> >> It's questionable whether we should carry these in upstream QEMU.
> >> It's convenient to see how to run these things, but simple enough
> >> to maintain in out of tree branch. I just wanted to see opinions
> >> about it.
> > 
> > Yeah there is no point adding a test no one else can run. We already
> > have tests that utilise dead URLs that can only run if you happen to
> > have the image in the avocado cache which should arguably be removed.
>
> This isn't quite the same problem. This test image can possibly be
> shared among developers within the IBM realm.

Yeah, and other people can have AIX and MacOS legally by other means
(IIRC you could register an acount and get AIX, but that may have
changed).

We do have some people not at IBM who test AIX against upstram and
report bugs. Not too sure if they would find these avocado tests useful
though.

Thanks,
Nick
diff mbox series

Patch

diff --git a/tests/avocado/ppc_aix.py b/tests/avocado/ppc_aix.py
new file mode 100644
index 0000000000..b8d5d4cc38
--- /dev/null
+++ b/tests/avocado/ppc_aix.py
@@ -0,0 +1,63 @@ 
+# Functional test that boots AIX on ppc pseries TCG and KVM
+#
+# Copyright (c) 2023 IBM Corporation
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+import os
+from avocado.utils import archive
+from avocado_qemu import QemuSystemTest
+from avocado_qemu import wait_for_console_pattern
+
+class pseriesMachine(QemuSystemTest):
+
+    timeout = 600
+
+    def do_test_ppc64_aix_boot(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        """
+
+        image = os.getenv('AIX_IMAGE')
+        if not image:
+            self.cancel('No AIX_IMAGE environment variable defined')
+
+        _hash = os.getenv('AIX_HASH')
+        if _hash:
+            aix_disk = self.fetch_asset(image, asset_hash=_hash)
+        else:
+            aix_disk = self.fetch_asset(image)
+
+        self.vm.set_console()
+        self.vm.add_args('-machine', 'ic-mode=xics',
+                         '-smp', '16,threads=8,cores=2',
+                         '-m', '4g',
+#                         '-device', 'spapr-vlan,netdev=net0,mac=52:54:00:49:53:14',
+#                         '-netdev', 'tap,id=net0,helper=/usr/libexec/qemu-bridge-helper,br=virbr0',
+                         '-device', 'qemu-xhci',
+                         '-device', 'virtio-scsi,id=scsi0',
+                         '-drive', f'file={aix_disk},if=none,id=drive-scsi0-0-0-0,format=qcow2,cache=none',
+                         '-device', 'scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1',
+                         '-nodefaults')
+        self.vm.launch()
+        wait_for_console_pattern(self, 'AIX Version 7')
+
+    def test_ppc64_aix_boot_tcg(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:tcg
+        """
+        self.require_accelerator("tcg")
+        self.do_test_ppc64_aix_boot()
+
+    def test_ppc64_aix_boot_kvm(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:kvm
+        """
+        self.require_accelerator("kvm")
+        self.do_test_ppc64_aix_boot()