aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2011-01-29 16:37:14 -0500
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2011-02-01 16:06:22 -0500
commitcb877fc8f376d253e95898737f1fa60718b9facf (patch)
treee1a34f49f27ac5d76ccfa3ab0f6be5f54f67066a
parent455f8e4ef3fd02d41e2d8ae40918dd22bf7e4f45 (diff)
add test that checks that RT class is not inherited across fork
-rw-r--r--tests/core_api.c42
1 files changed, 41 insertions, 1 deletions
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 @@
1#include "tests.h" 1#include <sys/wait.h> /* for waitpid() */
2#include <unistd.h>
3#include <stdio.h>
2 4
5#include "tests.h"
3#include "litmus.h" 6#include "litmus.h"
4 7
5 8
@@ -49,3 +52,40 @@ TESTCASE(job_control_non_rt, ALL,
49 52
50 SYSCALL_FAILS( EPERM, get_job_no(&job_no) ); 53 SYSCALL_FAILS( EPERM, get_job_no(&job_no) );
51} 54}
55
56
57TESTCASE(rt_fork_non_rt, C_EDF | GSN_EDF | PSN_EDF | PFAIR,
58 "children of RT tasks are not automatically RT tasks")
59{
60 unsigned int pid, job_no;
61 int status;
62
63 SYSCALL( sporadic_partitioned(10, 100, 0) );
64 SYSCALL( task_mode(LITMUS_RT_TASK) );
65
66 pid = fork();
67
68 ASSERT( pid != -1 );
69
70 if (pid == 0) {
71 /* child */
72
73 SYSCALL_FAILS( EINVAL, sleep_next_period() );
74 SYSCALL_FAILS( EINVAL, wait_for_job_release(0) );
75 SYSCALL_FAILS( EPERM, get_job_no(&job_no) );
76
77 exit(0);
78 } else {
79 /* parent */
80
81 SYSCALL( sleep_next_period() );
82 SYSCALL( wait_for_job_release(20) );
83 SYSCALL( get_job_no(&job_no) );
84
85 SYSCALL( task_mode(BACKGROUND_TASK) );
86
87 SYSCALL( waitpid(pid, &status, 0) );
88
89 ASSERT(WEXITSTATUS(status) == 0);
90 }
91}