Skip to contentSkip to conversation

ltp: keep the .tid hidden in the test library

PATCH New Li Wang 2 participants 4 messages Oct 25, 2017 Library code

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 ltp: keep the .tid hidden in the test library

And also fix some typos at the same time.

---
 include/tst_safe_macros.h                                     | 2 +-
 include/tst_timer_test.h                                      | 1 -
 lib/tst_test.c                                                | 8 +++++---
 testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep02.c | 3 +--
 testcases/kernel/syscalls/epoll_wait/epoll_wait02.c           | 1 -
 testcases/kernel/syscalls/futex/futex_wait05.c                | 1 -
 testcases/kernel/syscalls/poll/poll02.c                       | 1 -
 testcases/kernel/syscalls/pselect/pselect01.c                 | 1 -
 testcases/kernel/syscalls/select/select04.c                   | 1 -
 9 files changed, 7 insertions(+), 12 deletions(-)
include/tst_safe_macros.h +1 -1
index 9562005..ed9c73c 100644
@@ -406,7 +406,7 @@ static inline sighandler_t safe_signal(const char *file, const int lineno,
 #define SAFE_EXECL(file, arg, ...) do {				\
        execl((file), (arg), ##__VA_ARGS__);			\
        tst_brk_(__FILE__, __LINE__, TBROK | TERRNO,		\
-                "execlp(%s, %s, ...) failed", file, arg); 	\
+                "execl(%s, %s, ...) failed", file, arg); 	\
        } while (0)
 
 int safe_getpriority(const char *file, const int lineno, int which, id_t who);
include/tst_timer_test.h +0 -1
index 59931d3..c22159a 100644
@@ -37,7 +37,6 @@
     }
 
     struct tst_test test = {
-	.tid = "syscall_name()",
 	.sample = sample,
     };
 
lib/tst_test.c +5 -3
index f8b3fb4..5b3f9c1 100644
@@ -688,11 +688,13 @@ static void do_setup(int argc, char *argv[])
 
 	assert_test_fn();
 
-	if (tst_test->sample)
-		tst_test = tst_timer_test_setup(tst_test);
-
 	if (!tst_test->tid)
 		tst_test->tid = get_tid(argv);
+	else
+		tst_brk(TBROK, "The .tid field should not be set in the tests");
+
+	if (tst_test->sample)
+		tst_test = tst_timer_test_setup(tst_test);
 
 	parse_opts(argc, argv);
 
testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep02.c +1 -2
index f114013..0efaf23 100644
@@ -36,7 +36,7 @@ int sample_fn(int clk_id, long long usec)
 
 	if (TEST_RETURN != 0) {
 		tst_res(TFAIL | TERRNO,
-			"nanosleep() returned %li", TEST_RETURN);
+			"clock_nanosleep() returned %li", TEST_RETURN);
 		return 1;
 	}
 
@@ -44,6 +44,5 @@ int sample_fn(int clk_id, long long usec)
 }
 
 static struct tst_test test = {
-	.tid = "nanosleep()",
 	.sample = sample_fn,
 };
testcases/kernel/syscalls/epoll_wait/epoll_wait02.c +0 -1
index aa1bd0d..9ffe9bd 100644
@@ -77,7 +77,6 @@ static void cleanup(void)
 }
 
 static struct tst_test test = {
-	.tid = "epoll_wait()",
 	.sample = sample_fn,
 	.setup = setup,
 	.cleanup = cleanup,
testcases/kernel/syscalls/futex/futex_wait05.c +0 -1
index f6b0aa1..8459c3d 100644
@@ -52,6 +52,5 @@ int sample_fn(int clk_id, long long usec)
 }
 
 static struct tst_test test = {
-	.tid = "futex_wait()",
 	.sample = sample_fn,
 };
testcases/kernel/syscalls/poll/poll02.c +0 -1
index 0aa228c..71d7369 100644
@@ -64,7 +64,6 @@ static void cleanup(void)
 }
 
 static struct tst_test test = {
-	.tid = "poll()",
 	.sample = sample_fn,
 	.setup = setup,
 	.cleanup = cleanup,
testcases/kernel/syscalls/pselect/pselect01.c +0 -1
index a2b5339..fc55bf2 100644
@@ -44,6 +44,5 @@ int sample_fn(int clk_id, long long usec)
 }
 
 static struct tst_test test = {
-	.tid = "pselect()",
 	.sample = sample_fn,
 };
testcases/kernel/syscalls/select/select04.c +0 -1
index 1431785..46ad934 100644
@@ -66,7 +66,6 @@ static void cleanup(void)
 }
 
 static struct tst_test test = {
-	.tid = "select()",
 	.sample = sample_fn,
 	.setup = setup,
 	.cleanup = cleanup,
Signature · 1 line
2.9.3
author
#1 lore raw

PATCH 1/1 ltp: keep the .tid hidden in the test library

Hi Cyril,

Attaching a new patch to achieve the same target in another way. It just remove the .tid from test struct and take use of TCID to replace.

Which one do you think is better?

Signature · 9 lines
Li Wang
[email protected]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ltp-remove-.tid-from-test-struct.patch
Type: text/x-patch
Size: 9335 bytes
Desc: not available
URL: <http://lists.linux.it/pipermail/ltp/attachments/20171025/5b7a073b/attachment-0001.bin>
#2 lore raw

PATCH 1/1 ltp: keep the .tid hidden in the test library

Hi!

Quoted 4 lines

Attaching a new patch to achieve the same target in another way. It just remove the .tid from test struct and take use of TCID to replace.

Which one do you think is better?

I think that removing it from the test structure is better, but reusing the oldlib TCID seems to be a bit messy solution to me. We may get rid of that one in the future, if we happen to convert all the oldlib testcases. I would be a bit happier if we decleared static char *tid in the tst_test.c instead.

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#3 lore raw

PATCH 1/1 ltp: keep the .tid hidden in the test library

Quoted 11 lines · Cyril Hrubis

Hi!

Quoted 4 lines

Attaching a new patch to achieve the same target in another way. It just remove the .tid from test struct and take use of TCID to replace.

Which one do you think is better?

I think that removing it from the test structure is better, but reusing the oldlib TCID seems to be a bit messy solution to me. We may get rid of that one in the future, if we happen to convert all the oldlib testcases. I would be a bit happier if we decleared static char *tid in the tst_test.c instead.

Ok, I understand. Thanks for reviewing quickly. Let me drafted a new patch.