From nobody Thu Nov 14 07:06:14 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1705500886; cv=none; d=zohomail.com; s=zohoarc; b=jCNTVhpZ2BzhD2UIghg7PhKqzT6d5XhiOIYvQPyCd8MN8IRGL4aTxCZoRkRzIlSp3so+OZz4M1GUgxTDo2w5e0YpgkZrsHaVGylC9pcYk43iFuJQdmgSs2njjuZoWpE5OvsB4i2rDOU2meKLkl+Ap1H1nzdpmo6dctP+S27K+bs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705500886; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+bA1RQL7GXjMfCEm7O5Bzn0f4i4pqBYPwrxSXO5B/V4=; b=E67e5Ie4E2sQqmc9xhqgWABg3kv1Y+y5T8GB90jIaZrksQX3M+UXG2JxHjckTiJdo1VtELX40kPICVohgrwpZ9y0W+OBsOFtUp0CI9o2NRmrYkIZoo326o8n4pKdYXig0kV55OZpdDw/JE62qC02cmwmKesDkGdsDu6mNn0wrIQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1705500886475438.0119845934437; Wed, 17 Jan 2024 06:14:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQ6fX-0006Do-2l; Wed, 17 Jan 2024 09:13:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQ6fV-0006Bh-Ph; Wed, 17 Jan 2024 09:13:25 -0500 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rQ6fT-0002qR-J8; Wed, 17 Jan 2024 09:13:25 -0500 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6d9b37f4804so7195398b3a.1; Wed, 17 Jan 2024 06:13:22 -0800 (PST) Received: from wheely.local0.net (124-171-76-150.tpgi.com.au. [124.171.76.150]) by smtp.gmail.com with ESMTPSA id i136-20020a636d8e000000b005cebb10e28fsm11812428pgc.69.2024.01.17.06.13.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 06:13:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705500801; x=1706105601; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+bA1RQL7GXjMfCEm7O5Bzn0f4i4pqBYPwrxSXO5B/V4=; b=GTBDNqgczCUC+YMSdhMY5edjLzkiTlsZb2HQBnc7IoYJP47LWt+0gkLNz5N++7i1tM Gqk7r7UYHTN6JIM1wVUI05NhWGXX4t3A/aTFgLhsBSV9+E52VsgnoK5AU3cEPD1BL3wS zA5APJlchdfTqMD5bjb9KMzDP1tllTyz44m8lSFZUaJMKa5OaJXSfGpYXiJkgQPzG2nl KT1NgGy8W3u+dskakf1CATcEYS2CmYf2opbhG900l6N0CSQWTMr/OPhv2I4sOxvRztBc E72HERJdI2VRwQg+jBflwUlWVhlY95LXVx011YRtu/Qt26iffa2ZlnRFhYQ/Emu5P/gv /NiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705500801; x=1706105601; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+bA1RQL7GXjMfCEm7O5Bzn0f4i4pqBYPwrxSXO5B/V4=; b=uvZI2m52cml0HH7GKe93ZKs7WHQDRsAlwUEYJSLm1WOD1o7eMiPqBaWwrAW/HpkzHz q/fOpqpKtEStTFBlQyBFqdIIh3q0n75zfsnb5PZmE9ICk7IES4yJaDrSM+ZDa7YH5wet tFITQeYpWZPh6P4NTFvF5fF/jaCQ42oL7/y3mB8NyxzsItS5serlHC45lANPGggxH52X czbpkda0BAlUEWwbJW8sLyrJloovQX88eb9ZK5rN7OUU+xawBnbu6XIgF7lyRvuMNZsL N8I9ypT7oaBHlxAlZDDZLYlZdk0RNr+d48Ub69CQLWAkyYBcG8SGXHjpHoauHv0dcy43 Z4OQ== X-Gm-Message-State: AOJu0YxWEBIegB/uSZioMSgXJ9SMgbAofltg653k21HQlHPxS3yU0nhc GETmPDYwPPGY+BeMV9rxLs184idA3vPVyKNUiABmLeXLuZ1tdXY0W/qJ6Ds5 X-Google-Smtp-Source: AGHT+IGvGWr9MIkzg4KmaEkaJbJtrMTAqh8Ry/FsbBg28VDkMaZhTYPixuepc7ZavtGuZrgJqkzBcg== X-Received: by 2002:a05:6a21:3987:b0:19b:46c7:c986 with SMTP id ad7-20020a056a21398700b0019b46c7c986mr1435630pzc.16.1705500801301; Wed, 17 Jan 2024 06:13:21 -0800 (PST) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Daniel Henrique Barboza , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Harsh Prateek Bora , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Cleber Rosa , qemu-ppc@nongnu.org, Warner Losh Subject: [PATCH v2 8/8] tests/avocado: Add FreeBSD distro boot tests for ppc Date: Thu, 18 Jan 2024 00:12:23 +1000 Message-ID: <20240117141224.90462-9-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240117141224.90462-1-npiggin@gmail.com> References: <20240117141224.90462-1-npiggin@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=npiggin@gmail.com; helo=mail-pf1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1705500887429100001 Content-Type: text/plain; charset="utf-8" FreeBSD project provides qcow2 images that work well for testing QEMU. Add pseries tests for HPT and Radix, KVM and TCG, and powernv9 tests. This uses short-term snapshot build artifacts, because FreeBSD has not set up long-term builds for ppc64 yet. 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 Signed-off-by: Nicholas Piggin 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 | 174 ++++++++++++++++++++++++++++++++++ 1 file changed, 174 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..c01cd06cca --- /dev/null +++ b/tests/avocado/boot_freebsd.py @@ -0,0 +1,174 @@ +# 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 +import subprocess + +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('SPEED') =3D=3D 'slow', 'runtime limited') +class BootFreeBSDPPC64(QemuSystemTest): + """ + :avocado: tags=3Darch:ppc64 + """ + + timeout =3D 360 + + def setUp(self): + super().setUp() + + # We need zstd for all the tests + # See https://github.com/avocado-framework/avocado/issues/5609 + zstd =3D find_command('zstd', False) + if zstd is False: + self.cancel('Could not find "zstd", which is required to ' + 'decompress rootfs') + tar =3D find_command('tar', False) + if tar is False: + self.cancel('Could not find "tar", which is required to ' + 'decompress rootfs') + + drive_url =3D ('https://artifact.ci.freebsd.org/snapshot/15.0-CURR= ENT/8a735ffdf04936c6785ac4fa31486639262dd416/powerpc/powerpc64le/disk.qcow2= .zst') + drive_hash =3D '95d863dbbc4b60f4899d1ef21d6489fca05bf03d' + drive_path_zstd =3D self.fetch_asset(drive_url, asset_hash=3Ddrive= _hash) + self.drive_path =3D os.path.join(self.workdir, 'disk.qcow2') + + cmd =3D f"{zstd} -d {drive_path_zstd} -o {self.drive_path}" + process.run(cmd) + + kernel_url =3D ('https://artifact.ci.freebsd.org/snapshot/15.0-CUR= RENT/8a735ffdf04936c6785ac4fa31486639262dd416/powerpc/powerpc64le/kernel.tx= z') + kernel_hash =3D '31d14c2dc658858830a7acab5128a5b91ea548cf' + kernel_path_txz =3D self.fetch_asset(kernel_url, asset_hash=3Dkern= el_hash) + self.kernel_path =3D os.path.join(self.workdir, 'kernel') + + with open(self.kernel_path, "w") as outfile: + cmd =3D f"{tar} OJxf {kernel_path_txz} ./boot/kernel/kernel" + subprocess.run(cmd.split(), stdout=3Doutfile) + + def set_pseries_devices(self): + self.vm.add_args('-drive', f"file=3D{self.drive_path},format=3Dqco= w2,if=3Dvirtio") + self.vm.add_args('-net', 'nic,model=3Dvirtio') + + def set_powernv_devices(self): + self.vm.add_args('-device', 'nvme,bus=3Dpcie.2,addr=3D0x0,serial= =3D1234,drive=3Ddrive0', + '-device', 'e1000e,netdev=3Dnet0,mac=3DC0:FF:EE:0= 0:00:02,bus=3Dpcie.0,addr=3D0x0', + '-netdev', 'user,id=3Dnet0,hostfwd=3D::20022-:22,= hostname=3Dfreebsd') + self.vm.add_args("-drive", f"file=3D{self.drive_path},format=3Dqco= w2,if=3Dnone,id=3Ddrive0") + self.vm.add_args("-kernel", self.kernel_path) + + def run_pseries_test(self, force_HPT=3DFalse): + if force_HPT: + self.vm.add_args('-m', '4g') + else: + self.vm.add_args('-m', '1g') + self.vm.add_args('-smp', '4') + self.set_pseries_devices() + self.vm.set_console() + self.vm.launch() + + wait_for_console_pattern(self, 'Hit [Enter] to boot immediately, o= r 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=3D0') + exec_command(self, 'boot') + wait_for_console_pattern(self, 'cas: selected hash MMU', 'pani= c:') + else: + exec_command(self, '') + wait_for_console_pattern(self, 'cas: selected radix MMU', 'pan= ic:') + + 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:') + exec_command(self, 'root') + wait_for_console_pattern(self, 'resizewin: timeout reading from te= rminal') + exec_command(self, 'poweroff') + wait_for_console_pattern(self, 'Uptime:', 'panic:') + self.vm.wait() + + # powernv does not have a bootloader so must load the kernel directly + # and work around manual specification of the root device. Also can't + # specify options like radix_mmu the same way (todo: work out how it + # is done, and add HPT test). + def run_powernv_test(self, force_HPT=3DFalse): + self.vm.add_args('-m', '8g') + self.vm.add_args('-smp', '4') + self.set_powernv_devices() + self.vm.set_console() + self.vm.launch() + + 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, ' Abort manual input= ') + exec_command(self, 'ufs:diskid/DISK-1234s3') + + wait_for_console_pattern(self, 'FreeBSD/powerpc (Amnesiac) (ttyu0)= ', 'panic:') + exec_command(self, 'root') + wait_for_console_pattern(self, 'resizewin: timeout reading from te= rminal') + exec_command(self, 'poweroff') + wait_for_console_pattern(self, 'Uptime:', 'panic:') + wait_for_console_pattern(self, 'OPAL: Shutdown request', 'panic:') + self.vm.wait() + + def test_pseries_tcg(self): + """ + :avocado: tags=3Darch:ppc64 + :avocado: tags=3Dmachine:pseries + :avocado: tags=3Daccel:tcg + """ + self.require_accelerator("tcg") + self.vm.add_args("-cpu", "power10") + self.vm.add_args("-accel", "tcg,thread=3Dmulti") + self.run_pseries_test() + + def test_pseries_hpt_tcg(self): + """ + :avocado: tags=3Darch:ppc64 + :avocado: tags=3Dmachine:pseries + :avocado: tags=3Daccel:tcg + """ + self.require_accelerator("tcg") + self.vm.add_args("-accel", "tcg,thread=3Dmulti") + self.run_pseries_test(force_HPT=3DTrue) + + def test_pseries_kvm(self): + """ + :avocado: tags=3Darch:ppc64 + :avocado: tags=3Dmachine:pseries + :avocado: tags=3Daccel:kvm + """ + self.require_accelerator("kvm") + self.vm.add_args("-accel", "kvm") + self.run_pseries_test() + + def test_pseries_hpt_kvm(self): + """ + :avocado: tags=3Darch:ppc64 + :avocado: tags=3Dmachine:pseries + :avocado: tags=3Daccel:kvm + """ + self.require_accelerator("kvm") + self.vm.add_args("-accel", "kvm") + self.run_pseries_test(force_HPT=3DTrue) + + # powernv9 works, powernv10 fails + def test_powernv(self): + """ + :avocado: tags=3Darch:ppc64 + :avocado: tags=3Dmachine:powernv9 + :avocado: tags=3Daccel:tcg + """ + self.require_accelerator("tcg") + self.vm.add_args("-accel", "tcg,thread=3Dmulti") + self.run_powernv_test() --=20 2.42.0