diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2013-03-12 13:13:22 -0400 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2013-03-12 13:42:34 -0400 |
commit | 0e71f86251307a37161cf3de2704a59882e25258 (patch) | |
tree | f6f28c6c1f9ff2edc68b64c164575728aa349bba /tests | |
parent | fccb957780cf9685539b1d0717a5193248b30e48 (diff) |
Change convenience API routines.
The sproadic_*() macros have become unwieldy. This patch
replaces those convenience macros for global, clustered,
and partitioned scheduling. A part of this API change
is the explicit use of nanosecond time-values. Prior APIs
have used lt_t (litmus time), which had an implied time
scale of nanoseconds.
/bin apps and test suite also updated to use revised API.
Modifications to the test suite are mostly centered around
using nanoseconds instead of milliseconds.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core_api.c | 5 | ||||
-rw-r--r-- | tests/fdso.c | 2 | ||||
-rw-r--r-- | tests/locks.c | 4 | ||||
-rw-r--r-- | tests/pcp.c | 32 | ||||
-rw-r--r-- | tests/sched.c | 11 |
5 files changed, 30 insertions, 24 deletions
diff --git a/tests/core_api.c b/tests/core_api.c index b57e278..fc4deb9 100644 --- a/tests/core_api.c +++ b/tests/core_api.c | |||
@@ -18,6 +18,7 @@ TESTCASE(set_rt_task_param_invalid_params, ALL, | |||
18 | "reject invalid rt_task values") | 18 | "reject invalid rt_task values") |
19 | { | 19 | { |
20 | struct rt_task params; | 20 | struct rt_task params; |
21 | init_rt_task_param(¶ms); | ||
21 | params.cpu = 0; | 22 | params.cpu = 0; |
22 | params.period = 100; | 23 | params.period = 100; |
23 | params.relative_deadline = params.period; | 24 | params.relative_deadline = params.period; |
@@ -53,6 +54,7 @@ TESTCASE(reject_bad_priorities, P_FP, | |||
53 | "reject invalid priorities") | 54 | "reject invalid priorities") |
54 | { | 55 | { |
55 | struct rt_task params; | 56 | struct rt_task params; |
57 | init_rt_task_param(¶ms); | ||
56 | params.cpu = 0; | 58 | params.cpu = 0; |
57 | params.exec_cost = 10; | 59 | params.exec_cost = 10; |
58 | params.period = 100; | 60 | params.period = 100; |
@@ -79,6 +81,7 @@ TESTCASE(accept_valid_priorities, P_FP, | |||
79 | "accept lowest and highest valid priorities") | 81 | "accept lowest and highest valid priorities") |
80 | { | 82 | { |
81 | struct rt_task params; | 83 | struct rt_task params; |
84 | init_rt_task_param(¶ms); | ||
82 | params.cpu = 0; | 85 | params.cpu = 0; |
83 | params.exec_cost = 10; | 86 | params.exec_cost = 10; |
84 | params.period = 100; | 87 | params.period = 100; |
@@ -120,7 +123,7 @@ TESTCASE(rt_fork_non_rt, LITMUS, | |||
120 | unsigned int pid, job_no; | 123 | unsigned int pid, job_no; |
121 | int status; | 124 | int status; |
122 | 125 | ||
123 | SYSCALL( sporadic_partitioned(10, 100, 0) ); | 126 | SYSCALL( sporadic_partitioned(ms2ns(10), ms2ns(100), 0) ); |
124 | SYSCALL( task_mode(LITMUS_RT_TASK) ); | 127 | SYSCALL( task_mode(LITMUS_RT_TASK) ); |
125 | 128 | ||
126 | pid = fork(); | 129 | pid = fork(); |
diff --git a/tests/fdso.c b/tests/fdso.c index fda343f..570ea4a 100644 --- a/tests/fdso.c +++ b/tests/fdso.c | |||
@@ -66,7 +66,7 @@ TESTCASE(not_inherit_od, GSN_EDF | PSN_EDF, | |||
66 | ASSERT( pid != -1 ); | 66 | ASSERT( pid != -1 ); |
67 | 67 | ||
68 | /* must be an RT task to lock at all */ | 68 | /* must be an RT task to lock at all */ |
69 | SYSCALL( sporadic_partitioned(10, 100, 0) ); | 69 | SYSCALL( sporadic_partitioned(ms2ns(10), ms2ns(100), 0) ); |
70 | SYSCALL( task_mode(LITMUS_RT_TASK) ); | 70 | SYSCALL( task_mode(LITMUS_RT_TASK) ); |
71 | 71 | ||
72 | if (pid == 0) { | 72 | if (pid == 0) { |
diff --git a/tests/locks.c b/tests/locks.c index 9a928b3..c3eba4e 100644 --- a/tests/locks.c +++ b/tests/locks.c | |||
@@ -53,7 +53,7 @@ TESTCASE(lock_srp, PSN_EDF | P_FP, | |||
53 | 53 | ||
54 | SYSCALL( fd = open(".srp_locks", O_RDONLY | O_CREAT, S_IRUSR) ); | 54 | SYSCALL( fd = open(".srp_locks", O_RDONLY | O_CREAT, S_IRUSR) ); |
55 | 55 | ||
56 | SYSCALL( sporadic_partitioned(10, 100, 0) ); | 56 | SYSCALL( sporadic_partitioned(ms2ns(10), ms2ns(100), 0) ); |
57 | SYSCALL( task_mode(LITMUS_RT_TASK) ); | 57 | SYSCALL( task_mode(LITMUS_RT_TASK) ); |
58 | 58 | ||
59 | SYSCALL( od = open_srp_sem(fd, 0) ); | 59 | SYSCALL( od = open_srp_sem(fd, 0) ); |
@@ -85,7 +85,7 @@ TESTCASE(lock_fmlp, PSN_EDF | GSN_EDF | P_FP, | |||
85 | 85 | ||
86 | SYSCALL( fd = open(".fmlp_locks", O_RDONLY | O_CREAT, S_IRUSR) ); | 86 | SYSCALL( fd = open(".fmlp_locks", O_RDONLY | O_CREAT, S_IRUSR) ); |
87 | 87 | ||
88 | SYSCALL( sporadic_partitioned(10, 100, 0) ); | 88 | SYSCALL( sporadic_partitioned(ms2ns(10), ms2ns(100), 0) ); |
89 | SYSCALL( task_mode(LITMUS_RT_TASK) ); | 89 | SYSCALL( task_mode(LITMUS_RT_TASK) ); |
90 | 90 | ||
91 | SYSCALL( od = open_fmlp_sem(fd, 0) ); | 91 | SYSCALL( od = open_fmlp_sem(fd, 0) ); |
diff --git a/tests/pcp.c b/tests/pcp.c index cff4240..19009a3 100644 --- a/tests/pcp.c +++ b/tests/pcp.c | |||
@@ -15,7 +15,7 @@ TESTCASE(lock_pcp, P_FP, | |||
15 | 15 | ||
16 | SYSCALL( fd = open(".pcp_locks", O_RDONLY | O_CREAT, S_IRUSR) ); | 16 | SYSCALL( fd = open(".pcp_locks", O_RDONLY | O_CREAT, S_IRUSR) ); |
17 | 17 | ||
18 | SYSCALL( sporadic_partitioned(10, 100, cpu) ); | 18 | SYSCALL( sporadic_partitioned(ms2ns(10), ms2ns(100), cpu) ); |
19 | SYSCALL( task_mode(LITMUS_RT_TASK) ); | 19 | SYSCALL( task_mode(LITMUS_RT_TASK) ); |
20 | 20 | ||
21 | SYSCALL( od = open_pcp_sem(fd, 0, cpu) ); | 21 | SYSCALL( od = open_pcp_sem(fd, 0, cpu) ); |
@@ -45,13 +45,14 @@ TESTCASE(pcp_inheritance, P_FP, | |||
45 | int fd, od, cpu = 0; | 45 | int fd, od, cpu = 0; |
46 | 46 | ||
47 | int child_hi, child_lo, child_middle, status, waiters; | 47 | int child_hi, child_lo, child_middle, status, waiters; |
48 | lt_t delay = ms2lt(100); | 48 | lt_t delay = ms2ns(100); |
49 | double start, stop; | 49 | double start, stop; |
50 | 50 | ||
51 | struct rt_task params; | 51 | struct rt_task params; |
52 | init_rt_task_param(¶ms); | ||
52 | params.cpu = 0; | 53 | params.cpu = 0; |
53 | params.exec_cost = ms2lt(10000); | 54 | params.exec_cost = ms2ns(10000); |
54 | params.period = ms2lt(100000); | 55 | params.period = ms2ns(100000); |
55 | params.relative_deadline = params.period; | 56 | params.relative_deadline = params.period; |
56 | params.phase = 0; | 57 | params.phase = 0; |
57 | params.cls = RT_CLASS_HARD; | 58 | params.cls = RT_CLASS_HARD; |
@@ -82,7 +83,7 @@ TESTCASE(pcp_inheritance, P_FP, | |||
82 | 83 | ||
83 | child_middle = FORK_TASK( | 84 | child_middle = FORK_TASK( |
84 | params.priority = LITMUS_HIGHEST_PRIORITY + 1; | 85 | params.priority = LITMUS_HIGHEST_PRIORITY + 1; |
85 | params.phase = ms2lt(100); | 86 | params.phase = ms2ns(100); |
86 | 87 | ||
87 | SYSCALL( set_rt_task_param(gettid(), ¶ms) ); | 88 | SYSCALL( set_rt_task_param(gettid(), ¶ms) ); |
88 | SYSCALL( be_migrate_to_cpu(params.cpu) ); | 89 | SYSCALL( be_migrate_to_cpu(params.cpu) ); |
@@ -99,7 +100,7 @@ TESTCASE(pcp_inheritance, P_FP, | |||
99 | 100 | ||
100 | child_hi = FORK_TASK( | 101 | child_hi = FORK_TASK( |
101 | params.priority = LITMUS_HIGHEST_PRIORITY; | 102 | params.priority = LITMUS_HIGHEST_PRIORITY; |
102 | params.phase = ms2lt(50); | 103 | params.phase = ms2ns(50); |
103 | 104 | ||
104 | SYSCALL( set_rt_task_param(gettid(), ¶ms) ); | 105 | SYSCALL( set_rt_task_param(gettid(), ¶ms) ); |
105 | SYSCALL( be_migrate_to_cpu(params.cpu) ); | 106 | SYSCALL( be_migrate_to_cpu(params.cpu) ); |
@@ -150,13 +151,14 @@ TESTCASE(srp_ceiling_blocking, P_FP | PSN_EDF, | |||
150 | int fd, od; | 151 | int fd, od; |
151 | 152 | ||
152 | int child_hi, child_lo, child_middle, status, waiters; | 153 | int child_hi, child_lo, child_middle, status, waiters; |
153 | lt_t delay = ms2lt(100); | 154 | lt_t delay = ms2ns(100); |
154 | double start, stop; | 155 | double start, stop; |
155 | 156 | ||
156 | struct rt_task params; | 157 | struct rt_task params; |
158 | init_rt_task_param(¶ms); | ||
157 | params.cpu = 0; | 159 | params.cpu = 0; |
158 | params.exec_cost = ms2lt(10000); | 160 | params.exec_cost = ms2ns(10000); |
159 | params.period = ms2lt(100000); | 161 | params.period = ms2ns(100000); |
160 | params.relative_deadline = params.period; | 162 | params.relative_deadline = params.period; |
161 | params.phase = 0; | 163 | params.phase = 0; |
162 | params.cls = RT_CLASS_HARD; | 164 | params.cls = RT_CLASS_HARD; |
@@ -185,8 +187,8 @@ TESTCASE(srp_ceiling_blocking, P_FP | PSN_EDF, | |||
185 | 187 | ||
186 | child_middle = FORK_TASK( | 188 | child_middle = FORK_TASK( |
187 | params.priority = LITMUS_HIGHEST_PRIORITY + 1; | 189 | params.priority = LITMUS_HIGHEST_PRIORITY + 1; |
188 | params.phase = ms2lt(100); | 190 | params.phase = ms2ns(100); |
189 | params.relative_deadline -= ms2lt(110); | 191 | params.relative_deadline -= ms2ns(110); |
190 | 192 | ||
191 | SYSCALL( set_rt_task_param(gettid(), ¶ms) ); | 193 | SYSCALL( set_rt_task_param(gettid(), ¶ms) ); |
192 | SYSCALL( be_migrate_to_cpu(params.cpu) ); | 194 | SYSCALL( be_migrate_to_cpu(params.cpu) ); |
@@ -202,8 +204,8 @@ TESTCASE(srp_ceiling_blocking, P_FP | PSN_EDF, | |||
202 | 204 | ||
203 | child_hi = FORK_TASK( | 205 | child_hi = FORK_TASK( |
204 | params.priority = LITMUS_HIGHEST_PRIORITY; | 206 | params.priority = LITMUS_HIGHEST_PRIORITY; |
205 | params.phase = ms2lt(50); | 207 | params.phase = ms2ns(50); |
206 | params.relative_deadline -= ms2lt(200); | 208 | params.relative_deadline -= ms2ns(200); |
207 | 209 | ||
208 | SYSCALL( set_rt_task_param(gettid(), ¶ms) ); | 210 | SYSCALL( set_rt_task_param(gettid(), ¶ms) ); |
209 | SYSCALL( be_migrate_to_cpu(params.cpu) ); | 211 | SYSCALL( be_migrate_to_cpu(params.cpu) ); |
@@ -252,7 +254,7 @@ TESTCASE(lock_dpcp, P_FP, | |||
252 | 254 | ||
253 | SYSCALL( fd = open(".pcp_locks", O_RDONLY | O_CREAT, S_IRUSR) ); | 255 | SYSCALL( fd = open(".pcp_locks", O_RDONLY | O_CREAT, S_IRUSR) ); |
254 | 256 | ||
255 | SYSCALL( sporadic_partitioned(10, 100, 0) ); | 257 | SYSCALL( sporadic_partitioned(ms2ns(10), ms2ns(100), 0) ); |
256 | SYSCALL( task_mode(LITMUS_RT_TASK) ); | 258 | SYSCALL( task_mode(LITMUS_RT_TASK) ); |
257 | 259 | ||
258 | SYSCALL( od = open_dpcp_sem(fd, 0, cpu) ); | 260 | SYSCALL( od = open_dpcp_sem(fd, 0, cpu) ); |
@@ -305,7 +307,7 @@ TESTCASE(lock_mpcp, P_FP, | |||
305 | 307 | ||
306 | SYSCALL( fd = open(".pcp_locks", O_RDONLY | O_CREAT, S_IRUSR) ); | 308 | SYSCALL( fd = open(".pcp_locks", O_RDONLY | O_CREAT, S_IRUSR) ); |
307 | 309 | ||
308 | SYSCALL( sporadic_partitioned(10, 100, 0) ); | 310 | SYSCALL( sporadic_partitioned(ms2ns(10), ms2ns(100), 0) ); |
309 | SYSCALL( task_mode(LITMUS_RT_TASK) ); | 311 | SYSCALL( task_mode(LITMUS_RT_TASK) ); |
310 | 312 | ||
311 | SYSCALL( od = open_mpcp_sem(fd, 0) ); | 313 | SYSCALL( od = open_mpcp_sem(fd, 0) ); |
diff --git a/tests/sched.c b/tests/sched.c index 713fde2..6726b46 100644 --- a/tests/sched.c +++ b/tests/sched.c | |||
@@ -9,13 +9,14 @@ TESTCASE(preempt_on_resume, P_FP | PSN_EDF, | |||
9 | "preempt lower-priority task when a higher-priority task resumes") | 9 | "preempt lower-priority task when a higher-priority task resumes") |
10 | { | 10 | { |
11 | int child_hi, child_lo, status, waiters; | 11 | int child_hi, child_lo, status, waiters; |
12 | lt_t delay = ms2lt(100); | 12 | lt_t delay = ms2ns(100); |
13 | double start, stop; | 13 | double start, stop; |
14 | 14 | ||
15 | struct rt_task params; | 15 | struct rt_task params; |
16 | init_rt_task_param(¶ms); | ||
16 | params.cpu = 0; | 17 | params.cpu = 0; |
17 | params.exec_cost = ms2lt(10000); | 18 | params.exec_cost = ms2ns(10000); |
18 | params.period = ms2lt(100000); | 19 | params.period = ms2ns(100000); |
19 | params.relative_deadline = params.period; | 20 | params.relative_deadline = params.period; |
20 | params.phase = 0; | 21 | params.phase = 0; |
21 | params.cls = RT_CLASS_HARD; | 22 | params.cls = RT_CLASS_HARD; |
@@ -51,14 +52,14 @@ TESTCASE(preempt_on_resume, P_FP | PSN_EDF, | |||
51 | ; | 52 | ; |
52 | 53 | ||
53 | start = wctime(); | 54 | start = wctime(); |
54 | SYSCALL( lt_sleep(ms2lt(100)) ); | 55 | SYSCALL( lt_sleep(ms2ns(100)) ); |
55 | stop = wctime(); | 56 | stop = wctime(); |
56 | 57 | ||
57 | SYSCALL( kill(child_lo, SIGUSR2) ); | 58 | SYSCALL( kill(child_lo, SIGUSR2) ); |
58 | 59 | ||
59 | if (stop - start >= 0.2) | 60 | if (stop - start >= 0.2) |
60 | fprintf(stderr, "\nHi-prio delay = %fsec\n", | 61 | fprintf(stderr, "\nHi-prio delay = %fsec\n", |
61 | stop - start - (ms2lt(100) / 1E9)); | 62 | stop - start - (ms2ns(100) / (float)s2ns(1))); |
62 | 63 | ||
63 | /* Assert we woke up 'soonish' after the sleep. */ | 64 | /* Assert we woke up 'soonish' after the sleep. */ |
64 | ASSERT( stop - start < 0.2 ); | 65 | ASSERT( stop - start < 0.2 ); |