clock_gettime04: multiply the timediff if test in VM
PATCH v2 1/1 clock_gettime04: multiply the timediff if test in VM
To balance that the test inside a VM can NOT get enough CPU time, which result in sporadically fails with the time comparing.
clock_gettime04.c:155: PASS: CLOCK_REALTIME: Difference between successive readings is reasonable clock_gettime04.c:155: PASS: CLOCK_REALTIME_COARSE: Difference between successive readings is reasonable clock_gettime04.c:148: FAIL: CLOCK_MONOTONIC: Difference between successive readings greater than 5 ms (2): 22 clock_gettime04.c:155: PASS: CLOCK_MONOTONIC_COARSE: Difference between successive readings is reasonable clock_gettime04.c:148: FAIL: CLOCK_MONOTONIC_RAW: Difference between successive readings greater than 5 ms (1): 22 clock_gettime04.c:148: FAIL: CLOCK_BOOTTIME: Difference between successive readings greater than 5 ms (1): 29
--- .../kernel/syscalls/clock_gettime/clock_gettime04.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/clock_gettime/clock_gettime04.c +9 -3
@@ -22,6 +22,7 @@ clockid_t clks[] = { };static gettime_t ptr_vdso_gettime, ptr_vdso_gettime64; +static long long DELTA =5 ;static inline int do_vdso_gettime (gettime_t vdso,clockid_t clk_id,void *ts) {
@@ -82,6 +83,11 @@ static struct test_variants {static void setup (void ) { +if (tst_is_virt (VIRT_ANY )) { +tst_res (TINFO ,"Running in a virtual machine, multiply the DELTA by 10." ); +DELTA *=10 ; + } +find_clock_gettime_vdso (&ptr_vdso_gettime, &ptr_vdso_gettime64); }
@@ -143,9 +149,9 @@ static void run(unsigned int i) diff /=1000000 ; -if (diff >=5 ) { -tst_res (TFAIL ,"%s: Difference between successive readings greater than 5 ms (%d): %lld" , -tst_clock_name (clks[i]), j, diff); +if (diff >=DELTA ) { +tst_res (TFAIL ,"%s: Difference between successive readings greater than %lld ms (%d): %lld" , +tst_clock_name (clks[i]),DELTA , j, diff);return ; } }
Signature · 1 line
2.21.3
PATCH v2 1/1 clock_gettime04: multiply the timediff if test in VM
Hi!
Quoted 12 lines
Signed-off-by Li Wang <[email protected]>Cc Viresh Kumar <[email protected]>Cc Cyril Hrubis <[email protected]>--- .../kernel/syscalls/clock_gettime/clock_gettime04.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)testcases/kernel/syscalls/clock_gettime/clock_gettime04.c +0
-0
testcases/kernel/syscalls/clock_gettime/clock_gettime04.c clockid_t clks[] = { · line 25
Quoted 4 lines
testcases/kernel/syscalls/clock_gettime/clock_gettime04.c +1
-0@@ -22,6 +22,7 @@ clockid_t clks[] = { };static gettime_t ptr_vdso_gettime, ptr_vdso_gettime64; +static long long DELTA =5 ;
One minor nit, variables are supposed to be lowercase.
Other than that, Reviewed-by: Cyril Hrubis <[email protected]>
Quoted 30 lines
testcases/kernel/syscalls/clock_gettime/clock_gettime04.c +8
-3static inline int do_vdso_gettime (gettime_t vdso,clockid_t clk_id,void *ts) {@@ -82,6 +83,11 @@ static struct test_variants {static void setup (void ) { +if (tst_is_virt (VIRT_ANY )) { +tst_res (TINFO ,"Running in a virtual machine, multiply the DELTA by 10." ); +DELTA *=10 ; + } +find_clock_gettime_vdso (&ptr_vdso_gettime, &ptr_vdso_gettime64); }@@ -143,9 +149,9 @@ static void run(unsigned int i) diff /=1000000 ; -if (diff >=5 ) { -tst_res (TFAIL ,"%s: Difference between successive readings greater than 5 ms (%d): %lld" , -tst_clock_name (clks[i]), j, diff); +if (diff >=DELTA ) { +tst_res (TFAIL ,"%s: Difference between successive readings greater than %lld ms (%d): %lld" , +tst_clock_name (clks[i]),DELTA , j, diff);return ; } }Signature · 1 line
2.21.3
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v2 1/1 clock_gettime04: multiply the timediff if test in VM
Quoted 4 lines
One minor nit, variables are supposed to be lowercase.
Other than that, Reviewed-by: Cyril Hrubis <[email protected]>
Thanks for the review, pushed with lowercase tweaked.
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20200915/dc9f8520/attachment.htm>