From patchwork Thu May 13 10:01:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Hu X-Patchwork-Id: 1477987 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FgnJJ1sT1z9sTD for ; Thu, 13 May 2021 20:02:08 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lh8AP-0000eW-PE; Thu, 13 May 2021 10:02:05 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lh8AO-0000e8-85 for fwts-devel@lists.ubuntu.com; Thu, 13 May 2021 10:02:04 +0000 Received: from 112-104-30-83.adsl.dynamic.seed.net.tw ([112.104.30.83] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lh8AN-0005bT-Ag for fwts-devel@lists.ubuntu.com; Thu, 13 May 2021 10:02:04 +0000 From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH 4/4] uefirtauthvar: check variable runtime services supported before testing (LP: #1913351) Date: Thu, 13 May 2021 18:01:45 +0800 Message-Id: <20210513100145.29713-4-ivan.hu@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210513100145.29713-1-ivan.hu@canonical.com> References: <20210513100145.29713-1-ivan.hu@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" The uefirtauthvar tests use the getvariable and setvariable runtime services. Add checking the get and set variable services supported status before runing the related tests. Signed-off-by: Ivan Hu Acked-by: Alex Hung Acked-by: Colin Ian King --- src/uefi/uefirtauthvar/uefirtauthvar.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/uefi/uefirtauthvar/uefirtauthvar.c b/src/uefi/uefirtauthvar/uefirtauthvar.c index 644d99c9..e6ab9d45 100644 --- a/src/uefi/uefirtauthvar/uefirtauthvar.c +++ b/src/uefi/uefirtauthvar/uefirtauthvar.c @@ -54,6 +54,8 @@ static const uint32_t attributes = static uint16_t variablenametest[] = {'A', 'u', 't', 'h', 'V', 'a', 'r', 'T', 'e', 's', 't', '\0'}; +static uint32_t runtimeservicessupported; + static long setvar( EFI_GUID *guid, uint32_t var_attributes, @@ -118,6 +120,18 @@ static int uefirtauthvar_init(fwts_framework *fw) if (fwts_lib_efi_runtime_module_init(fw, &fd) == FWTS_ABORTED) return FWTS_ABORTED; + fwts_uefi_rt_support_status_get(fd, &runtimeservicessupported); + + if (!(runtimeservicessupported & EFI_RT_SUPPORTED_SET_VARIABLE)) { + fwts_skipped(fw, "Skipping test, SetVariable runtime service " + "is not supported on this platform."); + return FWTS_SKIP; + } else if (!(runtimeservicessupported & EFI_RT_SUPPORTED_GET_VARIABLE)) { + fwts_skipped(fw, "Skipping test, GetVariable runtime service " + "is not supported on this platform."); + return FWTS_SKIP; + } + uefirtvariable_env_cleanup(); return FWTS_OK;