From patchwork Sat Aug 23 08:04:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Korv X-Patchwork-Id: 2126740 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4c88jJ1JzHz1y0D for ; Sat, 23 Aug 2025 18:04:35 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1upjEn-0005C6-WF; Sat, 23 Aug 2025 08:04:34 +0000 Received: from mout01.posteo.de ([185.67.36.65]) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1upjEm-0005Bt-1C for fwts-devel@lists.ubuntu.com; Sat, 23 Aug 2025 08:04:32 +0000 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id DCEDD240027 for ; Sat, 23 Aug 2025 10:04:30 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4c88jB0kXCz9rxF; Sat, 23 Aug 2025 10:04:30 +0200 (CEST) From: Al Korv To: Ivan Hu Subject: [PATCH v7] fwts: skip the wake alarm suite if the feature is not implemented Date: Sat, 23 Aug 2025 08:04:30 +0000 Message-ID: <20250823080223.3285-2-alkorv@posteo.uk> In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=185.67.36.65; envelope-from=alkorv@posteo.uk; helo=mout01.posteo.de 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: , Cc: Al Korv , fwts-devel@lists.ubuntu.com Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" The wake alarm may be not implemented on a non-x86 platform thus the calls to the RTC alarm interface may legitimately fail. Although the wake alarm test suite appears to antici- pate this and skips the first test on a non-x86 platform if fwts_wakealarm_get() fails the routine doesn't detect that the wake alarm is not implemented thus the 1st test passes and the remaining tests fail if it is the case. Here's an excerpt from the FWTS results log obtained in such an envi- ronmemnt: wakealarm: ACPI Wakealarm tests. --------------------------------------------------------- Test 1 of 5: Test existence of RTC with alarm interface. PASSED: Test 1, RTC with a RTC alarm ioctl() interface found. Test 2 of 5: Trigger wakealarm for 1 seconds in the future. Trigger wakealarm for 1 seconds in the future. Cannot enable alarm interrupts on Real Time Clock device /dev/rtc0. FAILED [MEDIUM] WakeAlarmNotTriggeredTest2: Test 2, RTC wakealarm did not trigger. Test 3 of 5: Test if wakealarm is fired. Cannot enable alarm interrupts on Real Time Clock device /dev/rtc0. FAILED [MEDIUM] WakeAlarmNotTriggeredTest3: Test 3, Failed to trigger and fire wakealarm. Test 4 of 5: Multiple wakealarm firing tests. Trigger wakealarm for 1 seconds in the future. Cannot enable alarm interrupts on Real Time Clock device /dev/rtc0. FAILED [MEDIUM] WakeAlarmNotTriggeredTest4: Test 4, Failed to trigger and fire wakealarm. Test 5 of 5: Reset wakealarm time. PASSED: Test 5, RTC wakealarm set. FAILED [MEDIUM] WakeAlarmNotResetTest5: Test 5, RTC wakealarm failed to be reset back to original time. This happens because the routine fwts_framework_run_test() stops performing the suite only if its test returns FWTS_ABORTED or its init callback returns FWTS_SKIP while neither is the case here. The patch fixes the issue by adjusting the routines wakealarm_ test[2-5]() to return FWTS_SKIP if the 1st test is skipped. The wakealarm suite report looks as follows after the patch is applied: wakealarm: ACPI Wakealarm tests. ------------------------------------------------------------ Test 1 of 5: Test existence of RTC with alarm interface. The wake alarm is not supported. non-x86 devices sometimes do not have an RTC wake alarm that is normally controlled by the RTC alarm ioctl() interface. This interface does not exist, so the wake alarm tests will be skipped. Test 2 of 5: Trigger wakealarm for 1 seconds in the future. Test 3 of 5: Test if wakealarm is fired. Test 4 of 5: Multiple wakealarm firing tests. Test 5 of 5: Reset wakealarm time. Signed-off-by: Al Korv Acked-by: Ivan Hu --- src/acpi/wakealarm/wakealarm.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/acpi/wakealarm/wakealarm.c b/src/acpi/wakealarm/wakealarm.c index 89512540..14b405c4 100644 --- a/src/acpi/wakealarm/wakealarm.c +++ b/src/acpi/wakealarm/wakealarm.c @@ -31,6 +31,7 @@ #include static struct rtc_time rtc_tm; +static bool skip_suite = false; static int wakealarm_test1(fwts_framework *fw) { @@ -47,6 +48,8 @@ static int wakealarm_test1(fwts_framework *fw) "does not exist, so the wake alarm tests will be aborted."); return FWTS_ABORTED; #else + skip_suite = true; + fwts_log_info(fw, "non-x86 devices sometimes do not have an RTC wake alarm that " "is normally controlled by the RTC alarm ioctl() interface. This " @@ -59,6 +62,10 @@ static int wakealarm_test1(fwts_framework *fw) static int wakealarm_test2(fwts_framework *fw) { + if (skip_suite) { + return FWTS_SKIP; + } + fwts_log_info(fw, "Trigger wakealarm for 1 seconds in the future."); if (fwts_wakealarm_trigger(fw, 1)) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "WakeAlarmNotTriggeredTest2", @@ -77,6 +84,10 @@ static int wakealarm_test3(fwts_framework *fw) { int ret; + if (skip_suite) { + return FWTS_SKIP; + } + ret = fwts_wakealarm_test_firing(fw, 2); if (ret < 0) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "WakeAlarmNotTriggeredTest3", @@ -98,6 +109,10 @@ static int wakealarm_test4(fwts_framework *fw) uint32_t i; int failed = 0; + if (skip_suite) { + return FWTS_SKIP; + } + for (i = 1; i < 5; i++) { fwts_log_info(fw, "Trigger wakealarm for %" PRIu32 " seconds in the future.", i); int ret = fwts_wakealarm_test_firing(fw, i); @@ -125,6 +140,10 @@ static int wakealarm_test5(fwts_framework *fw) { struct rtc_time rtc_now; + if (skip_suite) { + return FWTS_SKIP; + } + if (fwts_wakealarm_set(fw, &rtc_tm) == FWTS_OK) { fwts_passed(fw, "RTC wakealarm set."); } else {