futex_waitv01: Add test verifies EAGIN/ETIMEDOUT
Hi Cyril,
I have submit a new patch according your review, please see: https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/
Thanks for your review!
Best wishes,
Gongyi
Quoted 74 lines
Hi!
Review
Quoted 11 lines
(quoted diff) +11
-0+static void test_mismatch_between_uaddr_and_val(void) +{ + struct timespec to; + + waitv->uaddr = (uintptr_t)futex; + waitv->flags = FUTEX_32 | FUTEX_PRIVATE_FLAG; + waitv->val = 1; + + init_timeout(&to); + + TST_EXP_FAIL(futex_waitv(waitv, 1, 0, &to, CLOCK_MONOTONIC),EAGAIN,
Review
Quoted 1 line
(quoted diff) +1
-0+ "futex_waitv mismatch between value of uaddr and val");The
init_timeout(&to)inits the timeout withCLOCK_REALTIMEtime, so we should passCLOCK_REALTIMEto thefutex_waitv()as well.Review
Quoted 11 lines
(quoted diff) +11
-0+} + +static void test_timeout(void) +{ + struct timespec to; + + waitv->uaddr = (uintptr_t)futex; + waitv->flags = FUTEX_32 | FUTEX_PRIVATE_FLAG; + waitv->val = 0; + + init_timeout(&to);I guess that we can as well just do:
SAFE_CLOCK_GETTIME(CLOCK_REALTIME, &to);Which would make the test much faster as we will not have to wait for one second for the timeout.
Eventually we can as well add a few miliseconds to the timeout, we do have a nice functions to work with different time structures in this case we can just do:
to = tst_timespec_add_us(to, 10000);To add 10ms to the timeout.
Review
Quoted 1 line
(quoted diff) +1
-0+ TST_EXP_FAIL(futex_waitv(waitv, 1, 0, &to, CLOCK_REALTIME),ETIMEDOUT,
Quoted 20 lines
(quoted diff) +6
-1+ "futex_waitv timeout"); + +} + static void cleanup(void) { free(futex);@@ -126,6 +154,8 @@ static void run(void) test_null_waiters(); test_invalid_clockid(); test_invalid_nr_futexes(); + test_mismatch_between_uaddr_and_val(); + test_timeout(); } static struct tst_test test = { --2.17.1
Quoted 2 lines
--
Mailing list info: https://lists.linux.it/listinfo/ltp--
Cyril Hrubis
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp