[PATCH v7] fwts: skip the wake alarm suite if the feature is not implemented
Al Korv
alkorv at posteo.uk
Sat Aug 23 08:04:30 UTC 2025
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 <alkorv at posteo.uk>
---
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 <linux/rtc.h>
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 {
--
2.47.2
More information about the fwts-devel
mailing list