| 1 |
/* COVERAGE: sched_getparam sched_setparam sched_get_priority_max sched_get_priority_min sched_yield */ |
| 2 |
|
| 3 |
#define _GNU_SOURCE |
| 4 |
#include <sched.h> |
| 5 |
|
| 6 |
int main() { |
| 7 |
struct sched_param sp; |
| 8 |
|
| 9 |
// test normal operation ------------------------------------ |
| 10 |
|
| 11 |
sched_getparam(0, &sp); |
| 12 |
//staptest// sched_getparam (0, XXXX) = 0 |
| 13 |
|
| 14 |
sched_setparam(0, &sp); |
| 15 |
//staptest// sched_setparam (0, XXXX) = 0 |
| 16 |
|
| 17 |
sched_get_priority_max(SCHED_OTHER); |
| 18 |
//staptest// sched_get_priority_max (SCHED_OTHER) = 0 |
| 19 |
|
| 20 |
sched_get_priority_max(SCHED_BATCH); |
| 21 |
//staptest// sched_get_priority_max (SCHED_BATCH) = 0 |
| 22 |
|
| 23 |
#ifdef SCHED_IDLE |
| 24 |
sched_get_priority_max(SCHED_IDLE); |
| 25 |
//staptest// sched_get_priority_max (SCHED_IDLE) = 0 |
| 26 |
#endif |
| 27 |
|
| 28 |
sched_get_priority_max(SCHED_FIFO); |
| 29 |
//staptest// sched_get_priority_max (SCHED_FIFO) = NNNN |
| 30 |
|
| 31 |
sched_get_priority_max(SCHED_RR); |
| 32 |
//staptest// sched_get_priority_max (SCHED_RR) = NNNN |
| 33 |
|
| 34 |
sched_get_priority_min(SCHED_OTHER); |
| 35 |
//staptest// sched_get_priority_min (SCHED_OTHER) = 0 |
| 36 |
|
| 37 |
sched_yield(); |
| 38 |
//staptest// sched_yield () = 0 |
| 39 |
|
| 40 |
// test nasty operation ------------------------------------- |
| 41 |
|
| 42 |
sched_getparam(-1, &sp); |
| 43 |
//staptest// sched_getparam (-1, XXXX) = NNNN |
| 44 |
|
| 45 |
sched_getparam(0, (struct sched_param *)-1); |
| 46 |
#ifdef __s390__ |
| 47 |
//staptest// sched_getparam (0, 0x[7]?[f]+) = NNNN |
| 48 |
#else |
| 49 |
//staptest// sched_getparam (0, 0x[f]+) = NNNN |
| 50 |
#endif |
| 51 |
|
| 52 |
sched_setparam(-1, &sp); |
| 53 |
//staptest// sched_setparam (-1, XXXX) = NNNN |
| 54 |
|
| 55 |
sched_setparam(0, (struct sched_param *)-1); |
| 56 |
#ifdef __s390__ |
| 57 |
//staptest// sched_setparam (0, 0x[7]?[f]+) = NNNN |
| 58 |
#else |
| 59 |
//staptest// sched_setparam (0, 0x[f]+) = NNNN |
| 60 |
#endif |
| 61 |
|
| 62 |
sched_get_priority_max(-1); |
| 63 |
//staptest// sched_get_priority_max (0xffffffff) = NNNN |
| 64 |
|
| 65 |
sched_get_priority_min(-1); |
| 66 |
//staptest// sched_get_priority_min (0xffffffff) = NNNN |
| 67 |
|
| 68 |
return 0; |
| 69 |
} |