From cb877fc8f376d253e95898737f1fa60718b9facf Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" Date: Sat, 29 Jan 2011 16:37:14 -0500 Subject: add test that checks that RT class is not inherited across fork --- tests/core_api.c | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/tests/core_api.c b/tests/core_api.c index d858f1f..a4d54f5 100644 --- a/tests/core_api.c +++ b/tests/core_api.c @@ -1,5 +1,8 @@ -#include "tests.h" +#include /* for waitpid() */ +#include +#include +#include "tests.h" #include "litmus.h" @@ -49,3 +52,40 @@ TESTCASE(job_control_non_rt, ALL, SYSCALL_FAILS( EPERM, get_job_no(&job_no) ); } + + +TESTCASE(rt_fork_non_rt, C_EDF | GSN_EDF | PSN_EDF | PFAIR, + "children of RT tasks are not automatically RT tasks") +{ + unsigned int pid, job_no; + int status; + + SYSCALL( sporadic_partitioned(10, 100, 0) ); + SYSCALL( task_mode(LITMUS_RT_TASK) ); + + pid = fork(); + + ASSERT( pid != -1 ); + + if (pid == 0) { + /* child */ + + SYSCALL_FAILS( EINVAL, sleep_next_period() ); + SYSCALL_FAILS( EINVAL, wait_for_job_release(0) ); + SYSCALL_FAILS( EPERM, get_job_no(&job_no) ); + + exit(0); + } else { + /* parent */ + + SYSCALL( sleep_next_period() ); + SYSCALL( wait_for_job_release(20) ); + SYSCALL( get_job_no(&job_no) ); + + SYSCALL( task_mode(BACKGROUND_TASK) ); + + SYSCALL( waitpid(pid, &status, 0) ); + + ASSERT(WEXITSTATUS(status) == 0); + } +} -- cgit v1.2.2