tests: sched-quota-accuracy: Fix test cpu selection
PATCH 1/1 tests: sched-quota-accuracy: Fix test cpu selection
From: Jan Kiszka <[email protected]>
pick_test_cpu() is adjusting test_cpu to the system's possibilities. That is 0 for a single-core machine, but it can also be something else on multicore machines if the OOB cpuset is restricted. And this causes the test to fail:
sched-quota-accuracy: ** BROKEN../tests/sched-quota-accuracy.c:96: FAILED: sched_setaffinity(0, sizeof(affinity), &affinity) (=Operation not permitted)
--- tests/sched-quota-accuracy.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
tests/sched-quota-accuracy.c +9 -9
@@ -389,15 +389,6 @@ int main(int argc, char *argv[]) }atexit ((void (*)(void ))cleanup_group); -set_cpu_affinity ();/* All test threads inherit this. */ - - param.sched_priority =MAIN_PRIO ; -__Tcall_assert (ret,pthread_setschedparam (pthread_self (),SCHED_FIFO , ¶m)); -__Tcall_assert (ret,evl_attach_self ("quota-accuracy:%d" ,getpid ())); - -__Tcall_assert (ret,evl_new_sem (&ready,"quota-ready:%d" ,getpid ())); -__Tcall_assert (ret,evl_new_event (&barrier,"quota-barrier:%d" ,getpid ())); -__Tcall_assert (ret,evl_new_mutex (&lock,"quota-lock:%d" ,getpid ()));/* * We need all threads to be pinned on the same (oob-capable)
@@ -407,6 +398,15 @@ int main(int argc, char *argv[])*/ test_cpu =pick_test_cpu (test_cpu, false,NULL );do_trace ("picked CPU%d for execution" , test_cpu); +set_cpu_affinity ();/* All test threads inherit this. */ + + param.sched_priority =MAIN_PRIO ; +__Tcall_assert (ret,pthread_setschedparam (pthread_self (),SCHED_FIFO , ¶m)); +__Tcall_assert (ret,evl_attach_self ("quota-accuracy:%d" ,getpid ())); + +__Tcall_assert (ret,evl_new_sem (&ready,"quota-ready:%d" ,getpid ())); +__Tcall_assert (ret,evl_new_event (&barrier,"quota-barrier:%d" ,getpid ())); +__Tcall_assert (ret,evl_new_mutex (&lock,"quota-lock:%d" ,getpid ()));if (nrthreads <=0 ) nrthreads =3 ;
Signature · 1 line
2.47.3
Philippe Gerum
AppliedQuoted 42 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
pick_test_cpu()is adjustingtest_cputo the system's possibilities. That is 0 for a single-core machine, but it can also be something else on multicore machines if the OOB cpuset is restricted. And this causes the test to fail:sched-quota-accuracy: ** BROKEN
../tests/sched-quota-accuracy.c:96: FAILED:sched_setaffinity(0, sizeof(affinity), &affinity)(=Operation not permitted)Fixes 245a2eac29eb ("tests: sched-quota-accuracy: extend measurement to preemption noise")Signed-off-by Jan Kiszka <[email protected]>--- tests/sched-quota-accuracy.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)tests/sched-quota-accuracy.c +2
-9@@ -389,15 +389,6 @@ int main(int argc, char *argv[]) }atexit ((void (*)(void ))cleanup_group); -set_cpu_affinity ();/* All test threads inherit this. */ - - param.sched_priority =MAIN_PRIO ; -__Tcall_assert (ret,pthread_setschedparam (pthread_self (),SCHED_FIFO , ¶m)); -__Tcall_assert (ret,evl_attach_self ("quota-accuracy:%d" ,getpid ())); - -__Tcall_assert (ret,evl_new_sem (&ready,"quota-ready:%d" ,getpid ())); -__Tcall_assert (ret,evl_new_event (&barrier,"quota-barrier:%d" ,getpid ())); -__Tcall_assert (ret,evl_new_mutex (&lock,"quota-lock:%d" ,getpid ()));/* * We need all threads to be pinned on the same (oob-capable) @@ -407,6 +398,15 @@ int main(int argc, char *argv[])*/ test_cpu =pick_test_cpu (test_cpu, false,NULL );do_trace ("picked CPU%d for execution" , test_cpu); +set_cpu_affinity ();/* All test threads inherit this. */ +
tests/sched-quota-accuracy.c int main(int argc, char *argv[]) · line 412
Quoted 10 lines
tests/sched-quota-accuracy.c +7
-0+ param.sched_priority =MAIN_PRIO ; +__Tcall_assert (ret,pthread_setschedparam (pthread_self (),SCHED_FIFO , ¶m)); +__Tcall_assert (ret,evl_attach_self ("quota-accuracy:%d" ,getpid ())); + +__Tcall_assert (ret,evl_new_sem (&ready,"quota-ready:%d" ,getpid ())); +__Tcall_assert (ret,evl_new_event (&barrier,"quota-barrier:%d" ,getpid ())); +__Tcall_assert (ret,evl_new_mutex (&lock,"quota-lock:%d" ,getpid ()));if (nrthreads <=0 ) nrthreads =3 ;
Merged, thanks.
Signature · 1 line
Philippe.