diff options
| author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2015-12-17 05:57:10 -0500 |
|---|---|---|
| committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2015-12-18 03:42:15 -0500 |
| commit | 69ddb96d06d0890df5f291dde7d829000f062a48 (patch) | |
| tree | 8e53071cee11c78354cb4f58cf769e3fedc62484 | |
| parent | 69ee1ed21a15aeb4794ff4b27e052326bc5b87d0 (diff) | |
Add test case for get_rt_task_param()
| -rw-r--r-- | tests/core_api.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/core_api.c b/tests/core_api.c index 95ca69b..feb60c5 100644 --- a/tests/core_api.c +++ b/tests/core_api.c | |||
| @@ -1,11 +1,13 @@ | |||
| 1 | #include <sys/wait.h> /* for waitpid() */ | 1 | #include <sys/wait.h> /* for waitpid() */ |
| 2 | #include <unistd.h> | 2 | #include <unistd.h> |
| 3 | #include <stdio.h> | 3 | #include <stdio.h> |
| 4 | #include <string.h> | ||
| 4 | #include <stdlib.h> | 5 | #include <stdlib.h> |
| 5 | #include <sched.h> | 6 | #include <sched.h> |
| 6 | 7 | ||
| 7 | #include "tests.h" | 8 | #include "tests.h" |
| 8 | #include "litmus.h" | 9 | #include "litmus.h" |
| 10 | #include "migration.h" | ||
| 9 | 11 | ||
| 10 | 12 | ||
| 11 | TESTCASE(set_rt_task_param_invalid_pointer, ALL, | 13 | TESTCASE(set_rt_task_param_invalid_pointer, ALL, |
| @@ -16,6 +18,33 @@ TESTCASE(set_rt_task_param_invalid_pointer, ALL, | |||
| 16 | SYSCALL_FAILS( EFAULT, set_rt_task_param(gettid(), (void*) 0x123 )); | 18 | SYSCALL_FAILS( EFAULT, set_rt_task_param(gettid(), (void*) 0x123 )); |
| 17 | } | 19 | } |
| 18 | 20 | ||
| 21 | TESTCASE(get_set_rt_task_param, ALL, | ||
| 22 | "read back rt_task values") | ||
| 23 | { | ||
| 24 | struct rt_task params; | ||
| 25 | int cpu = num_online_cpus() - 1; | ||
| 26 | init_rt_task_param(¶ms); | ||
| 27 | params.cpu = cpu; | ||
| 28 | params.exec_cost = 90; | ||
| 29 | params.period = 321; | ||
| 30 | params.relative_deadline = 123; | ||
| 31 | |||
| 32 | /* set params */ | ||
| 33 | SYSCALL( set_rt_task_param(gettid(), ¶ms) ); | ||
| 34 | |||
| 35 | /* now clear our copy */ | ||
| 36 | memset(¶ms, 0, sizeof(params)); | ||
| 37 | |||
| 38 | /* get params */ | ||
| 39 | SYSCALL( get_rt_task_param(gettid(), ¶ms) ); | ||
| 40 | |||
| 41 | ASSERT(params.cpu == cpu); | ||
| 42 | ASSERT(params.exec_cost == 90); | ||
| 43 | ASSERT(params.period == 321); | ||
| 44 | ASSERT(params.relative_deadline == 123); | ||
| 45 | } | ||
| 46 | |||
| 47 | |||
| 19 | TESTCASE(set_rt_task_param_invalid_params, ALL, | 48 | TESTCASE(set_rt_task_param_invalid_params, ALL, |
| 20 | "reject invalid rt_task values") | 49 | "reject invalid rt_task values") |
| 21 | { | 50 | { |
