Skip to contentSkip to conversation

Add tests for a group of real time clock ioctls

PATCH Superseded Filip Bozuta 2 participants 7 messages Apr 22, 2020 – Apr 23, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Add tests for a group of real time clock ioctls

This series covers tests for following RTC ioctls:

    *RTC_RD_TIME    *RTC_UIE_ON
    *RTC_SET_TIME   *RTC_UIE_OFF
    *RTC_ALM_READ   *RTC_PIE_ON
    *RTC_ALM_SET    *RTC_PIE_OFF
    *RTC_AIE_ON     *RTC_WIE_ON
    *RTC_AIE_OFF    *RTC_WIE_OFF

The functionalities of individual ioctls were described in this series patch commit messages.

The testing method for these ioctls is described in the upper comment sections of test programs.

Filip Bozuta (3):
testcases/kernel/syscalls/ioctl: Add test for RTC ioctls used to read
and set RTC time
testcases/kernel/syscalls/ioctl: Add test for RTC ioctls used to read
and set RTC alarm time
testcases/kernel/syscalls/ioctl: Add test for RTC ioctls used to turn
on/off RTC interrupts

 runtest/syscalls                              |   4 +
 testcases/kernel/syscalls/ioctl/.gitignore    |   3 +
 testcases/kernel/syscalls/ioctl/ioctl_rtc01.c | 112 ++++++++++++++++++
 testcases/kernel/syscalls/ioctl/ioctl_rtc02.c | 107 +++++++++++++++++
 testcases/kernel/syscalls/ioctl/ioctl_rtc03.c |  88 ++++++++++++++
 5 files changed, 314 insertions(+)
 create mode 100644 testcases/kernel/syscalls/ioctl/ioctl_rtc01.c
 create mode 100644 testcases/kernel/syscalls/ioctl/ioctl_rtc02.c
 create mode 100644 testcases/kernel/syscalls/ioctl/ioctl_rtc03.c
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 testcases/kernel/syscalls/ioctl: Add test for RTC ioctls used to read and set RTC time

This patch tests functionalities of following ioctls:

RTC_RD_TIME - Getting RTC time

    Returns this RTC's time in the following structure:

        struct rtc_time {
            int tm_sec;
            int tm_min;
            int tm_hour;
            int tm_mday;
            int tm_mon;
            int tm_year;
            int tm_wday;     /* unused */
            int tm_yday;     /* unused */
            int tm_isdst;    /* unused */
        };

    The fields in this structure have the same meaning and
    ranges as the tm structure described in gmtime man page.
    A pointer to this structure should be passed as the third
    ioctl argument.

RTC_SET_TIME - Setting RTC time

Sets this RTC's time to the time specified by the rtc_time structure pointed to by the third ioctl argument. To set the RTC's time the process must be privileged (i.e., have the CAP_SYS_TIME capability).

---
 runtest/syscalls                              |   2 +
 testcases/kernel/syscalls/ioctl/.gitignore    |   1 +
 testcases/kernel/syscalls/ioctl/ioctl_rtc01.c | 112 ++++++++++++++++++
 3 files changed, 115 insertions(+)
 create mode 100644 testcases/kernel/syscalls/ioctl/ioctl_rtc01.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-testcases-kernel-syscalls-ioctl-Add-test-for-RTC-ioc.patch
Type: text/x-patch
Size: 4058 bytes
Desc: not available
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200422/447e18cc/attachment-0001.bin>

#2 lore raw

[LTP] ?==?utf-8?q? ?==?utf-8?q? [PATCH 1/3]?==?utf-8?q? testcases/kernel/syscalls/ioctl: Add test for RTC ioctls used to read and set RTC time

Hi, Filip.

This is a very unclear way to set the structure elements:

+?? ?struct rtc_time rtc_set_time = {0, 15, 13, 26, 8, 119, 0, 0, 0};

Simple setting structure elements separately would be much better.

Also, why do you use such numbers: 15, 13,...? Is it just a random choice?

Thanks,
Aleksandar

-------- Original Message --------
Subject: [LTP] [PATCH 1/3] testcases/kernel/syscalls/ioctl: Add test for RTC ioctls used to read and set RTC time
Date: Wednesday, April 22, 2020 17:28 CEST
From: Filip Bozuta <[email protected]>
To: [email protected]
CC: [email protected], [email protected], [email protected]
References: <[email protected]>

?
This patch tests functionalities of following ioctls:

RTC_RD_TIME - Getting RTC time

Returns this RTC's time in the following structure:

struct rtc_time {
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday; /* unused */
int tm_yday; /* unused */
int tm_isdst; /* unused */
};

