Skip to content

Commit bd355b9

Browse files
Thadeu Lima de Souza Cascardometan-ucw
authored andcommitted
timer_create01: accept ENOTSUP
CLOCK_REALTIME_ALARM and CLOCK_BOOTTIME_ALARM require an RTC with alarm support, which may not be present on a system. In that case, the kernel will return EOPNOTSUPP, which is defined as ENOTSUP in userspace. As these clocks are already possibly unsupported, accept that as an error code besides the EINVAL code. Note that previously the kernel would incorrectly return the ENOTSUPP code, which is undefined in userspace. With these unfixed kernels, the test will fail when those RTCs are not present. Kernel was fixed to return correct errno in: f18ddc13af98 ("alarmtimer: Use EOPNOTSUPP instead of ENOTSUPP"). Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
1 parent 2588daf commit bd355b9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

testcases/kernel/syscalls/timer_create/timer_create01.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
* 3) SIGEV_THREAD
1919
* 4) SIGEV_THREAD_ID
2020
* 5) NULL
21+
*
22+
* This is also regression test for commit:
23+
* f18ddc13af98 ("alarmtimer: Use EOPNOTSUPP instead of ENOTSUPP")
2124
*/
2225

2326
#include <signal.h>
@@ -77,7 +80,8 @@ static void run(unsigned int n)
7780
&created_timer_id));
7881

7982
if (TST_RET != 0) {
80-
if (possibly_unsupported(clock) && TST_ERR == EINVAL) {
83+
if (possibly_unsupported(clock) &&
84+
(TST_ERR == EINVAL || TST_ERR == ENOTSUP)) {
8185
tst_res(TPASS | TTERRNO,
8286
"%s unsupported, failed as expected",
8387
get_clock_str(clock));

0 commit comments

Comments
 (0)