From a9017caff3b77032d04e2e439f7c04a63241e63e Mon Sep 17 00:00:00 2001 From: Sergey Kolosov Date: Tue, 28 Jan 2025 23:56:26 +0100 Subject: nptl: extend test coverage for sched_yield We add sched_yield() API testing to the existing thread affinity test case because it allows us to test sched_yield() operation in the following scenarios: * On a main thread. * On multiple threads simultaneously. * On every CPU the system reports simultaneously. The ensures we exercise sched_yield() in as many scenarios as we would exercise calls to the affinity functions. Additionally, the test is improved by adding a semaphore to coordinate all the threads running, so that an early starter thread won't consume cpu resources that could be used to start the other threads. Co-authored-by: DJ Delorie Reviewed-by: Carlos O'Donell --- sysdeps/unix/sysv/linux/tst-skeleton-affinity.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sysdeps/unix/sysv/linux/tst-skeleton-affinity.c') diff --git a/sysdeps/unix/sysv/linux/tst-skeleton-affinity.c b/sysdeps/unix/sysv/linux/tst-skeleton-affinity.c index c2bb80d..cf97c3f 100644 --- a/sysdeps/unix/sysv/linux/tst-skeleton-affinity.c +++ b/sysdeps/unix/sysv/linux/tst-skeleton-affinity.c @@ -38,6 +38,7 @@ #include #include #include +#include /* CPU set configuration determined. Can be used from early_test. */ struct conf @@ -253,12 +254,12 @@ do_test (void) if (getaffinity (sizeof (set), &set) < 0 && errno == ENOSYS) { puts ("warning: getaffinity not supported, test cannot run"); - return 0; + return EXIT_UNSUPPORTED; } if (sched_getcpu () < 0 && errno == ENOSYS) { puts ("warning: sched_getcpu not supported, test cannot run"); - return 0; + return EXIT_UNSUPPORTED; } } -- cgit v1.1