From patchwork Tue Nov 16 20:40:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zixuan Wang X-Patchwork-Id: 12623183 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 583BEC433F5 for ; Tue, 16 Nov 2021 20:41:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B94363214 for ; Tue, 16 Nov 2021 20:41:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231157AbhKPUoC (ORCPT ); Tue, 16 Nov 2021 15:44:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231150AbhKPUoC (ORCPT ); Tue, 16 Nov 2021 15:44:02 -0500 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAB2BC061570 for ; Tue, 16 Nov 2021 12:41:04 -0800 (PST) Received: by mail-pg1-x52c.google.com with SMTP id b4so193901pgh.10 for ; Tue, 16 Nov 2021 12:41:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a+5g09lFkE7HG3OL5MbNwxLwI2lhjZlEhMNfRa6rR90=; b=foH2/f9qBcdGHgMbRa/PKHwAkNC6qE+wOAUjeIqmF8pJ4ub6CavbwiM2f8y3irrwoV qKur+j3KlwCBqw4KcfiJ0AqZ9yxvG9xh7ihS63yYqpkrM5KaqjoIis00heRjobDP1oZa 3EpcduUv4JO7T5mCsMkL+tx5mL5ySoQJ9xKV9aSI8npyrANBOnugDqSJ76PHHN6cJ9xf 2c+1CLOAdGdeXqck6tsRyL/IPhArnzvRz5HsLtjOt/r3xLFj6eKazQQOw1hDS66aco6i vQ5yfFztzPw2vbAODRoctdmIkwe4YBBJ0YiyHtQYX0/cTW7ZeR9S5AHfNtTgRSsSrahz Q+WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a+5g09lFkE7HG3OL5MbNwxLwI2lhjZlEhMNfRa6rR90=; b=HI4JoRMEUSxobhlnw5wadzCC+rFItrEmFXaHZ574tsCFW43qBomxK+Kn3LmilDtLjr HDsr/6DQAoBzdUokxQPMni+k4ldOCrnoJEvmWVoIU8G6Cr3thHbywcE7bAflChJXypp0 3C6WeFBvDEOt1jNKX9DgiX1fZsxsxPdVtb2Y99oDMCmbLgrjlV1vlX6/HjvpJ/GVRzbd 7zvCwLwX3YRPespsVzHHdzGzy35ma5208DgHlmo1MiyWUelVMIiDqHYMRdNyQcdRh9FI iHHZ8QCcvsglsjlPpF4w/SqS2eRdijoLIJQRvuKaIcg8eXvh8EnroYSZmOjfypE8R7i1 Sw5g== X-Gm-Message-State: AOAM530TbbsrrZK4n4S/97Z/J12/E3ywvL32mg1rMJs/Q8gHDCSj0Ncu TO/Ob+rZidQ7DynEy4zktzWZUWgFn7BSJw== X-Google-Smtp-Source: ABdhPJxp4Xm0o+TthRFTM+eHvPVAt3kycG9CIWYGaRSXMgfZOknvD1NfD/IpwcAYlxxwsfzUMnTYHA== X-Received: by 2002:a63:5816:: with SMTP id m22mr1329391pgb.98.1637095264005; Tue, 16 Nov 2021 12:41:04 -0800 (PST) Received: from localhost.localdomain (netadmin.ucsd.edu. [137.110.160.224]) by smtp.gmail.com with ESMTPSA id lp12sm3652359pjb.24.2021.11.16.12.41.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Nov 2021 12:41:03 -0800 (PST) From: Zixuan Wang To: kvm@vger.kernel.org, pbonzini@redhat.com, drjones@redhat.com Cc: marcorr@google.com, erdemaktas@google.com, rientjes@google.com, seanjc@google.com, brijesh.singh@amd.com, Thomas.Lendacky@amd.com, varad.gautam@suse.com, jroedel@suse.de, bp@suse.de Subject: [kvm-unit-tests PATCH v2 07/10] scripts: Generalize EFI check Date: Tue, 16 Nov 2021 12:40:50 -0800 Message-Id: <20211116204053.220523-8-zxwang42@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211116204053.220523-1-zxwang42@gmail.com> References: <20211116204053.220523-1-zxwang42@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Marc Orr Previously, the scripts distinguish between seabios and UEFI via a hard-coded env var in the EFI run script, `arch/x86/efi/run`. Furthermore, this var is passed to the x86 run script, `arch/x86/run`, and then not available in other scripts (or to other architectures). Replace the previous approach with a common variable TARGET_EFI to check whether the repo has been configured to run under EFI. This variable is extracted from the `config.mak` file generated by `configure`. Signed-off-by: Marc Orr --- x86/efi/run | 1 - x86/run | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/x86/efi/run b/x86/efi/run index 922b266..aacc691 100755 --- a/x86/efi/run +++ b/x86/efi/run @@ -52,7 +52,6 @@ popd || exit 2 # run in UEFI, some test cases, e.g. `x86/pmu.c`, require more free memory. A # simple fix is to increase the QEMU default memory size to 256MiB so that # UEFI's largest allocatable memory region is large enough. -EFI_RUN=y \ "$TEST_DIR/run" \ -drive file="$EFI_UEFI",format=raw,if=pflash,readonly=on \ -drive file.dir="$EFI_TEST/$EFI_CASE/",file.driver=vvfat,file.rw=on,format=raw,if=virtio \ diff --git a/x86/run b/x86/run index 4eba2b9..9e18464 100755 --- a/x86/run +++ b/x86/run @@ -1,5 +1,7 @@ #!/usr/bin/env bash +source scripts/common.bash + if [ -z "$STANDALONE" ]; then if [ ! -f config.mak ]; then echo "run ./configure && make first. See ./configure -h" @@ -39,12 +41,12 @@ fi command="${qemu} --no-reboot -nodefaults $pc_testdev -vnc none -serial stdio $pci_testdev" command+=" -machine accel=$ACCEL" -if ! [ "$EFI_RUN" ]; then +if [ "${TARGET_EFI}" != "y" ]; then command+=" -kernel" fi command="$(timeout_cmd) $command" -if [ "$EFI_RUN" ]; then +if [ "${TARGET_EFI}" == "y" ]; then # Set ENVIRON_DEFAULT=n to remove '-initrd' flag for QEMU (see # 'scripts/arch-run.bash' for more details). This is because when using # UEFI, the test case binaries are passed to QEMU through the disk