aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2015-07-27 11:51:11 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2015-07-27 11:51:11 -0400
commit7a8779feaa95b05fa2492a4b5a096afb6b5dc0a6 (patch)
tree640a31c22bbac1fdbb062025a583ad24656980f3 /tests
parenta483e1f85dd78be6f9d6b8cdb024859983ec1f55 (diff)
Tests: stress PCP, DPCP, DFLP, and SRP by intentionally migrating away
Triggers a BUG_ON() in the old kernel.
Diffstat (limited to 'tests')
-rw-r--r--tests/locks.c57
-rw-r--r--tests/pcp.c86
2 files changed, 50 insertions, 93 deletions
diff --git a/tests/locks.c b/tests/locks.c
index be72b7c..4b9ac72 100644
--- a/tests/locks.c
+++ b/tests/locks.c
@@ -163,8 +163,6 @@ TESTCASE(srp_lock_mode_change, P_FP | PSN_EDF,
163{ 163{
164 int fd, od; 164 int fd, od;
165 165
166 int child, status;
167
168 struct rt_task params; 166 struct rt_task params;
169 init_rt_task_param(&params); 167 init_rt_task_param(&params);
170 params.cpu = 0; 168 params.cpu = 0;
@@ -174,29 +172,22 @@ TESTCASE(srp_lock_mode_change, P_FP | PSN_EDF,
174 172
175 SYSCALL( fd = open(".locks", O_RDONLY | O_CREAT, S_IRUSR) ); 173 SYSCALL( fd = open(".locks", O_RDONLY | O_CREAT, S_IRUSR) );
176 174
175 params.priority = LITMUS_LOWEST_PRIORITY;
176 SYSCALL( set_rt_task_param(gettid(), &params) );
177 SYSCALL( be_migrate_to_cpu(params.cpu) );
178 SYSCALL( task_mode(LITMUS_RT_TASK) );
177 179
178 child = FORK_TASK( 180 SYSCALL( od = open_srp_sem(fd, 0) );
179 params.priority = LITMUS_LOWEST_PRIORITY;
180 SYSCALL( set_rt_task_param(gettid(), &params) );
181 SYSCALL( be_migrate_to_cpu(params.cpu) );
182 SYSCALL( task_mode(LITMUS_RT_TASK) );
183
184 SYSCALL( od = open_srp_sem(fd, 0) );
185
186 SYSCALL( litmus_lock(od) );
187 181
188 SYSCALL( task_mode(BACKGROUND_TASK) ); 182 SYSCALL( litmus_lock(od) );
189 183
190 SYSCALL( litmus_unlock(od) ); 184 SYSCALL( task_mode(BACKGROUND_TASK) );
191 185
192 SYSCALL( od_close(od) ); 186 be_migrate_to_cpu(1);
193 187
194 exit(0); 188 SYSCALL( litmus_unlock(od) );
195 );
196 189
197 SYSCALL( waitpid(child, &status, 0) ); 190 SYSCALL( od_close(od) );
198 ASSERT( WIFEXITED(status) );
199 ASSERT( WEXITSTATUS(status) == 0 );
200 191
201 SYSCALL( close(fd) ); 192 SYSCALL( close(fd) );
202 193
@@ -208,8 +199,6 @@ TESTCASE(dflp_lock_mode_change, P_FP,
208{ 199{
209 int fd, od, cpu = 0; 200 int fd, od, cpu = 0;
210 201
211 int child, status;
212
213 struct rt_task params; 202 struct rt_task params;
214 init_rt_task_param(&params); 203 init_rt_task_param(&params);
215 params.cpu = 1; 204 params.cpu = 1;
@@ -219,28 +208,22 @@ TESTCASE(dflp_lock_mode_change, P_FP,
219 208
220 SYSCALL( fd = open(".locks", O_RDONLY | O_CREAT, S_IRUSR) ); 209 SYSCALL( fd = open(".locks", O_RDONLY | O_CREAT, S_IRUSR) );
221 210
222 child = FORK_TASK( 211 params.priority = LITMUS_LOWEST_PRIORITY;
223 params.priority = LITMUS_LOWEST_PRIORITY; 212 SYSCALL( set_rt_task_param(gettid(), &params) );
224 SYSCALL( set_rt_task_param(gettid(), &params) ); 213 SYSCALL( be_migrate_to_cpu(params.cpu) );
225 SYSCALL( be_migrate_to_cpu(params.cpu) ); 214 SYSCALL( task_mode(LITMUS_RT_TASK) );
226 SYSCALL( task_mode(LITMUS_RT_TASK) );
227
228 SYSCALL( od = open_dflp_sem(fd, 0, cpu) );
229 215
230 SYSCALL( litmus_lock(od) ); 216 SYSCALL( od = open_dflp_sem(fd, 0, cpu) );
231 217
232 SYSCALL( task_mode(BACKGROUND_TASK) ); 218 SYSCALL( litmus_lock(od) );
233 219
234 SYSCALL( litmus_unlock(od) ); 220 SYSCALL( task_mode(BACKGROUND_TASK) );
235 221
236 SYSCALL( od_close(od) ); 222 be_migrate_to_cpu(2);
237 223
238 exit(0); 224 SYSCALL( litmus_unlock(od) );
239 );
240 225
241 SYSCALL( waitpid(child, &status, 0) ); 226 SYSCALL( od_close(od) );
242 ASSERT( WIFEXITED(status) );
243 ASSERT( WEXITSTATUS(status) == 0 );
244 227
245 SYSCALL( close(fd) ); 228 SYSCALL( close(fd) );
246 229
diff --git a/tests/pcp.c b/tests/pcp.c
index 9c9b6f2..dda8dcf 100644
--- a/tests/pcp.c
+++ b/tests/pcp.c
@@ -468,8 +468,6 @@ TESTCASE(pcp_lock_mode_change, P_FP,
468{ 468{
469 int fd, od, cpu = 0; 469 int fd, od, cpu = 0;
470 470
471 int child, status;
472
473 struct rt_task params; 471 struct rt_task params;
474 init_rt_task_param(&params); 472 init_rt_task_param(&params);
475 params.cpu = 0; 473 params.cpu = 0;
@@ -479,29 +477,22 @@ TESTCASE(pcp_lock_mode_change, P_FP,
479 477
480 SYSCALL( fd = open(".pcp_locks", O_RDONLY | O_CREAT, S_IRUSR) ); 478 SYSCALL( fd = open(".pcp_locks", O_RDONLY | O_CREAT, S_IRUSR) );
481 479
480 params.priority = LITMUS_LOWEST_PRIORITY;
481 SYSCALL( set_rt_task_param(gettid(), &params) );
482 SYSCALL( be_migrate_to_cpu(params.cpu) );
483 SYSCALL( task_mode(LITMUS_RT_TASK) );
482 484
483 child = FORK_TASK( 485 SYSCALL( od = open_pcp_sem(fd, 0, cpu) );
484 params.priority = LITMUS_LOWEST_PRIORITY;
485 SYSCALL( set_rt_task_param(gettid(), &params) );
486 SYSCALL( be_migrate_to_cpu(params.cpu) );
487 SYSCALL( task_mode(LITMUS_RT_TASK) );
488
489 SYSCALL( od = open_pcp_sem(fd, 0, cpu) );
490
491 SYSCALL( litmus_lock(od) );
492 486
493 SYSCALL( task_mode(BACKGROUND_TASK) ); 487 SYSCALL( litmus_lock(od) );
494 488
495 SYSCALL( litmus_unlock(od) ); 489 SYSCALL( task_mode(BACKGROUND_TASK) );
496 490
497 SYSCALL( od_close(od) ); 491 be_migrate_to_cpu(1);
498 492
499 exit(0); 493 SYSCALL( litmus_unlock(od) );
500 );
501 494
502 SYSCALL( waitpid(child, &status, 0) ); 495 SYSCALL( od_close(od) );
503 ASSERT( WIFEXITED(status) );
504 ASSERT( WEXITSTATUS(status) == 0 );
505 496
506 SYSCALL( close(fd) ); 497 SYSCALL( close(fd) );
507 498
@@ -513,8 +504,6 @@ TESTCASE(mpcp_lock_mode_change, P_FP,
513{ 504{
514 int fd, od; 505 int fd, od;
515 506
516 int child, status;
517
518 struct rt_task params; 507 struct rt_task params;
519 init_rt_task_param(&params); 508 init_rt_task_param(&params);
520 params.cpu = 0; 509 params.cpu = 0;
@@ -524,29 +513,22 @@ TESTCASE(mpcp_lock_mode_change, P_FP,
524 513
525 SYSCALL( fd = open(".pcp_locks", O_RDONLY | O_CREAT, S_IRUSR) ); 514 SYSCALL( fd = open(".pcp_locks", O_RDONLY | O_CREAT, S_IRUSR) );
526 515
516 params.priority = LITMUS_LOWEST_PRIORITY;
517 SYSCALL( set_rt_task_param(gettid(), &params) );
518 SYSCALL( be_migrate_to_cpu(params.cpu) );
519 SYSCALL( task_mode(LITMUS_RT_TASK) );
527 520
528 child = FORK_TASK( 521 SYSCALL( od = open_mpcp_sem(fd, 0) );
529 params.priority = LITMUS_LOWEST_PRIORITY;
530 SYSCALL( set_rt_task_param(gettid(), &params) );
531 SYSCALL( be_migrate_to_cpu(params.cpu) );
532 SYSCALL( task_mode(LITMUS_RT_TASK) );
533
534 SYSCALL( od = open_mpcp_sem(fd, 0) );
535
536 SYSCALL( litmus_lock(od) );
537 522
538 SYSCALL( task_mode(BACKGROUND_TASK) ); 523 SYSCALL( litmus_lock(od) );
539 524
540 SYSCALL( litmus_unlock(od) ); 525 SYSCALL( task_mode(BACKGROUND_TASK) );
541 526
542 SYSCALL( od_close(od) ); 527 be_migrate_to_cpu(1);
543 528
544 exit(0); 529 SYSCALL( litmus_unlock(od) );
545 );
546 530
547 SYSCALL( waitpid(child, &status, 0) ); 531 SYSCALL( od_close(od) );
548 ASSERT( WIFEXITED(status) );
549 ASSERT( WEXITSTATUS(status) == 0 );
550 532
551 SYSCALL( close(fd) ); 533 SYSCALL( close(fd) );
552 534
@@ -558,8 +540,6 @@ TESTCASE(dpcp_lock_mode_change, P_FP,
558{ 540{
559 int fd, od, cpu = 0; 541 int fd, od, cpu = 0;
560 542
561 int child, status;
562
563 struct rt_task params; 543 struct rt_task params;
564 init_rt_task_param(&params); 544 init_rt_task_param(&params);
565 params.cpu = 1; 545 params.cpu = 1;
@@ -570,28 +550,22 @@ TESTCASE(dpcp_lock_mode_change, P_FP,
570 SYSCALL( fd = open(".pcp_locks", O_RDONLY | O_CREAT, S_IRUSR) ); 550 SYSCALL( fd = open(".pcp_locks", O_RDONLY | O_CREAT, S_IRUSR) );
571 551
572 552
573 child = FORK_TASK( 553 params.priority = LITMUS_LOWEST_PRIORITY;
574 params.priority = LITMUS_LOWEST_PRIORITY; 554 SYSCALL( set_rt_task_param(gettid(), &params) );
575 SYSCALL( set_rt_task_param(gettid(), &params) ); 555 SYSCALL( be_migrate_to_cpu(params.cpu) );
576 SYSCALL( be_migrate_to_cpu(params.cpu) ); 556 SYSCALL( task_mode(LITMUS_RT_TASK) );
577 SYSCALL( task_mode(LITMUS_RT_TASK) );
578
579 SYSCALL( od = open_dpcp_sem(fd, 0, cpu) );
580 557
581 SYSCALL( litmus_lock(od) ); 558 SYSCALL( od = open_dpcp_sem(fd, 0, cpu) );
582 559
583 SYSCALL( task_mode(BACKGROUND_TASK) ); 560 SYSCALL( litmus_lock(od) );
584 561
585 SYSCALL( litmus_unlock(od) ); 562 SYSCALL( task_mode(BACKGROUND_TASK) );
586 563
587 SYSCALL( od_close(od) ); 564 be_migrate_to_cpu(2);
588 565
589 exit(0); 566 SYSCALL( litmus_unlock(od) );
590 );
591 567
592 SYSCALL( waitpid(child, &status, 0) ); 568 SYSCALL( od_close(od) );
593 ASSERT( WIFEXITED(status) );
594 ASSERT( WEXITSTATUS(status) == 0 );
595 569
596 SYSCALL( close(fd) ); 570 SYSCALL( close(fd) );
597 571