diff options
author | Ulrich Drepper <drepper@redhat.com> | 2007-04-03 23:29:18 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2007-04-03 23:29:18 +0000 |
commit | eab1bdfb8ef2902e7b68352d6ce1b5d603597e36 (patch) | |
tree | 00ac9dba5b0687fd0bb056bed3d75e812a2c6a79 /posix/tst-cpucount.c | |
parent | 9700b0390e40c7ffaed2a74ae3285edfe6080bd3 (diff) | |
download | glibc-eab1bdfb8ef2902e7b68352d6ce1b5d603597e36.tar.gz |
* posix/Makefile (routines): Add sched_cpucount.
(tests): Add tst-cpucount.
* posix/sched_cpucount.c: New file.
* posix/tst-cpucount.c: New file.
* posix/Versions: Export __sched_cpucount with version GLIBC_2.6.
Diffstat (limited to 'posix/tst-cpucount.c')
-rw-r--r-- | posix/tst-cpucount.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/posix/tst-cpucount.c b/posix/tst-cpucount.c new file mode 100644 index 0000000000..fe3cded732 --- /dev/null +++ b/posix/tst-cpucount.c @@ -0,0 +1,27 @@ +#include <sched.h> +#include <stdio.h> + +static int +do_test (void) +{ + cpu_set_t c; + + CPU_ZERO (&c); + + for (int cnt = 0; cnt < 130; ++cnt) + { + int n = CPU_COUNT (&c); + if (n != cnt) + { + printf ("expected %d, not %d\n", cnt, n); + return 1; + } + + CPU_SET (cnt, &c); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" |