[PATCH] [v4] fwts: skip the wake alarm suite if the feature is not implemented
Al Korv
alkorv at posteo.uk
Sat Aug 2 18:28:34 UTC 2025
On Saturday, 2 August 2025 18:53:30 BST Al Korv wrote:
> 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 subsequent tests fail in this
> case, contrary to the error message printed in the non-x86
> branch of the routine wakealarm_test1(). Here's an excerpt
> from the FWTS results log obtained in such an environmemnt:
>
> wakealarm: ACPI Wakealarm tests.
> ---------------------------------------------------------
> Test 1 of 5: Test existence of RTC with alarm interface.
> Cannot read Real Time Clock Alarm with ioctl RTC_ALM_READ
> /dev/rtc0.
> 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.
> 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.
> Cannot set Real Time Clock Alarm with ioctl RTC_ALM_SET /dev/rtc0.
> FAILED [MEDIUM] WakeAlarmNotResetTest5: Test 5, RTC wakealarm
> failed to be reset back to original time.
>
> =================================================================
> 0 passed, 4 failed, 0 warning, 0 aborted, 0 skipped, 0 info only.
> =================================================================
>
> 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 merging the routine wakealarm_test1()
> into the suite initialization callback; if fwts_framework_run_test()
> fails on an x86 machine, then the suite will be aborted, if it
> fails on an non-x86 machine, then the suite will be skipped.
> The wakealarm suite report looks as follows after the patch
> is applied:
>
> wakealarm: ACPI Wakealarm tests.
> ------------------------------------------------------------
> Cannot read Real Time Clock Alarm with ioctl RTC_ALM_READ
> /dev/rtc0.
> 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.
> =================================================================
> 0 passed, 0 failed, 0 warning, 0 aborted, 5 skipped, 0 info only.
> =================================================================
>
> Signed-off-by: Al Korv <alkorv at posteo.uk>
> ---
> src/acpi/wakealarm/wakealarm.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/src/acpi/wakealarm/wakealarm.c b/src/acpi/wakealarm/wakealarm.c
> index 89512540..96be05c7 100644
> --- a/src/acpi/wakealarm/wakealarm.c
> +++ b/src/acpi/wakealarm/wakealarm.c
> @@ -32,11 +32,9 @@
>
> static struct rtc_time rtc_tm;
>
> -static int wakealarm_test1(fwts_framework *fw)
> +static int wakealarm_test_init(fwts_framework *fw)
> {
> - if (fwts_wakealarm_get(fw, &rtc_tm) == FWTS_OK) {
> - fwts_passed(fw, "RTC with a RTC alarm ioctl() interface
found.");
> - } else {
> + if (fwts_wakealarm_get(fw, &rtc_tm) != FWTS_OK) {
> #ifdef FWTS_ARCH_INTEL
> /* For x86 devices, this is considered a failure */
> fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoWakeAlarmTest1",
> @@ -55,6 +53,13 @@ static int wakealarm_test1(fwts_framework *fw)
> #endif
> }
> return FWTS_OK;
> +
This is a redundant new line, I'm sorry for that. Fixed in the 5th
version of the patch.
> +}
> +
> +static int wakealarm_test1(fwts_framework *fw)
> +{
> + fwts_passed(fw, "RTC with a RTC alarm ioctl() interface found.");
> + return FWTS_OK;
> }
>
> static int wakealarm_test2(fwts_framework *fw)
> @@ -172,6 +177,7 @@ static fwts_framework_minor_test wakealarm_tests[] = {
>
> static fwts_framework_ops wakealarm_ops = {
> .description = "ACPI Wakealarm tests.",
> + .init = wakealarm_test_init,
> .minor_tests = wakealarm_tests
> };
--
Sincerely yours,
Al Korv
More information about the fwts-devel
mailing list