All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/clock_adjtime: Fix unsupported WARN
@ 2019-06-21  9:51 Ping Fang
  2019-06-24  2:56 ` Li Wang
  2019-07-04  9:33 ` Cyril Hrubis
  0 siblings, 2 replies; 3+ messages in thread
From: Ping Fang @ 2019-06-21  9:51 UTC (permalink / raw)
  To: ltp

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

Signed-off-by: Ping Fang <pifang@redhat.com>
---
 testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c | 4 ++++
 testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c b/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c
index 6eac1f25c..2c42189e0 100644
--- a/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c
+++ b/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c
@@ -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 */
diff --git a/testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c b/testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c
index 1ce936f96..0224089e1 100644
--- a/testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c
+++ b/testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c
@@ -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 */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [LTP] [PATCH] syscalls/clock_adjtime: Fix unsupported WARN
  2019-06-21  9:51 [LTP] [PATCH] syscalls/clock_adjtime: Fix unsupported WARN Ping Fang
@ 2019-06-24  2:56 ` Li Wang
  2019-07-04  9:33 ` Cyril Hrubis
  1 sibling, 0 replies; 3+ messages in thread
From: Li Wang @ 2019-06-24  2:56 UTC (permalink / raw)
  To: ltp

On Fri, Jun 21, 2019 at 5:51 PM Ping Fang <pifang@redhat.com> wrote:

> 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
>
> Signed-off-by: Ping Fang <pifang@redhat.com>
>

Reviewed-by: Li Wang <liwang@redhat.com>
-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190624/4e6e3ba5/attachment.html>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [LTP] [PATCH] syscalls/clock_adjtime: Fix unsupported WARN
  2019-06-21  9:51 [LTP] [PATCH] syscalls/clock_adjtime: Fix unsupported WARN Ping Fang
  2019-06-24  2:56 ` Li Wang
@ 2019-07-04  9:33 ` Cyril Hrubis
  1 sibling, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2019-07-04  9:33 UTC (permalink / raw)
  To: ltp

Hi!
Pushed with minor changes, thanks.

>  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.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-04  9:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-21  9:51 [LTP] [PATCH] syscalls/clock_adjtime: Fix unsupported WARN Ping Fang
2019-06-24  2:56 ` Li Wang
2019-07-04  9:33 ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.