From patchwork Tue Jun 11 10:18:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Hu X-Patchwork-Id: 1113620 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com 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 45NQvw5L2vz9s5c; Tue, 11 Jun 2019 20:19: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 1hadrs-0000Y8-GY; Tue, 11 Jun 2019 10:19:04 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1hadrr-0000Y0-4T for fwts-devel@lists.ubuntu.com; Tue, 11 Jun 2019 10:19:03 +0000 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1hadrq-000529-9U; Tue, 11 Jun 2019 10:19:02 +0000 From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH 1/3] uefitime: add checking the EFI_UNSUPPORTED return code Date: Tue, 11 Jun 2019 18:18:55 +0800 Message-Id: <1560248337-10100-1-git-send-email-ivan.hu@canonical.com> X-Mailer: git-send-email 2.7.4 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: , MIME-Version: 1.0 Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" The UEFI spec 2.8(Matis 1961) adds EFI_UNSUPPORTED as a return code to most UEFI runtime services for those embeded devices such as specified by the ARM EBBR specification which are impractical or impossible to implement in such a way that they can be used at runtime. Add checking the EFI_UNSUPPORTED return code and skip the test for those unsupported runtime services. Signed-off-by: Ivan Hu Acked-by: Colin Ian King Acked-by: Alex Hung --- src/uefi/uefirttime/uefirttime.c | 90 +++++++++++++++++++++++++++++++++------- 1 file changed, 76 insertions(+), 14 deletions(-) diff --git a/src/uefi/uefirttime/uefirttime.c b/src/uefi/uefirttime/uefirttime.c index 7626f06..c0ff61d 100644 --- a/src/uefi/uefirttime/uefirttime.c +++ b/src/uefi/uefirttime/uefirttime.c @@ -215,6 +215,11 @@ static int uefirttime_test1(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetTime", "Failed to get time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -244,6 +249,11 @@ static int uefirttime_test_gettime_invalid( ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } if (status == EFI_INVALID_PARAMETER) { fwts_passed(fw, "UEFI runtime service GetTime interface test " "passed, returned EFI_INVALID_PARAMETER as expected."); @@ -291,6 +301,11 @@ static int uefirttime_test4(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetTime", "Failed to get time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -330,6 +345,11 @@ static int uefirttime_test4(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_SET_TIME, &settime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetTime", "Failed to set time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -344,6 +364,11 @@ static int uefirttime_test4(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetTime", "Failed to get time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -385,6 +410,11 @@ static int uefirttime_test4(fwts_framework *fw) status = ~0ULL; ioret = ioctl(fd, EFI_RUNTIME_SET_TIME, &settime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetTime", "Failed to set time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -407,6 +437,11 @@ static int uefirttime_test_settime_invalid( ioret = ioctl(fd, EFI_RUNTIME_SET_TIME, settime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } if (status == EFI_INVALID_PARAMETER) { fwts_passed(fw, "UEFI runtime service SetTime interface test " "passed, returned EFI_INVALID_PARAMETER as expected."); @@ -439,6 +474,11 @@ static int uefirttime_test_settime_invalid_time( ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetTime", "Failed to get wakeup time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -474,6 +514,11 @@ static int uefirttime_test_settime_invalid_time( settime.status = &status; ioret = ioctl(fd, EFI_RUNTIME_SET_TIME, &settime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetTime", "Failed to set wakeup time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -627,7 +672,7 @@ static int uefirttime_test18(fwts_framework *fw) if (status == EFI_UNSUPPORTED) { fwts_skipped(fw, "Skipping test, GetWakeupTime runtime " "service is not supported on this platform."); - return FWTS_OK; + return FWTS_SKIP; } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime", "Failed to get wakeup time with UEFI runtime service."); @@ -653,17 +698,19 @@ static int uefirttime_test_getwaketime_invalid( ioret = ioctl(fd, EFI_RUNTIME_GET_WAKETIME, getwakeuptime); if (ioret == -1) { - if (status == EFI_INVALID_PARAMETER || - status == EFI_UNSUPPORTED) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetTimeWakeupTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } + if (status == EFI_INVALID_PARAMETER) { fwts_passed(fw, "UEFI runtime service GetTimeWakeupTime interface test " - "passed, returned EFI_INVALID_PARAMETER or " - "EFI_UNSUPPORTED as expected."); + "passed, returned EFI_INVALID_PARAMETER as expected."); return FWTS_OK; } else { fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime", "Failed to get correct return status from UEFI " - "runtime service, expecting EFI_INVALID_PARAMETER " - "or EFI_UNSUPPORTED."); + "runtime service, expecting EFI_INVALID_PARAMETER."); fwts_uefi_print_status_info(fw, status); return FWTS_ERROR; } @@ -743,6 +790,11 @@ static int uefirttime_test23(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_GET_TIME, &gettime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, GetTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetTime", "Failed to get time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -760,9 +812,9 @@ static int uefirttime_test23(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_SET_WAKETIME, &setwakeuptime); if (ioret == -1) { if (status == EFI_UNSUPPORTED) { - fwts_skipped(fw, "Skipping test, GetWakeupTime runtime " + fwts_skipped(fw, "Skipping test, SetWakeupTime runtime " "service is not supported on this platform."); - return FWTS_OK; + return FWTS_SKIP; } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetWakeupTime", "Failed to set wakeup time with UEFI runtime service."); @@ -783,7 +835,7 @@ static int uefirttime_test23(fwts_framework *fw) if (status == EFI_UNSUPPORTED) { fwts_skipped(fw, "Skipping test, GetWakeupTime runtime " "service is not supported on this platform."); - return FWTS_OK; + return FWTS_SKIP; } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime", "Failed to get wakeup time with UEFI runtime service."); @@ -815,6 +867,11 @@ static int uefirttime_test23(fwts_framework *fw) ioret = ioctl(fd, EFI_RUNTIME_SET_WAKETIME, &setwakeuptime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetWakeupTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetWakeupTime", "Failed to set wakeup time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status); @@ -829,7 +886,7 @@ static int uefirttime_test23(fwts_framework *fw) if (status == EFI_UNSUPPORTED) { fwts_skipped(fw, "Skipping test, GetWakeupTime runtime " "service is not supported on this platform."); - return FWTS_OK; + return FWTS_SKIP; } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime", "Failed to get wakeup time with UEFI runtime service."); @@ -861,9 +918,9 @@ static int uefirttime_test_setwakeuptime_invalid( ioret = ioctl(fd, EFI_RUNTIME_SET_WAKETIME, setwakeuptime); if (ioret == -1) { if (status == EFI_UNSUPPORTED) { - fwts_skipped(fw, "Skipping test, GetWakeupTime runtime " + fwts_skipped(fw, "Skipping test, SetWakeupTime runtime " "service is not supported on this platform."); - return FWTS_OK; + return FWTS_SKIP; } if (status == EFI_INVALID_PARAMETER) { fwts_passed(fw, "UEFI runtime service SetTimeWakeupTime interface test " @@ -912,7 +969,7 @@ static int uefirttime_test_setwakeuptime_invalid_time( if (status == EFI_UNSUPPORTED) { fwts_skipped(fw, "Skipping test, GetWakeupTime runtime " "service is not supported on this platform."); - return FWTS_OK; + return FWTS_SKIP; } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeGetWakeupTime", "Failed to get wakeup time with UEFI runtime service."); @@ -951,6 +1008,11 @@ static int uefirttime_test_setwakeuptime_invalid_time( setwakeuptime.Enabled = true; ioret = ioctl(fd, EFI_RUNTIME_SET_WAKETIME, &setwakeuptime); if (ioret == -1) { + if (status == EFI_UNSUPPORTED) { + fwts_skipped(fw, "Skipping test, SetWakeupTime runtime " + "service is not supported on this platform."); + return FWTS_SKIP; + } fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetWakeupTime", "Failed to set wakeup time with UEFI runtime service."); fwts_uefi_print_status_info(fw, status);