The fields in this structure have the same meaning and ranges as the tm structure described in gmtime man page. A pointer to this structure should be passed as the third ioctl argument.

RTC_SET_TIME - Setting RTC time

Sets this RTC's time to the time specified by the rtc_time structure pointed to by the third ioctl argument. To set the RTC's time the process must be privileged (i.e., have the CAP_SYS_TIME capability).

---
runtest/syscalls | 2 + testcases/kernel/syscalls/ioctl/.gitignore | 1 + testcases/kernel/syscalls/ioctl/ioctl_rtc01.c | 112 ++++++++++++++++++

3 files changed, 115 insertions(+)

create mode 100644 testcases/kernel/syscalls/ioctl/ioctl_rtc01.c ?

?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200423/538ecbb6/attachment-0001.htm>

#3 lore raw

PATCH 2/3 testcases/kernel/syscalls/ioctl: Add test for RTC ioctls used to read and set RTC alarm time

In reply to Filip Bozuta

This patch tests functionalities of following ioctls:

RTC_ALM_READ, RTC_ALM_SET - Getting/Setting alarm time

Read and set the alarm time, for RTCs that support alarms. The alarm interrupt must be separately enabled or disabled using the RTC_AIE_ON, RTC_AIE_OFF requests. The third ioctl's argument is a pointer to a rtc_time structure. Only the tm_sec, tm_min, and tm_hour fields of this structure are used.

---
 runtest/syscalls                              |   1 +
 testcases/kernel/syscalls/ioctl/.gitignore    |   1 +
 testcases/kernel/syscalls/ioctl/ioctl_rtc02.c | 107 ++++++++++++++++++
 3 files changed, 109 insertions(+)
 create mode 100644 testcases/kernel/syscalls/ioctl/ioctl_rtc02.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-testcases-kernel-syscalls-ioctl-Add-test-for-RTC-ioc.patch
Type: text/x-patch
Size: 3892 bytes
Desc: not available
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200422/85ddb95b/attachment-0001.bin>

#4 lore raw

[LTP] ?==?utf-8?q? ?==?utf-8?q? [PATCH 2/3]?==?utf-8?q? testcases/kernel/syscalls/ioctl: Add test for RTC ioctls used to read and set RTC alarm time

Similar to the situation in patch 1, you wrote:

+?? ?struct rtc_time rtc_set_alarm = {13, 35, 12};

In my opinion, this way of setting structure should be avoided.

Thanks,
Aleksandar

-------- Original Message --------
Subject: [LTP] [PATCH 2/3] testcases/kernel/syscalls/ioctl: Add test for RTC ioctls used to read and set RTC alarm time
Date: Wednesday, April 22, 2020 17:28 CEST
From: Filip Bozuta <[email protected]>
To: [email protected]
CC: [email protected], [email protected], [email protected]
References: <[email protected]>

?
This patch tests functionalities of following ioctls:

RTC_ALM_READ, RTC_ALM_SET - Getting/Setting alarm time

Read and set the alarm time, for RTCs that support alarms. The alarm interrupt must be separately enabled or disabled using the RTC_AIE_ON, RTC_AIE_OFF requests. The third ioctl's argument is a pointer to a rtc_time structure. Only the tm_sec, tm_min, and tm_hour fields of this structure are used.

---
runtest/syscalls | 1 + testcases/kernel/syscalls/ioctl/.gitignore | 1 + testcases/kernel/syscalls/ioctl/ioctl_rtc02.c | 107 ++++++++++++++++++

3 files changed, 109 insertions(+)

create mode 100644 testcases/kernel/syscalls/ioctl/ioctl_rtc02.c ?

?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200423/aabefe16/attachment-0001.htm>

#5 lore raw

PATCH 3/3 testcases/kernel/syscalls/ioctl: Add test for RTC ioctls used to turn on/off RTC interrupts

In reply to Filip Bozuta

This patch tests functionalities of following ioctls:

RTC_AIE_ON, RTC_AIE_OFF - Alarm interrupt enabling on/off

Enable or disable the alarm interrupt, for RTCs that support alarms. The third ioctl's argument is ignored.

RTC_UIE_ON, RTC_UIE_OFF - Update interrupt enabling on/off

Enable or disable the interrupt on every clock update, for RTCs that support this once-per-second interrupt. The third ioctl's argument is ignored.

RTC_PIE_ON, RTC_PIE_OFF - Periodic interrupt enabling on/off

