<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 8, 2020 at 12:27 PM Viresh Kumar <<a href="mailto:viresh.kumar@linaro.org">viresh.kumar@linaro.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This adds support for time64 tests to the existing futex() syscall<br>
tests.<br>
<br>
Signed-off-by: Viresh Kumar <<a href="mailto:viresh.kumar@linaro.org" target="_blank">viresh.kumar@linaro.org</a>><br>
Reviewed-by: Petr Vorel <<a href="mailto:pvorel@suse.cz" target="_blank">pvorel@suse.cz</a>><br>
---<br>
include/tst_timer.h | 12 ++<br>
.../syscalls/futex/futex_cmp_requeue01.c | 35 +++-<br>
.../syscalls/futex/futex_cmp_requeue02.c | 25 ++-<br>
testcases/kernel/syscalls/futex/futex_utils.h | 52 ++++--<br>
.../kernel/syscalls/futex/futex_wait01.c | 83 +++++-----<br>
.../kernel/syscalls/futex/futex_wait02.c | 104 ++++++------<br>
.../kernel/syscalls/futex/futex_wait03.c | 91 +++++------<br>
.../kernel/syscalls/futex/futex_wait04.c | 85 +++++-----<br>
.../kernel/syscalls/futex/futex_wait05.c | 2 +-<br>
.../syscalls/futex/futex_wait_bitset01.c | 50 ++++--<br>
.../kernel/syscalls/futex/futex_wake01.c | 71 ++++-----<br>
.../kernel/syscalls/futex/futex_wake02.c | 99 ++++++------<br>
.../kernel/syscalls/futex/futex_wake03.c | 111 +++++++------<br>
.../kernel/syscalls/futex/futex_wake04.c | 150 +++++++++---------<br>
testcases/kernel/syscalls/futex/futextest.h | 111 ++++++++-----<br>
15 files changed, 609 insertions(+), 472 deletions(-)<br>
<br>
diff --git a/include/tst_timer.h b/include/tst_timer.h<br>
index a726298b407d..b4280042c77f 100644<br>
--- a/include/tst_timer.h<br>
+++ b/include/tst_timer.h<br>
@@ -243,6 +243,18 @@ static inline int sys_clock_nanosleep64(clockid_t clk_id, int flags,<br>
request, remain);<br>
}<br>
<br>
+static inline int sys_futex(int *uaddr, int futex_op, int val, void *to,<br>
+ int *uaddr2, int val3)<br>
+{<br>
+ return tst_syscall(__NR_futex, uaddr, futex_op, val, to, uaddr2, val3);<br>
+}<br>
+<br>
+static inline int sys_futex_time64(int *uaddr, int futex_op, int val, void *to,<br>
+ int *uaddr2, int val3)<br>
+{<br>
+ return tst_syscall(__NR_futex_time64, uaddr, futex_op, val, to, uaddr2, val3);<br>
+}<br>
+<br>
static inline int libc_sched_rr_get_interval(pid_t pid, void *ts)<br>
{<br>
return sched_rr_get_interval(pid, ts);<br>
diff --git a/testcases/kernel/syscalls/futex/futex_cmp_requeue01.c b/testcases/kernel/syscalls/futex/futex_cmp_requeue01.c<br>
index c50fade9f969..bc9d2a6bee37 100644<br>
--- a/testcases/kernel/syscalls/futex/futex_cmp_requeue01.c<br>
+++ b/testcases/kernel/syscalls/futex/futex_cmp_requeue01.c<br>
@@ -18,6 +18,7 @@<br>
#include "tst_timer_test.h"<br>
#include "tst_test.h"<br>
#include "futextest.h"<br>
+#include "lapi/abisize.h"<br>
<br>
struct shared_data {<br>
futex_t futexes[2];<br>
@@ -42,14 +43,33 @@ static struct tcase {<br>
{1000, 300, 500},<br>
};<br>
<br>
+static struct test_variants {<br>
+ enum futex_fn_type fntype;<br>
+ enum tst_ts_type tstype;<br>
+ char *desc;<br>
+} variants[] = {<br>
+#if defined(TST_ABI32)<br>
+ { .fntype = FUTEX_FN_FUTEX, .tstype = TST_KERN_OLD_TIMESPEC, .desc = "syscall with kernel spec32"},<br>
+#endif<br>
+<br>
+#if defined(TST_ABI64)<br>
+ { .fntype = FUTEX_FN_FUTEX, .tstype = TST_KERN_TIMESPEC, .desc = "syscall with kernel spec64"},<br>
+#endif<br>
+<br>
+#if (<span class="gmail_default" style="font-size:small"></span>__NR_futex_time64 != __LTP__NR_INVALID_SYSCALL)<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small"></div><div class="gmail_default" style="font-size:small">This might not safe to use it directly if only check __NR_futex_time64 being</div><div class="gmail_default" style="font-size:small">defined. i.e Test it on the platform without achieving the system syscall(but </div><div class="gmail_default" style="font-size:small">define <span class="gmail_default"></span>__NR_futex_time64), the test children exit with TCONF will cause</div><div class="gmail_default" style="font-size:small">kind of issues.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">RHEL-8.2(ppc64le) failed as:</div><div class="gmail_default" style="font-size:small">--------------------------------------</div><div class="gmail_default" style="font-size:small"><pre style="color:rgb(0,0,0);white-space:pre-wrap"><pre style="white-space:pre-wrap">tag=futex_cmp_requeue01 stime=1588947939
cmdline="futex_cmp_requeue01"
contacts=""
analysis=exit
<<<test_output>>>
tst_test.c:1246: INFO: Timeout per run is 0h 05m 00s
futex_cmp_requeue01.c:202: INFO: Testing variant: syscall with kernel spec64
futex_cmp_requeue01.c:114: INFO: Test 0: waiters: 10, wakes: 3, requeues: 7
futex_cmp_requeue01.c:136: INFO: futex_cmp_requeue() returned 10
futex_cmp_requeue01.c:152: INFO: children woken, futex0: 0, futex1: 7, spurious wakeups: 0
futex_cmp_requeue01.c:197: PASS: futex_cmp_requeue()
futex_cmp_requeue01.c:114: INFO: Test 1: waiters: 10, wakes: 0, requeues: 10
futex_cmp_requeue01.c:136: INFO: futex_cmp_requeue() returned 10
futex_cmp_requeue01.c:152: INFO: children woken, futex0: 0, futex1: 10, spurious wakeups: 0
futex_cmp_requeue01.c:197: PASS: futex_cmp_requeue()
futex_cmp_requeue01.c:114: INFO: Test 2: waiters: 10, wakes: 2, requeues: 6
...
futex_cmp_requeue01.c:152: INFO: children woken, futex0: 200, futex1: 500, spurious wakeups: 0
futex_cmp_requeue01.c:197: PASS: futex_cmp_requeue()
tst_test.c:1246: INFO: Timeout per run is 0h 05m 00s
futex_cmp_requeue01.c:202: INFO: Testing variant: syscall time64 with kernel spec64
../../../../include/tst_timer.h:256: CONF: syscall(422) __NR_futex_time64 not supported
...
../../../../include/tst_timer.h:256: CONF: syscall(422) __NR_futex_time64 not supported
../../../../include/tst_timer.h:256: CONF: syscall(422) __NR_futex_time64 not supported
Test timeouted, sending SIGKILL!
tst_test.c:1286: INFO: If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1
tst_test.c:1287: BROK: Test killed! (timeout?)</pre></pre><pre style="color:rgb(0,0,0);white-space:pre-wrap"><br></pre><pre style="color:rgb(0,0,0);white-space:pre-wrap">cmdline="futex_wake02"
contacts=""
analysis=exit
<<<test_output>>>
tst_test.c:1246: INFO: Timeout per run is 0h 05m 00s
futex_wake02.c:155: INFO: Testing variant: syscall with kernel spec64
futex_wake02.c:105: PASS: futex_wake() woken up 1 threads
futex_wake02.c:105: PASS: futex_wake() woken up 2 threads
futex_wake02.c:105: PASS: futex_wake() woken up 3 threads
futex_wake02.c:105: PASS: futex_wake() woken up 4 threads
futex_wake02.c:105: PASS: futex_wake() woken up 5 threads
futex_wake02.c:105: PASS: futex_wake() woken up 6 threads
futex_wake02.c:105: PASS: futex_wake() woken up 7 threads
futex_wake02.c:105: PASS: futex_wake() woken up 8 threads
futex_wake02.c:105: PASS: futex_wake() woken up 9 threads
futex_wake02.c:105: PASS: futex_wake() woken up 10 threads
futex_wake02.c:118: PASS: futex_wake() woken up 0 threads
tst_test.c:1246: INFO: Timeout per run is 0h 05m 00s
futex_wake02.c:155: INFO: Testing variant: syscall time64 with kernel spec64
../../../../include/tst_timer.h:256: CONF: syscall(422) __NR_futex_time64 not supported
../../../../include/tst_timer.h:256: CONF: syscall(422) __NR_futex_time64 not supported
tst_test.c:1063: BROK: Test haven't reported results!
</pre></div></div><div><div class="gmail_default" style="font-size:small"><br></div><pre style="color:rgb(0,0,0);white-space:pre-wrap">futex_wake03.c:111: INFO: Testing variant: syscall with kernel spec64
futex_wake03.c:71: PASS: futex_wake() woken up 1 childs
futex_wake03.c:71: PASS: futex_wake() woken up 2 childs
futex_wake03.c:71: PASS: futex_wake() woken up 3 childs
futex_wake03.c:71: PASS: futex_wake() woken up 4 childs
futex_wake03.c:71: PASS: futex_wake() woken up 5 childs
futex_wake03.c:71: PASS: futex_wake() woken up 6 childs
futex_wake03.c:71: PASS: futex_wake() woken up 7 childs
futex_wake03.c:71: PASS: futex_wake() woken up 8 childs
futex_wake03.c:71: PASS: futex_wake() woken up 9 childs
futex_wake03.c:71: PASS: futex_wake() woken up 10 childs
futex_wake03.c:105: PASS: futex_wake() woken up 0 children
tst_test.c:1246: INFO: Timeout per run is 0h 05m 00s
futex_wake03.c:111: INFO: Testing variant: syscall time64 with kernel spec64
../../../../include/tst_timer.h:256: CONF: syscall(422) __NR_futex_time64 not supported
../../../../include/tst_timer.h:256: CONF: syscall(422) __NR_futex_time64 not supported
../../../../include/tst_timer.h:256: CONF: syscall(422) __NR_futex_time64 not supported
<span class="gmail_default" style="font-size:small">...</span>
../../../../include/tst_timer.h:256: CONF: syscall(422) __NR_futex_time64 not supported
../../../../include/tst_timer.h:256: CONF: syscall(422) __NR_futex_time64 not supported
Test timeouted, sending SIGKILL!
tst_test.c:1286: INFO: If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1
tst_test.c:1287: BROK: Test killed! (timeout?)
</pre><div class="gmail_default" style="font-size:small"><br></div><pre style="color:rgb(0,0,0);white-space:pre-wrap">cmdline="futex_wake04"
contacts=""
analysis=exit
<<<test_output>>>
tst_test.c:1246: INFO: Timeout per run is 0h 05m 00s
futex_wake04.c:69: INFO: Testing variant: syscall with kernel spec64
futex_wake04.c:142: INFO: Hugepagesize 16777216
futex_wake04.c:127: PASS: Hi hydra, thread2 awake!
tst_test.c:1246: INFO: Timeout per run is 0h 05m 00s
futex_wake04.c:69: INFO: Testing variant: syscall time64 with kernel spec64
futex_wake04.c:142: INFO: Hugepagesize 16777216
../../../../include/tst_timer.h:256: CONF: syscall(422) __NR_futex_time64 not supported
../../../../include/tst_timer.h:256: CONF: syscall(422) __NR_futex_time64 not supported
futex_wake04.c:129: FAIL: Bug: wait_thread2 did not wake after 30 secs.: SUCCESS (0) </pre><pre style="color:rgb(0,0,0);white-space:pre-wrap"><br></pre></div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>