From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0361EC02182 for ; Tue, 21 Jan 2025 16:18:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZAABF3NAgpNICeJb5wAt02+98PuNsN4HIovOcCl7dbk=; b=4v39JZvqLESDkU Sz8hhedZ5IkHeDUGDRkE70K4Hkp83OB40B4Dd4pBeozPd0K5EqUtKf8Iha9CK/YlaJf6xoXHj9tE9 9Ae8jDwRO/kBB7/8TLV4xcGQa5SpyJrDRsnHEIiXeWAJoEQc3/F371/BNJYilaR1RU44bs1317NpM +eCUycUtw5KkMyfF7nk/GPvGdsvH3ImWgNBh2fZQK+3huf6U9uvv4JPAVlCnXrSB8v5ELnFAwCAzT lhmF6wV7okylrh9rwzMQ8r99od3jgzgmm9pQn7RNcVmBgpKT7kePPOqA38BXfdU+IrTWBmVzoYqzo bWNe2d8Qvr2tT2HDbrBQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1taGxa-00000008LDV-2zNn; Tue, 21 Jan 2025 16:18:38 +0000 Received: from out-182.mta1.migadu.com ([95.215.58.182]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1taGwR-00000008KyR-3Bz7 for kvm-riscv@lists.infradead.org; Tue, 21 Jan 2025 16:17:29 +0000 Date: Tue, 21 Jan 2025 17:17:22 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1737476245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7WwSMRATO0QjUqb11IwaPpIM7wS7YIxBQxz1gbtNgig=; b=uIyKdIUQNmCtu7Q0IcIVXtHI6XK6xj7PVO6GVegFWD6wgh2mr8arrR6cZhBwT6O4r/GQRY PGdz0lyr4Q5bxBPOjt3FmyZAyyEs3+aDLQ9S+6/Z5cC5t0DN2SwlomAxxkrnle8K2K9rLR GN90A4eGae+VZ+Mggm60xlRxe2A7J/0= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Andrew Jones To: Alexandru Elisei Cc: eric.auger@redhat.com, lvivier@redhat.com, thuth@redhat.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, nrb@linux.ibm.com, david@redhat.com, pbonzini@redhat.com, kvm@vger.kernel.org, kvmarm@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-s390@vger.kernel.org, will@kernel.org, julien.thierry.kdev@gmail.com, maz@kernel.org, oliver.upton@linux.dev, suzuki.poulose@arm.com, yuzenghui@huawei.com, joey.gouly@arm.com, andre.przywara@arm.com Subject: Re: [kvm-unit-tests PATCH v2 03/18] scripts: Refuse to run the tests if not configured for qemu Message-ID: <20250121-c7f5ba2a25ccbfe793da07f6@orel> References: <20250120164316.31473-1-alexandru.elisei@arm.com> <20250120164316.31473-4-alexandru.elisei@arm.com> <20250121-45faf6a9a9681c7c9ece5f44@orel> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250121_081727_955293_0C135697 X-CRM114-Status: GOOD ( 35.01 ) X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kvm-riscv" Errors-To: kvm-riscv-bounces+kvm-riscv=archiver.kernel.org@lists.infradead.org On Tue, Jan 21, 2025 at 03:54:17PM +0000, Alexandru Elisei wrote: > Hi Drew, > > On Tue, Jan 21, 2025 at 03:48:55PM +0100, Andrew Jones wrote: > > On Mon, Jan 20, 2025 at 04:43:01PM +0000, Alexandru Elisei wrote: > > > Arm and arm64 support running the tests under kvmtool. Unsurprisingly, > > > kvmtool and qemu have a different command line syntax for configuring and > > > running a virtual machine. > > > > > > On top of that, when kvm-unit-tests has been configured to run under > > > kvmtool (via ./configure --target=kvmtool), the early UART address changes, > > > and if then the tests are run with qemu, this warning is displayed: > > > > > > WARNING: early print support may not work. Found uart at 0x9000000, but early base is 0x1000000. > > > > > > At the moment, the only way to run a test under kvmtool is manually, as no > > > script has any knowledge of how to invoke kvmtool. Also, unless one looks > > > at the logs, it's not obvious that the test runner is using qemu to run the > > > tests, and not kvmtool. > > > > > > To avoid any confusion for unsuspecting users, refuse to run a test via the > > > testing scripts when kvm-unit-tests has been configured for kvmtool. > > > > > > There are four different ways to run a test using the test infrastructure: > > > with run_tests.sh, by invoking arm/run or arm/efi/run with the correct > > > parameters (only the arm directory is mentioned here because the tests can > > > be configured for kvmtool only on arm and arm64), and by creating > > > standalone tests. Add a check in each of these locations for the supported > > > virtual machine manager. > > > > > > Signed-off-by: Alexandru Elisei > > > --- > > > arm/efi/run | 8 ++++++++ > > > arm/run | 9 +++++++++ > > > run_tests.sh | 8 ++++++++ > > > scripts/mkstandalone.sh | 8 ++++++++ > > > 4 files changed, 33 insertions(+) > > > > > > diff --git a/arm/efi/run b/arm/efi/run > > > index 8f41fc02df31..916f4c4deef6 100755 > > > --- a/arm/efi/run > > > +++ b/arm/efi/run > > > @@ -12,6 +12,14 @@ fi > > > source config.mak > > > source scripts/arch-run.bash > > > > > > +case "$TARGET" in > > > +qemu) > > > + ;; > > > +*) > > > + echo "$0 does not support '$TARGET'" > > > + exit 2 > > > +esac > > > + > > > if [ -f /usr/share/qemu-efi-aarch64/QEMU_EFI.fd ]; then > > > DEFAULT_UEFI=/usr/share/qemu-efi-aarch64/QEMU_EFI.fd > > > elif [ -f /usr/share/edk2/aarch64/QEMU_EFI.silent.fd ]; then > > > diff --git a/arm/run b/arm/run > > > index efdd44ce86a7..6db32cf09c88 100755 > > > --- a/arm/run > > > +++ b/arm/run > > > @@ -8,6 +8,15 @@ if [ -z "$KUT_STANDALONE" ]; then > > > source config.mak > > > source scripts/arch-run.bash > > > fi > > > + > > > +case "$TARGET" in > > > +qemu) > > > + ;; > > > +*) > > > + echo "'$TARGET' not supported" > > > + exit 3 > > > > I think we want exit code 2 here. > > Exit code 2 is already in use in arm/run. Now that I'm looking more closely > at it, exit code 2 is already in use in run_tests.sh, same for > mkstandalone.sh and arm/efi/run. > > How about using 3 everywhere as the exit code? > In kvm-unit-tests, exit code 2 is what we use for "most likely a run script failed" (see the comment above run_qemu() in scripts/arch-run.bash). We don't try to create a new error code for each type of error, but we do have the error message as well. So if there's a higher level runner, which runs this runner, it only needs to learn that 2 is likely a script failure and that an error message will hopefully point the way to the problem. Thanks, drew -- kvm-riscv mailing list kvm-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kvm-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-170.mta1.migadu.com (out-170.mta1.migadu.com [95.215.58.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C04E1F4E3E for ; Tue, 21 Jan 2025 16:17:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737476251; cv=none; b=biwSHmwVhQo0hflwIX6MDgdhV4dwaRp4Kbk/n3BZXYRpir68SgApntcfe/lXicybUyN0RPDKqHgHaUPA61xZTCkeipBaIwxE1Ubn4X3eHJdutEL4B66X9oIWlcq5x2oh8Twfsi1W9Jehn9NnZi86GJ66RLntYmHRI2VvFhfU9Aw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737476251; c=relaxed/simple; bh=LWgO6cMNccPXffxuVm3HTUEmVvXtNEJAAZS2taz+yeA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=knep4uM3liXmHFNleu3noBJ5/jETrjp4WmgsG3XjNTKsTMnbNyDAq21H173s67g0nzBmNlMy+yM9q8mOHb9blu1Er/okZf//X5OnPCWBbbmEJTOKL0BkXloD1T74oi1TZKu2NImHAnkvqzdBX8VOUVnZfs508/adnXkFA+qNvbI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=uIyKdIUQ; arc=none smtp.client-ip=95.215.58.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="uIyKdIUQ" Date: Tue, 21 Jan 2025 17:17:22 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1737476245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7WwSMRATO0QjUqb11IwaPpIM7wS7YIxBQxz1gbtNgig=; b=uIyKdIUQNmCtu7Q0IcIVXtHI6XK6xj7PVO6GVegFWD6wgh2mr8arrR6cZhBwT6O4r/GQRY PGdz0lyr4Q5bxBPOjt3FmyZAyyEs3+aDLQ9S+6/Z5cC5t0DN2SwlomAxxkrnle8K2K9rLR GN90A4eGae+VZ+Mggm60xlRxe2A7J/0= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Andrew Jones To: Alexandru Elisei Cc: eric.auger@redhat.com, lvivier@redhat.com, thuth@redhat.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, nrb@linux.ibm.com, david@redhat.com, pbonzini@redhat.com, kvm@vger.kernel.org, kvmarm@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-s390@vger.kernel.org, will@kernel.org, julien.thierry.kdev@gmail.com, maz@kernel.org, oliver.upton@linux.dev, suzuki.poulose@arm.com, yuzenghui@huawei.com, joey.gouly@arm.com, andre.przywara@arm.com Subject: Re: [kvm-unit-tests PATCH v2 03/18] scripts: Refuse to run the tests if not configured for qemu Message-ID: <20250121-c7f5ba2a25ccbfe793da07f6@orel> References: <20250120164316.31473-1-alexandru.elisei@arm.com> <20250120164316.31473-4-alexandru.elisei@arm.com> <20250121-45faf6a9a9681c7c9ece5f44@orel> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT On Tue, Jan 21, 2025 at 03:54:17PM +0000, Alexandru Elisei wrote: > Hi Drew, > > On Tue, Jan 21, 2025 at 03:48:55PM +0100, Andrew Jones wrote: > > On Mon, Jan 20, 2025 at 04:43:01PM +0000, Alexandru Elisei wrote: > > > Arm and arm64 support running the tests under kvmtool. Unsurprisingly, > > > kvmtool and qemu have a different command line syntax for configuring and > > > running a virtual machine. > > > > > > On top of that, when kvm-unit-tests has been configured to run under > > > kvmtool (via ./configure --target=kvmtool), the early UART address changes, > > > and if then the tests are run with qemu, this warning is displayed: > > > > > > WARNING: early print support may not work. Found uart at 0x9000000, but early base is 0x1000000. > > > > > > At the moment, the only way to run a test under kvmtool is manually, as no > > > script has any knowledge of how to invoke kvmtool. Also, unless one looks > > > at the logs, it's not obvious that the test runner is using qemu to run the > > > tests, and not kvmtool. > > > > > > To avoid any confusion for unsuspecting users, refuse to run a test via the > > > testing scripts when kvm-unit-tests has been configured for kvmtool. > > > > > > There are four different ways to run a test using the test infrastructure: > > > with run_tests.sh, by invoking arm/run or arm/efi/run with the correct > > > parameters (only the arm directory is mentioned here because the tests can > > > be configured for kvmtool only on arm and arm64), and by creating > > > standalone tests. Add a check in each of these locations for the supported > > > virtual machine manager. > > > > > > Signed-off-by: Alexandru Elisei > > > --- > > > arm/efi/run | 8 ++++++++ > > > arm/run | 9 +++++++++ > > > run_tests.sh | 8 ++++++++ > > > scripts/mkstandalone.sh | 8 ++++++++ > > > 4 files changed, 33 insertions(+) > > > > > > diff --git a/arm/efi/run b/arm/efi/run > > > index 8f41fc02df31..916f4c4deef6 100755 > > > --- a/arm/efi/run > > > +++ b/arm/efi/run > > > @@ -12,6 +12,14 @@ fi > > > source config.mak > > > source scripts/arch-run.bash > > > > > > +case "$TARGET" in > > > +qemu) > > > + ;; > > > +*) > > > + echo "$0 does not support '$TARGET'" > > > + exit 2 > > > +esac > > > + > > > if [ -f /usr/share/qemu-efi-aarch64/QEMU_EFI.fd ]; then > > > DEFAULT_UEFI=/usr/share/qemu-efi-aarch64/QEMU_EFI.fd > > > elif [ -f /usr/share/edk2/aarch64/QEMU_EFI.silent.fd ]; then > > > diff --git a/arm/run b/arm/run > > > index efdd44ce86a7..6db32cf09c88 100755 > > > --- a/arm/run > > > +++ b/arm/run > > > @@ -8,6 +8,15 @@ if [ -z "$KUT_STANDALONE" ]; then > > > source config.mak > > > source scripts/arch-run.bash > > > fi > > > + > > > +case "$TARGET" in > > > +qemu) > > > + ;; > > > +*) > > > + echo "'$TARGET' not supported" > > > + exit 3 > > > > I think we want exit code 2 here. > > Exit code 2 is already in use in arm/run. Now that I'm looking more closely > at it, exit code 2 is already in use in run_tests.sh, same for > mkstandalone.sh and arm/efi/run. > > How about using 3 everywhere as the exit code? > In kvm-unit-tests, exit code 2 is what we use for "most likely a run script failed" (see the comment above run_qemu() in scripts/arch-run.bash). We don't try to create a new error code for each type of error, but we do have the error message as well. So if there's a higher level runner, which runs this runner, it only needs to learn that 2 is likely a script failure and that an error message will hopefully point the way to the problem. Thanks, drew