Enable or disable the periodic interrupt, for RTCs that sup? port these periodic interrupts. The third ioctl's argument is ignored. Only a privileged process (i.e., one having the CAP_SYS_RESOURCE capability) can enable the periodic interrupt if the frequency is currently set above the value specified in /proc/sys/dev/rtc/max-user-freq.

RTC_WIE_ON, RTC_WIE_OFF - Watchdog interrupt enabling on/off

Enable or disable the Watchdog interrupt, for RTCs that sup- port this Watchdog interrupt. The third ioctl's argument is ignored.

---
 runtest/syscalls                              |  1 +
 testcases/kernel/syscalls/ioctl/.gitignore    |  1 +
 testcases/kernel/syscalls/ioctl/ioctl_rtc03.c | 88 +++++++++++++++++++
 3 files changed, 90 insertions(+)
 create mode 100644 testcases/kernel/syscalls/ioctl/ioctl_rtc03.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-testcases-kernel-syscalls-ioctl-Add-test-for-RTC-ioc.patch
Type: text/x-patch
Size: 3101 bytes
Desc: not available
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200422/ad87e1be/attachment-0001.bin>

#6 lore raw

[LTP] ?==?utf-8?q? ?==?utf-8?q? [PATCH 3/3]?==?utf-8?q? testcases/kernel/syscalls/ioctl: Add test for RTC ioctls used to turn on/off RTC interrupts

I thinks these lines:

+static int interrupt_requests[] = {
+?? ?RTC_AIE_ON, RTC_PIE_ON, RTC_UIE_ON,
+?? ?RTC_WIE_ON, RTC_AIE_OFF, RTC_PIE_OFF,
+?? ?RTC_UIE_OFF, RTC_WIE_OFF};
+static char requests_text[][15] = {
+?? ?"RTC_AIE_ON", "RTC_PIE_ON", "RTC_UIE_ON",
+?? ?"RTC_WIE_ON", "RTC_AIE_OFF", "RTC_PIE_OFF",
+?? ?"RTC_UIE_OFF", "RTC_WIE_OFF"};

would look much clearer as:

static int interrupt_requests[] = {
????RTC_AIE_ON,? RTC_PIE_ON,? RTC_UIE_ON,? RTC_WIE_ON, ????RTC_AIE_OFF, RTC_PIE_OFF, RTC_UIE_OFF, RTC_WIE_OFF}; static char requests_text[][15] = {
????"RTC_AIE_ON",? "RTC_PIE_ON",? "RTC_UIE_ON",? "RTC_WIE_ON", ??? "RTC_AIE_OFF", "RTC_PIE_OFF", "RTC_UIE_OFF", "RTC_WIE_OFF"};

Thanks, Aleksandar

P. S. (my email client doesn't handle tabs well (converts them to spaces) - ofcourse, you keep tabs, I em not suggesting replacing them with space)

-------- Original Message --------
Subject: [LTP] [PATCH 3/3] testcases/kernel/syscalls/ioctl: Add test for RTC ioctls used to turn on/off RTC interrupts
Date: Wednesday, April 22, 2020 17:28 CEST
From: Filip Bozuta <[email protected]>
To: [email protected]
CC: [email protected], [email protected], [email protected]
References: <[email protected]>

?
This patch tests functionalities of following ioctls:

RTC_AIE_ON, RTC_AIE_OFF - Alarm interrupt enabling on/off

Enable or disable the alarm interrupt, for RTCs that support alarms. The third ioctl's argument is ignored.

RTC_UIE_ON, RTC_UIE_OFF - Update interrupt enabling on/off

Enable or disable the interrupt on every clock update, for RTCs that support this once-per-second interrupt. The third ioctl's argument is ignored.

RTC_PIE_ON, RTC_PIE_OFF - Periodic interrupt enabling on/off

Enable or disable the periodic interrupt, for RTCs that sup? port these periodic interrupts. The third ioctl's argument is ignored. Only a privileged process (i.e., one having the CAP_SYS_RESOURCE capability) can enable the periodic interrupt if the frequency is currently set above the value specified in /proc/sys/dev/rtc/max-user-freq.

RTC_WIE_ON, RTC_WIE_OFF - Watchdog interrupt enabling on/off

Enable or disable the Watchdog interrupt, for RTCs that sup- port this Watchdog interrupt. The third ioctl's argument is ignored.

---
runtest/syscalls | 1 + testcases/kernel/syscalls/ioctl/.gitignore | 1 + testcases/kernel/syscalls/ioctl/ioctl_rtc03.c | 88 +++++++++++++++++++

3 files changed, 90 insertions(+)

create mode 100644 testcases/kernel/syscalls/ioctl/ioctl_rtc03.c ?

?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200423/b441dea2/attachment-0001.htm>