fixing ACPI wakealarm test?
Jeffrey Hugo
jhugo at codeaurora.org
Thu Sep 28 17:12:20 UTC 2017
On 9/27/2017 5:33 PM, Al Stone wrote:
> On 09/27/2017 11:41 AM, Jeffrey Hugo wrote:
>> On 9/26/2017 5:33 PM, Colin Ian King wrote:
>>> On 27/09/17 00:27, Al Stone wrote:
>>>> So, some platforms don't really have an ACPI wake alarm, but the test is set to
>>>> essentially always be run:
>>>>
>>>> FWTS_REGISTER("wakealarm", &wakealarm_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH |
>>>> FWTS_FLAG_ROOT_PRIV)
>>>>
>>>> Is there a recommended way to make a test more hardware specific? Granted, if
>>>> I run FWTS on the platform, I can double check and make sure /sys/class/rtc/rtc0
>>>> exists (or something like that); if I run FWTS elsewhere, though, that's clearly
>>>> not going to work. I know I've added options in the past for architectures, but
>>>> this is specific to an individual machine and it would seem like overkill to
>>>> put in options for specific machines.
>>>>
>>>> Suggestions?
>>>
>>> Perhaps the simplest approach is to skip all the subsequent tests if
>>> wakealarm_test1() fails to find a working interface.
>>
>> Its been a while since I've looked at this, but if I recall correctly,
>> wakealarm_tes1() always finds a "working" interface due to how the Linux kernel
>> abstracts RTC.
>>
>> What I've seen on our platform is that UEFI does not implement the wake alarm
>> functionality, however the kernel is happy to "fake" it, until you try setting
>> an actual alarm, then you start getting failures.
>>
>> I'd be interested in determining a way to address this, since it would alleviate
>> the burden of blacklisting the test and explaining why.
>
> @Jeffrey: would you mind testing the patch below (it should apply to top-of-tree
> for FWTS)? Two things change with this patch: (1) assume fwts_wakealarm_get()
> does not work, and the ioctl() has to to succeed, and (2) fail if the wakealarm
> is not currently enabled. That *may* be sufficient for your platform, but I
> think the RTC ioctl() has to be fixed ultimately -- it's kind of strange the way
> it works, as you noted, and it makes it really hard for the device to tell you
> if the RTC wakealarm is working, or even exists.
>
>
> diff --git a/src/lib/src/fwts_wakealarm.c b/src/lib/src/fwts_wakealarm.c
> index c0550303..d725caaa 100644
> --- a/src/lib/src/fwts_wakealarm.c
> +++ b/src/lib/src/fwts_wakealarm.c
> @@ -39,17 +39,21 @@ static const char *fwts_rtc = "/dev/rtc0";
> int fwts_wakealarm_get(fwts_framework *fw, struct rtc_time *rtc_tm)
> {
> int fd;
> - int ret = FWTS_OK;
> + int ret = FWTS_ERROR;
> + struct rtc_wkalrm rtc_wakealarm;
>
> if ((fd = open(fwts_rtc, O_RDWR)) < 0) {
> fwts_log_error(fw, "Cannot access Real Time Clock device %s.", fwts_rtc);
> return FWTS_ERROR;
> }
>
> - if (ioctl(fd, RTC_ALM_READ, rtc_tm) < 0) {
> - fwts_log_error(fw, "Cannot read Real Time Clock Alarm with ioctl RTC_ALM_READ
> %s.", fwts_rtc);
> - ret = FWTS_ERROR;
> + if (ioctl(fd, RTC_WKALM_RD, &rtc_wakealarm) < 0) {
> + if (!rtc_wakealarm.enabled) {
> + fwts_log_error(fw, "Cannot read Real Time Clock Alarm with ioctl
> RTC_ALM_READ %s.", fwts_rtc);
> + ret = FWTS_ERROR;
> + }
> }
> + ret = FWTS_OK;
> (void)close(fd);
>
> return ret;
>
>
Doesn't look like your suggested change made a difference in my case.
Attaching results before and after the change.
--
Jeffrey Hugo
Qualcomm Datacenter Technologies as an affiliate of Qualcomm
Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
-------------- next part --------------
Results generated by fwts: Version V17.09.00 (2017-09-27 07:09:03).
Some of this work - Copyright (c) 1999 - 2017, Intel Corp. All rights reserved.
Some of this work - Copyright (c) 2010 - 2017, Canonical.
Some of this work - Copyright (c) 2016 - 2017, IBM.
Some of this work - Copyright (c) 2017, ARM Ltd.
This test run on 28/09/17 at 17:08:05 on host Linux ubuntu 4.11.0 #1 SMP Fri Sep
1 09:02:18 PDT 2017 aarch64.
Command: "fwts wakealarm".
Running tests: wakealarm.
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.
================================================================================
2 passed, 4 failed, 0 warning, 0 aborted, 0 skipped, 0 info only.
================================================================================
2 passed, 4 failed, 0 warning, 0 aborted, 0 skipped, 0 info only.
Test Failure Summary
================================================================================
Critical failures: NONE
High failures: NONE
Medium failures: 3
wakealarm: RTC wakealarm did not trigger.
wakealarm: Failed to trigger and fire wakealarm.
wakealarm: RTC wakealarm failed to be reset back to original time.
Low failures: NONE
Other failures: NONE
Test |Pass |Fail |Abort|Warn |Skip |Info |
---------------+-----+-----+-----+-----+-----+-----+
wakealarm | 2| 4| | | | |
---------------+-----+-----+-----+-----+-----+-----+
Total: | 2| 4| 0| 0| 0| 0|
---------------+-----+-----+-----+-----+-----+-----+
-------------- next part --------------
Results generated by fwts: Version V17.09.00 (2017-09-27 07:09:03).
Some of this work - Copyright (c) 1999 - 2017, Intel Corp. All rights reserved.
Some of this work - Copyright (c) 2010 - 2017, Canonical.
Some of this work - Copyright (c) 2016 - 2017, IBM.
Some of this work - Copyright (c) 2017, ARM Ltd.
This test run on 28/09/17 at 17:01:23 on host Linux ubuntu 4.11.0 #1 SMP Fri Sep
1 09:02:18 PDT 2017 aarch64.
Command: "fwts wakealarm".
Running tests: wakealarm.
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.
================================================================================
2 passed, 4 failed, 0 warning, 0 aborted, 0 skipped, 0 info only.
================================================================================
2 passed, 4 failed, 0 warning, 0 aborted, 0 skipped, 0 info only.
Test Failure Summary
================================================================================
Critical failures: NONE
High failures: NONE
Medium failures: 3
wakealarm: RTC wakealarm did not trigger.
wakealarm: Failed to trigger and fire wakealarm.
wakealarm: RTC wakealarm failed to be reset back to original time.
Low failures: NONE
Other failures: NONE
Test |Pass |Fail |Abort|Warn |Skip |Info |
---------------+-----+-----+-----+-----+-----+-----+
wakealarm | 2| 4| | | | |
---------------+-----+-----+-----+-----+-----+-----+
Total: | 2| 4| 0| 0| 0| 0|
---------------+-----+-----+-----+-----+-----+-----+
More information about the fwts-devel
mailing list