Skip to contentSkip to conversation

syscalls/clock_adjtime: Fix unsupported WARN

PATCH New Ping Fang 3 participants 3 messages Jun 21, 2019 – Jul 4, 2019

lore
Share & tools
lore

Ping Fang

author
#0 lore raw

PATCH 1/1 syscalls/clock_adjtime: Fix unsupported WARN

When clock_adjtime is not implemented, cleanup will still try this call, then enter tst_cvres WARN handler.

tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s ../../../../include/tst_safe_clocks.h:57: CONF: syscall(-1) __NR_clock_adjtime not supported ../../../../include/tst_safe_clocks.h:57: CONF: syscall(-1) __NR_clock_adjtime not supported ../../../../include/tst_safe_clocks.h:60: WARN: clock_adjtime02.c:211 clock_adjtime() failed -1: ENOSYS

Summary:

passed   0
failed   0
skipped  1

warnings 1

---
 testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c | 4 ++++
 testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c | 4 ++++
 2 files changed, 8 insertions(+)
testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c +4 -0
index 6eac1f25c..2c42189e0 100644
@@ -58,6 +58,7 @@
 
 static long hz;
 static struct timex saved, ttxc;
+static int support = 0;
 
 struct test_case {
 	unsigned int modes;
@@ -168,6 +169,7 @@ static void setup(void)
 	int rval;
 
 	rval = SAFE_CLOCK_ADJTIME(CLOCK_REALTIME, &saved);
+	support = 1;
 
 	if (rval != TIME_OK && rval != TIME_ERROR) {
 		timex_show("SAVE_STATUS", saved);
@@ -197,6 +199,8 @@ static void setup(void)
 
 static void cleanup(void)
 {
+	if (support == 0)
+		return;
 	saved.modes = ADJ_ALL;
 
 	/* restore clock resolution based on original status flag */
testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c +4 -0
index 1ce936f96..0224089e1 100644
@@ -59,6 +59,7 @@
 
 static long hz;
 static struct timex saved, ttxc;
+static int support = 0;
 
 static void cleanup(void);
 
@@ -176,6 +177,7 @@ static void setup(void)
 	int rval;
 
 	rval = SAFE_CLOCK_ADJTIME(CLOCK_REALTIME, &saved);
+	support = 1;
 
 	if (rval != TIME_OK && rval != TIME_ERROR) {
 		timex_show("SAVE_STATUS", saved);
@@ -197,6 +199,8 @@ static void setup(void)
 
 static void cleanup(void)
 {
+	if (support == 0)
+		return;
 	saved.modes = ADJ_ALL;
 
 	/* restore clock resolution based on original status flag */
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 syscalls/clock_adjtime: Fix unsupported WARN

Quoted 11 lines · Ping Fang

When clock_adjtime is not implemented, cleanup will still try this call, then enter tst_cvres WARN handler.

tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s ../../../../include/tst_safe_clocks.h:57: CONF: syscall(-1) __NR_clock_adjtime not supported ../../../../include/tst_safe_clocks.h:57: CONF: syscall(-1) __NR_clock_adjtime not supported ../../../../include/tst_safe_clocks.h:60: WARN: clock_adjtime02.c:211 clock_adjtime() failed -1: ENOSYS

Quoted 8 lines

Summary:

passed   0
failed   0
skipped  1

warnings 1

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190624/4e6e3ba5/attachment.html>
#2 lore raw

PATCH 1/1 syscalls/clock_adjtime: Fix unsupported WARN

In reply to Ping Fang

Hi!
Pushed with minor changes, thanks.

Quoted 3 lines

static long hz;
static struct timex saved, ttxc;
+static int support = 0;

Global variables are initialized to 0, there is no point in adding the assignment here. I also renamed the support to supported, it's not that longer and describes the situation better.

Signature · 2 lines
Cyril Hrubis
[email protected]