FreeBSD project provides qcow2 images that work well for testing QEMU.
Add pseries tests for HPT and Radix, KVM and TCG. This uses a short
term VM image, because FreeBSD has not set up long term builds for
ppc64 at present.
Other architectures could be added so this does not get a ppc_ prefix
but is instead named similarly to boot_linux.
Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
Unfortunately the latest stable (14.0) x86-64 VM image does not seem to
output to console by default and I've not been able to find a reliable
way to edit the filesystem to change the boot loader options, or use
console input in the test case to change it on the fly.
Thanks,
Nick
---
tests/avocado/boot_freebsd.py | 106 ++++++++++++++++++++++++++++++++++
1 file changed, 106 insertions(+)
create mode 100644 tests/avocado/boot_freebsd.py
diff --git a/tests/avocado/boot_freebsd.py b/tests/avocado/boot_freebsd.py
new file mode 100644
index 0000000000..79c68b149a
--- /dev/null
+++ b/tests/avocado/boot_freebsd.py
@@ -0,0 +1,106 @@
+# Functional tests that boot FreeBSD in various configurations
+#
+# 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 import skipUnless
+from avocado_qemu import QemuSystemTest
+from avocado_qemu import wait_for_console_pattern
+from avocado_qemu import exec_command
+from avocado.utils import archive
+from avocado.utils import process
+from avocado.utils.path import find_command
+
+@skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
+@skipUnless(os.getenv('AVOCADO_ALLOW_LONG_RUNTIME'), 'runtime limited')
+class BootFreeBSDPPC64(QemuSystemTest):
+ """
+ :avocado: tags=arch:ppc64
+ """
+
+ timeout = 360
+
+ def setUp(self):
+ super().setUp()
+
+ # We need zstd for all the tests
+ # See https://github.com/avocado-framework/avocado/issues/5609
+ zstd = find_command('zstd', False)
+ if zstd is False:
+ self.cancel('Could not find "zstd", which is required to '
+ 'decompress rootfs')
+ drive_url = ('https://artifact.ci.freebsd.org/snapshot/15.0-CURRENT/8a735ffdf04936c6785ac4fa31486639262dd416/powerpc/powerpc64le/disk.qcow2.zst')
+ drive_hash = '95d863dbbc4b60f4899d1ef21d6489fca05bf03d'
+ drive_path_zstd = self.fetch_asset(drive_url, asset_hash=drive_hash)
+ drive_path = os.path.join(self.workdir, 'disk.qcow2')
+
+ cmd = f"{zstd} -d {drive_path_zstd} -o {drive_path}"
+ process.run(cmd)
+
+ self.drive_opt = f"file={drive_path},format=qcow2,if=virtio"
+
+ def run_pseries_test(self, force_HPT=False):
+ if force_HPT:
+ self.vm.add_args('-m', '4g')
+ else:
+ self.vm.add_args('-m', '1g')
+ self.vm.add_args('-smp', '4')
+ self.vm.add_args('-drive', self.drive_opt)
+ self.vm.add_args('-net', 'nic,model=virtio')
+ self.vm.set_console()
+ self.vm.launch()
+
+ wait_for_console_pattern(self, 'Hit [Enter] to boot immediately, or any other key for command prompt.')
+ if force_HPT:
+ exec_command(self, 'x')
+ wait_for_console_pattern(self, 'OK')
+ exec_command(self, 'set radix_mmu=0')
+ exec_command(self, 'boot')
+ wait_for_console_pattern(self, 'cas: selected hash MMU', 'panic:')
+ else:
+ exec_command(self, '')
+ wait_for_console_pattern(self, 'cas: selected radix MMU', 'panic:')
+
+ wait_for_console_pattern(self, 'FreeBSD 15.0-CURRENT', 'panic:')
+ wait_for_console_pattern(self, 'FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs', 'panic:')
+ wait_for_console_pattern(self, 'FreeBSD/powerpc (Amnesiac) (ttyu0)', 'panic:')
+
+ def test_pseries_tcg(self):
+ """
+ :avocado: tags=arch:ppc64
+ :avocado: tags=machine:pseries
+ :avocado: tags=accel:tcg
+ """
+ self.require_accelerator("tcg")
+ self.run_pseries_test()
+
+ def test_pseries_hpt_tcg(self):
+ """
+ :avocado: tags=arch:ppc64
+ :avocado: tags=machine:pseries
+ :avocado: tags=accel:tcg
+ """
+ self.require_accelerator("tcg")
+ self.run_pseries_test(force_HPT=True)
+
+ def test_pseries_kvm(self):
+ """
+ :avocado: tags=arch:ppc64
+ :avocado: tags=machine:pseries
+ :avocado: tags=accel:kvm
+ """
+ self.require_accelerator("kvm")
+ self.run_pseries_test()
+
+ def test_pseries_hpt_kvm(self):
+ """
+ :avocado: tags=arch:ppc64
+ :avocado: tags=machine:pseries
+ :avocado: tags=accel:kvm
+ """
+ self.require_accelerator("kvm")
+ self.run_pseries_test(force_HPT=True)
--
2.42.0
On 1/7/24 18:01, Nicholas Piggin wrote: > FreeBSD project provides qcow2 images that work well for testing QEMU. > Add pseries tests for HPT and Radix, KVM and TCG. This uses a short > term VM image, because FreeBSD has not set up long term builds for > ppc64 at present. > > Other architectures could be added so this does not get a ppc_ prefix > but is instead named similarly to boot_linux. > > Reviewed-by: Warner Losh <imp@bsdimp.com> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com> > --- > Unfortunately the latest stable (14.0) x86-64 VM image does not seem to > output to console by default and I've not been able to find a reliable > way to edit the filesystem to change the boot loader options, or use > console input in the test case to change it on the fly. It would be interesting to add similar tests for the Big-Endian pseries image, may be not all tests, but at least TCG. Also, booting the kernel on a powernv9 machine would be nice. FreeBSD supports OPAL on POWER9 and it is not that common. It would exercise the PowerNV models differently from Linux. I tried the apple image on a mac99,G5 machine but the kernel panics on a DSI. > --- > tests/avocado/boot_freebsd.py | 106 ++++++++++++++++++++++++++++++++++ > 1 file changed, 106 insertions(+) > create mode 100644 tests/avocado/boot_freebsd.py > > diff --git a/tests/avocado/boot_freebsd.py b/tests/avocado/boot_freebsd.py > new file mode 100644 > index 0000000000..79c68b149a > --- /dev/null > +++ b/tests/avocado/boot_freebsd.py > @@ -0,0 +1,106 @@ > +# Functional tests that boot FreeBSD in various configurations > +# > +# 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 import skipUnless > +from avocado_qemu import QemuSystemTest > +from avocado_qemu import wait_for_console_pattern > +from avocado_qemu import exec_command > +from avocado.utils import archive > +from avocado.utils import process > +from avocado.utils.path import find_command > + > +@skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited') > +@skipUnless(os.getenv('AVOCADO_ALLOW_LONG_RUNTIME'), 'runtime limited') > +class BootFreeBSDPPC64(QemuSystemTest): > + """ > + :avocado: tags=arch:ppc64 > + """ > + > + timeout = 360 > + > + def setUp(self): > + super().setUp() > + > + # We need zstd for all the tests > + # See https://github.com/avocado-framework/avocado/issues/5609 > + zstd = find_command('zstd', False) > + if zstd is False: > + self.cancel('Could not find "zstd", which is required to ' > + 'decompress rootfs') > + drive_url = ('https://artifact.ci.freebsd.org/snapshot/15.0-CURRENT/8a735ffdf04936c6785ac4fa31486639262dd416/powerpc/powerpc64le/disk.qcow2.zst') The problem is the sustainability of this snapshot. It seems FreeBSD keeps one year of history. Thanks, C. > + drive_hash = '95d863dbbc4b60f4899d1ef21d6489fca05bf03d' > + drive_path_zstd = self.fetch_asset(drive_url, asset_hash=drive_hash) > + drive_path = os.path.join(self.workdir, 'disk.qcow2') > + > + cmd = f"{zstd} -d {drive_path_zstd} -o {drive_path}" > + process.run(cmd) > + > + self.drive_opt = f"file={drive_path},format=qcow2,if=virtio" > + > + def run_pseries_test(self, force_HPT=False): > + if force_HPT: > + self.vm.add_args('-m', '4g') > + else: > + self.vm.add_args('-m', '1g') > + self.vm.add_args('-smp', '4') > + self.vm.add_args('-drive', self.drive_opt) > + self.vm.add_args('-net', 'nic,model=virtio') > + self.vm.set_console() > + self.vm.launch() > + > + wait_for_console_pattern(self, 'Hit [Enter] to boot immediately, or any other key for command prompt.') > + if force_HPT: > + exec_command(self, 'x') > + wait_for_console_pattern(self, 'OK') > + exec_command(self, 'set radix_mmu=0') > + exec_command(self, 'boot') > + wait_for_console_pattern(self, 'cas: selected hash MMU', 'panic:') > + else: > + exec_command(self, '') > + wait_for_console_pattern(self, 'cas: selected radix MMU', 'panic:') > + > + wait_for_console_pattern(self, 'FreeBSD 15.0-CURRENT', 'panic:') > + wait_for_console_pattern(self, 'FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs', 'panic:') > + wait_for_console_pattern(self, 'FreeBSD/powerpc (Amnesiac) (ttyu0)', 'panic:') > + > + def test_pseries_tcg(self): > + """ > + :avocado: tags=arch:ppc64 > + :avocado: tags=machine:pseries > + :avocado: tags=accel:tcg > + """ > + self.require_accelerator("tcg") > + self.run_pseries_test() > + > + def test_pseries_hpt_tcg(self): > + """ > + :avocado: tags=arch:ppc64 > + :avocado: tags=machine:pseries > + :avocado: tags=accel:tcg > + """ > + self.require_accelerator("tcg") > + self.run_pseries_test(force_HPT=True) > + > + def test_pseries_kvm(self): > + """ > + :avocado: tags=arch:ppc64 > + :avocado: tags=machine:pseries > + :avocado: tags=accel:kvm > + """ > + self.require_accelerator("kvm") > + self.run_pseries_test() > + > + def test_pseries_hpt_kvm(self): > + """ > + :avocado: tags=arch:ppc64 > + :avocado: tags=machine:pseries > + :avocado: tags=accel:kvm > + """ > + self.require_accelerator("kvm") > + self.run_pseries_test(force_HPT=True)
© 2016 - 2024 Red Hat, Inc.