Changeset e83be28 in rtems
- Timestamp:
- 01/09/14 23:57:08 (8 years ago)
- Branches:
- 4.11, 5, master
- Children:
- 5b85cca
- Parents:
- e327e69
- Location:
- testsuites/libtests/rtems++
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
testsuites/libtests/rtems++/Task1.cc
re327e69 re83be28 49 49 { 50 50 rtems_test_pause_and_screen_number(1); 51 52 printf(" * START Task Class test *\n");53 51 52 printf(" START Task Class test\n"); 53 54 54 printf("%s - test argument - ", name_string()); 55 55 if (argument != 0xDEADDEAD) … … 57 57 else 58 58 printf("argument matched\n"); 59 59 60 60 screen1(); 61 61 rtems_test_pause_and_screen_number(2); … … 63 63 screen2(); 64 64 rtems_test_pause_and_screen_number(3); 65 65 66 66 screen3(); 67 67 rtems_test_pause_and_screen_number(4); 68 68 69 69 screen4(); 70 70 rtems_test_pause_and_screen_number(5); 71 71 72 72 screen5(); 73 73 rtems_test_pause_and_screen_number(6); 74 74 75 75 screen6(); 76 76 … … 78 78 // the static destructor call delete the task which is calling exit 79 79 // so exit never completes 80 80 81 81 EndTask end_task("ENDT", (rtems_task_priority) 1, RTEMS_MINIMUM_STACK_SIZE * 6); 82 82 end_task.start(0); … … 84 84 rtemsEvent block_me; 85 85 rtems_event_set out; 86 86 87 87 block_me.receive(RTEMS_SIGNAL_0, out); 88 88 … … 97 97 98 98 local_task_2 = *this; 99 99 100 100 // check the copy constructor works 101 101 printf("%s - copy constructor - ", name_string()); … … 122 122 else 123 123 printf("local and this name's do not match\n"); 124 124 125 125 // check that the owner of the id cannot delete this task 126 126 printf("%s - not owner destroy's task - ", local_task_1.name_string()); 127 127 local_task_1.destroy(); 128 128 printf("%s\n", local_task_1.last_status_string()); 129 129 130 130 // connect to a valid task 131 131 printf("%s - connect to a local valid task name - ", local_task_2.name_string()); 132 132 local_task_2.connect("TA1 ", RTEMS_SEARCH_ALL_NODES); 133 133 printf("%s\n", local_task_2.last_status_string()); 134 134 135 135 // connect to an invalid task 136 136 printf("%s - connect to an invalid task name - ", local_task_2.name_string()); 137 137 local_task_2.connect("BADT", RTEMS_SEARCH_ALL_NODES); 138 138 printf("%s\n", local_task_2.last_status_string()); 139 139 140 140 // connect to a task an invalid node 141 141 printf("%s - connect to a task on an invalid node - ", local_task_2.name_string()); 142 142 local_task_2.connect("BADT", 10); 143 143 printf("%s\n", local_task_2.last_status_string()); 144 144 145 145 // restart this task 146 146 printf("%s - restart from a non-owner - ", name_string()); … … 152 152 { 153 153 // wake after using this object 154 154 155 155 printf("%s - wake after 0 secs - ", name_string()); 156 156 wake_after(0); 157 157 printf("%s\n", last_status_string()); 158 158 159 159 printf("%s - wake after 500 msecs - ", name_string()); 160 160 wake_after(500000); 161 161 printf("%s\n", last_status_string()); 162 162 163 163 printf("%s - wake after 5 secs - ", name_string()); 164 164 wake_after(5000000); … … 168 168 169 169 rtemsTask task_1 = *this; 170 170 171 171 // wake after using a connected object 172 172 173 173 printf("%s - connected object wake after 0 secs - ", task_1.name_string()); 174 174 task_1.wake_after(0); 175 175 printf("%s\n", task_1.last_status_string()); 176 176 177 177 printf("%s - connected object wake after 500 msecs - ", task_1.name_string()); 178 178 task_1.wake_after(500000); 179 179 printf("%s\n", task_1.last_status_string()); 180 180 181 181 printf("%s - connected object wake after 5 secs - ", task_1.name_string()); 182 182 task_1.wake_after(5000000); … … 186 186 187 187 rtemsTask task_2; 188 188 189 189 // wake after using a self object 190 190 191 191 printf("%s - self object wake after 0 secs - ", task_2.name_string()); 192 192 task_2.wake_after(0); 193 193 printf("%s\n", task_2.last_status_string()); 194 194 195 195 printf("%s - self object wake after 500 msecs - ", task_2.name_string()); 196 196 task_2.wake_after(500000); 197 197 printf("%s\n", task_2.last_status_string()); 198 198 199 199 printf("%s - self object wake after 5 secs - ", task_2.name_string()); 200 200 task_2.wake_after(5000000); … … 207 207 208 208 // priorities with this object 209 209 210 210 printf("%s - get priority - ", name_string()); 211 211 get_priority(current_priority); … … 225 225 226 226 // priorities with connected object 227 227 228 228 printf("%s - connected object get priority - ", task_1.name_string()); 229 229 task_1.get_priority(current_priority); … … 240 240 printf("%s - connected object set priority to original - ", task_1.name_string()); 241 241 task_1.set_priority(current_priority, priority); 242 printf("%s, priority was %" PRIirtems_task_priority "\n", task_1.last_status_string(), priority); 242 printf("%s, priority was %" PRIirtems_task_priority "\n", task_1.last_status_string(), priority); 243 243 244 244 // priorities with self object 245 245 246 246 printf("%s - self object get priority - ", task_2.name_string()); 247 247 task_2.get_priority(current_priority); … … 262 262 uint32_t current_note; 263 263 uint32_t note; 264 264 265 265 // notepad registers for this object 266 266 … … 329 329 printf("%s\n", task_2.last_status_string()); 330 330 331 printf(" * END Task Class test *\n");331 printf(" END Task Class test\n"); 332 332 } 333 333 … … 339 339 void Task1::screen3(void) 340 340 { 341 printf(" * START TaskMode Class test *\n");341 printf(" START TaskMode Class test\n"); 342 342 343 343 rtemsTask self; … … 353 353 354 354 // PREEMPTION mode control 355 355 356 356 printf("%s - get preemption state - ", self.name_string()); 357 357 task_mode.get_preemption_state(mode); … … 359 359 print_mode(mode, RTEMS_PREEMPT_MASK); 360 360 printf("\n"); 361 361 362 362 printf("%s - set preemption state to RTEMS_PREEMPT - ", self.name_string()); 363 363 task_mode.set_preemption_state(RTEMS_PREEMPT); … … 366 366 print_mode(mode, RTEMS_ALL_MODES); 367 367 printf("\n"); 368 368 369 369 printf("%s - set preemption state to RTEMS_NO_PREEMPT - ", self.name_string()); 370 370 task_mode.set_preemption_state(RTEMS_NO_PREEMPT); … … 375 375 376 376 // TIMESLICE mode control 377 377 378 378 printf("%s - get timeslice state - ", self.name_string()); 379 379 task_mode.get_timeslice_state(mode); … … 381 381 print_mode(mode, RTEMS_TIMESLICE_MASK); 382 382 printf("\n"); 383 383 384 384 printf("%s - set timeslice state to RTEMS_TIMESLICE - ", self.name_string()); 385 385 task_mode.set_timeslice_state(RTEMS_TIMESLICE); … … 388 388 print_mode(mode, RTEMS_ALL_MODES); 389 389 printf("\n"); 390 390 391 391 printf("%s - set timeslice state to RTEMS_NO_TIMESLICE - ", self.name_string()); 392 392 task_mode.set_timeslice_state(RTEMS_NO_TIMESLICE); … … 397 397 398 398 // ASR mode control 399 399 400 400 printf("%s - get asr state - ", self.name_string()); 401 401 task_mode.get_asr_state(mode); … … 403 403 print_mode(mode, RTEMS_ASR_MASK); 404 404 printf("\n"); 405 405 406 406 printf("%s - set asr state to RTEMS_ASR - ", self.name_string()); 407 407 task_mode.set_asr_state(RTEMS_ASR); … … 410 410 print_mode(mode, RTEMS_ALL_MODES); 411 411 printf("\n"); 412 412 413 413 printf("%s - set asr state to RTEMS_NO_ASR - ", self.name_string()); 414 414 task_mode.set_asr_state(RTEMS_NO_ASR); … … 419 419 420 420 // interrupt level control 421 421 422 422 rtems_interrupt_level current_level; 423 423 rtems_interrupt_level level; … … 430 430 task_mode.set_interrupt_level(102); 431 431 printf("%s\n", task_mode.last_status_string()); 432 432 433 433 printf("%s - set interrupt level to original level - ", self.name_string()); 434 434 task_mode.set_interrupt_level(current_level, level); … … 443 443 print_mode(mode, RTEMS_ALL_MODES); 444 444 printf("\n"); 445 446 printf(" * END TaskMode Class test *\n");445 446 printf(" END TaskMode Class test\n"); 447 447 } 448 448 449 449 void Task1::screen4(void) 450 450 { 451 printf(" * START Event Class test *\n");451 printf(" START Event Class test\n"); 452 452 453 453 printf("%s - create task 2 - ", name_string()); … … 458 458 task_2.start(0); 459 459 printf("%s\n", task_2.last_status_string()); 460 460 461 461 printf("%s - construct event connecting to task 2 - ", name_string()); 462 462 rtemsEvent event_2("TA2 "); … … 469 469 event_2.send(task_2.id_is(), RTEMS_SIGNAL_0); 470 470 printf("%s\n", event_2.last_status_string()); 471 471 472 472 wake_after(1000000); 473 473 … … 475 475 event_2.send(task_2, RTEMS_SIGNAL_0); 476 476 printf("%s\n", event_2.last_status_string()); 477 477 478 478 wake_after(1000000); 479 479 … … 481 481 event_2.send(RTEMS_SIGNAL_31); 482 482 printf("%s\n", event_2.last_status_string()); 483 483 484 484 wake_after(1000000); 485 485 … … 487 487 488 488 event_2_2.connect("TA2"); 489 489 490 490 printf("%s - send event signal 0 and 31 - ", name_string()); 491 491 event_2_2.send(task_2, RTEMS_SIGNAL_0 | RTEMS_SIGNAL_31); 492 492 printf("%s\n", event_2_2.last_status_string()); 493 493 494 494 printf("%s - waiting 5 secs for TA2 to finish\n", name_string()); 495 495 wake_after(500000); 496 497 printf(" * END Event Class test *\n");496 497 printf(" END Event Class test\n"); 498 498 } 499 499 500 500 void Task1::screen5(void) 501 501 { 502 printf(" * START Interrupt Class test *\n");502 printf(" START Interrupt Class test\n"); 503 503 504 504 printf(" do not know a portable BSP type interrupt test\n"); 505 505 506 printf(" * END Interrupt Class test *\n");506 printf(" END Interrupt Class test\n"); 507 507 } 508 508 509 509 void Task1::screen6(void) 510 510 { 511 printf(" * START MessageQueue Class test *\n");511 printf(" START MessageQueue Class test\n"); 512 512 513 513 printf("%s - construct message queue 1 with no memory error - ", name_string()); … … 524 524 size_t size; 525 525 uint32_t count; 526 526 527 527 printf("%s - send u1 to mq_2 - ", name_string()); 528 528 mq_2.send(u1, strlen(u1) + 1); 529 529 printf("%s\n", mq_2.last_status_string()); 530 530 531 531 printf("%s - urgent send u2 to mq_2 - ", name_string()); 532 532 mq_2.urgent(u2, strlen(u2) + 1); 533 533 printf("%s\n", mq_2.last_status_string()); 534 534 535 535 printf("%s - create task 3_1 - ", name_string()); 536 536 Task3 task_3_1("TA31", 9, RTEMS_MINIMUM_STACK_SIZE * 6); … … 540 540 task_3_1.start(0); 541 541 printf("%s\n", task_3_1.last_status_string()); 542 542 543 543 printf("%s - create task 3_2 - ", name_string()); 544 544 Task3 task_3_2("TA32", 9, RTEMS_MINIMUM_STACK_SIZE * 6); … … 548 548 task_3_2.start(0); 549 549 printf("%s\n", task_3_1.last_status_string()); 550 550 551 551 wake_after(1000000); 552 552 553 553 printf("%s - receive u2 on mq_2 ...\n", name_string()); fflush(stdout); 554 554 mq_2.receive(in, size, 5000000); … … 592 592 593 593 wake_after(3000000); 594 594 595 595 const char *b1 = "broadcast message"; 596 596 597 597 printf("%s - broadcast send b1 ...\n", name_string()); 598 598 mq_2.broadcast(b1, strlen(b1) + 1, count); … … 601 601 602 602 wake_after(1000000); 603 603 604 604 printf("%s - receive message b1 on mq_2 from %s...\n", 605 605 name_string(), task_3_1.name_string()); fflush(stdout); … … 646 646 // wait for task 3_1, and 3_2 to complete their timeout tests, will 647 647 // start these after getting the broadcast message 648 wake_after(7000000); 648 wake_after(7000000); 649 649 650 650 const char *f1 = "flush message"; 651 651 652 652 printf("%s - send f1 to mq_2 - ", name_string()); 653 653 mq_2.send(f1, strlen(f1) + 1); 654 654 printf("%s\n", mq_2.last_status_string()); 655 655 656 656 printf("%s - send f1 to mq_2 - ", name_string()); 657 657 mq_2.send(f1, strlen(f1) + 1); 658 658 printf("%s\n", mq_2.last_status_string()); 659 659 660 660 printf("%s - send f1 to mq_2 - ", name_string()); 661 661 mq_2.send(f1, strlen(f1) + 1); … … 665 665 mq_2.flush(count); 666 666 printf("%s, flushed=%" PRIi32 "\n", mq_2.last_status_string(), count); 667 668 printf(" * END MessageQueue Class test *\n");667 668 printf(" END MessageQueue Class test\n"); 669 669 } 670 670 … … 692 692 { 693 693 } 694 694 695 695 void EndTask::body(rtems_task_argument) 696 696 { -
testsuites/libtests/rtems++/rtems++.scn
re327e69 re83be28 1 2 1 3 *** RTEMS++ TEST *** 2 4 INIT - Task.create() - RTEMS[19] invalid thread priority … … 5 7 INIT - Task.restart() - RTEMS[14] thread is in wrong state 6 8 INIT - Task.start(0xDEADDEAD) - RTEMS[00] successful completion 9 INIT - Destroy it's self 7 10 <pause - screen 1> 8 * START Task Class test *11 START Task Class test 9 12 TA1 - test argument - argument matched 10 13 TA1 - copy constructor - local and this id's match … … 15 18 TA1 - connect to a local valid task name - RTEMS[00] successful completion 16 19 TA1 - connect to an invalid task name - RTEMS[03] invalid object name 17 SELF - connect to a task on an invalid node - RTEMS[ 21] invalid node id20 SELF - connect to a task on an invalid node - RTEMS[03] invalid object name 18 21 TA1 - restart from a non-owner - RTEMS[23] not owner of resource 19 22 <pause - screen 2> … … 57 60 SELF - self object get note - RTEMS[00] successful completion, notepad is 0xDEADBEEF 58 61 SELF - self object set note to original value - RTEMS[00] successful completion 59 * END Task Class test *62 END Task Class test 60 63 <pause - screen 3> 61 * START TaskMode Class test *64 START TaskMode Class test 62 65 SELF - get mode - RTEMS[00] successful completion, 63 mode is 0x00000 100, RTEMS_NO_PREEMPT RTEMS_NO_TIMESLICE RTEMS_NO_ASR INTMASK=066 mode is 0x00000500, RTEMS_NO_PREEMPT RTEMS_NO_TIMESLICE RTEMS_ASR INTMASK=0 64 67 SELF - get preemption state - RTEMS[00] successful completion, 65 mode is 0x00000100, RTEMS_NO_PREEMPT 68 mode is 0x00000100, RTEMS_NO_PREEMPT 66 69 SELF - set preemption state to RTEMS_PREEMPT - RTEMS[00] successful completion, 67 mode is 0x00000 000, RTEMS_PREEMPT RTEMS_TIMESLICE RTEMS_NO_ASR INTMASK=070 mode is 0x00000400, RTEMS_PREEMPT RTEMS_TIMESLICE RTEMS_ASR INTMASK=0 68 71 SELF - set preemption state to RTEMS_NO_PREEMPT - RTEMS[00] successful completion, 69 mode is 0x00000 100, RTEMS_NO_PREEMPT RTEMS_NO_TIMESLICE RTEMS_NO_ASR INTMASK=072 mode is 0x00000500, RTEMS_NO_PREEMPT RTEMS_NO_TIMESLICE RTEMS_ASR INTMASK=0 70 73 SELF - get timeslice state - RTEMS[00] successful completion, 71 mode is 0x00000000, RTEMS_TIMESLICE 74 mode is 0x00000000, RTEMS_TIMESLICE 72 75 SELF - set timeslice state to RTEMS_TIMESLICE - RTEMS[00] successful completion, 73 mode is 0x00000 300, RTEMS_NO_PREEMPT RTEMS_NO_TIMESLICE RTEMS_NO_ASR INTMASK=076 mode is 0x00000700, RTEMS_NO_PREEMPT RTEMS_NO_TIMESLICE RTEMS_ASR INTMASK=0 74 77 SELF - set timeslice state to RTEMS_NO_TIMESLICE - RTEMS[00] successful completion, 75 mode is 0x00000 100, RTEMS_NO_PREEMPT RTEMS_NO_TIMESLICE RTEMS_NO_ASR INTMASK=078 mode is 0x00000500, RTEMS_NO_PREEMPT RTEMS_NO_TIMESLICE RTEMS_ASR INTMASK=0 76 79 SELF - get asr state - RTEMS[00] successful completion, 77 mode is 0x00000 000, RTEMS_NO_ASR80 mode is 0x00000400, RTEMS_ASR 78 81 SELF - set asr state to RTEMS_ASR - RTEMS[00] successful completion, 79 82 mode is 0x00000100, RTEMS_NO_PREEMPT RTEMS_NO_TIMESLICE RTEMS_NO_ASR INTMASK=0 … … 82 85 SELF - get current interrupt level - RTEMS[00] successful completion, level is 0 83 86 SELF - set interrupt level to 102 - RTEMS[00] successful completion 84 SELF - set interrupt level to original level - RTEMS[00] successful completion, level was 087 SELF - set interrupt level to original level - RTEMS[00] successful completion, level was 6 85 88 SELF - set mode to original mode - RTEMS[00] successful completion, 86 mode is 0x00000 100, RTEMS_NO_PREEMPT RTEMS_NO_TIMESLICE RTEMS_NO_ASR INTMASK=087 * END TaskMode Class test *89 mode is 0x00000500, RTEMS_NO_PREEMPT RTEMS_NO_TIMESLICE RTEMS_ASR INTMASK=0 90 END TaskMode Class test 88 91 <pause - screen 4> 89 * START Event Class test *92 START Event Class test 90 93 TA1 - create task 2 - RTEMS[00] successful completion 91 94 TA1 - start task 2 - RTEMS[00] successful completion … … 108 111 TA2 - send event signal 1 - RTEMS[00] successful completion 109 112 TA2 - event wait forever for signal 1 from TA2 - RTEMS[00] successful completion, signals out are 0x00000002 110 TA2 - dest ory itself111 * END Event Class test *113 TA2 - destroy itself 114 END Event Class test 112 115 <pause - screen 5> 113 * START Interrupt Class test *116 START Interrupt Class test 114 117 do not know a portable BSP type interrupt test 115 * END Interrupt Class test *118 END Interrupt Class test 116 119 <pause - screen 6> 117 * START MessageQueue Class test *118 TA1 - construct message queue 1 with no memory error - RTEMS[ 05] too many120 START MessageQueue Class test 121 TA1 - construct message queue 1 with no memory error - RTEMS[13] request not satisfied 119 122 TA1 - construct/create message queue 2 - RTEMS[00] successful completion 120 123 TA1 - send u1 to mq_2 - RTEMS[00] successful completion … … 144 147 TA31 - mq_2 receive - RTEMS[00] successful completion, size=18, message string size=17 145 148 TA31 - loopback to mq_2 - RTEMS[00] successful completion 146 TA31 - dest ory itself149 TA31 - destroy itself 147 150 TA32 - mq_2 receive - RTEMS[00] successful completion, size=18, message string size=17 148 151 TA32 - loopback to mq_2 - RTEMS[00] successful completion 149 TA32 - dest ory itself152 TA32 - destroy itself 150 153 TA1 - receive message b1 on mq_2 from TA31... 151 154 TA1 - RTEMS[00] successful completion … … 158 161 TA1 - send f1 to mq_2 - RTEMS[00] successful completion 159 162 TA1 - flush mq_2 - RTEMS[00] successful completion, flushed=3 160 * END MessageQueue Class test *161 <pause - screen 7> 163 END MessageQueue Class test 164 *** END OF RTEMS++ TEST ***
Note: See TracChangeset
for help on using the changeset viewer.