[f4a8ee1] | 1 | /* Test1 |
---|
| 2 | * |
---|
| 3 | * This test uses a hack to disable suto-extend then checks to see only the |
---|
| 4 | * requested number of objects are allocated. |
---|
| 5 | * |
---|
| 6 | * Input parameters: NONE |
---|
| 7 | * |
---|
| 8 | * Output parameters: NONE |
---|
| 9 | * |
---|
| 10 | * COPYRIGHT (c) 1989-1997. |
---|
| 11 | * On-Line Applications Research Corporation (OAR). |
---|
| 12 | * |
---|
| 13 | * The license and distribution terms for this file may in |
---|
| 14 | * the file LICENSE in this distribution or at |
---|
[3e26377b] | 15 | * http://www.rtems.com/license/LICENSE. |
---|
[f4a8ee1] | 16 | */ |
---|
| 17 | |
---|
[e313551] | 18 | #ifdef HAVE_CONFIG_H |
---|
| 19 | #include "config.h" |
---|
| 20 | #endif |
---|
| 21 | |
---|
[9b86291b] | 22 | #include <inttypes.h> |
---|
[f4a8ee1] | 23 | #include <stdio.h> |
---|
[d25d17b] | 24 | #include <stdlib.h> |
---|
[f4a8ee1] | 25 | |
---|
[9b86291b] | 26 | #include "system.h" |
---|
[732276e] | 27 | #include "tmacros.h" |
---|
[9b86291b] | 28 | |
---|
[f4a8ee1] | 29 | void test1() |
---|
| 30 | { |
---|
[881db0eb] | 31 | bool auto_extend; |
---|
| 32 | rtems_status_code result; |
---|
| 33 | uint32_t task_count = 0; |
---|
[35290c9] | 34 | Objects_Information *the_information; |
---|
[8f71a36] | 35 | |
---|
[f4a8ee1] | 36 | char c1 = 'a'; |
---|
| 37 | char c2 = 'a'; |
---|
| 38 | char c3 = '0'; |
---|
| 39 | char c4 = '0'; |
---|
[8f71a36] | 40 | |
---|
[f4a8ee1] | 41 | printf( "\n TEST1 : auto-extend disabled.\n" ); |
---|
| 42 | |
---|
| 43 | /* |
---|
| 44 | * This is a major hack and only recommended for a test. Doing this |
---|
| 45 | * saves having another test. |
---|
| 46 | */ |
---|
| 47 | |
---|
[8f71a36] | 48 | the_information = |
---|
[35290c9] | 49 | _Objects_Information_table[OBJECTS_CLASSIC_API][OBJECTS_RTEMS_TASKS]; |
---|
| 50 | auto_extend = the_information->auto_extend; |
---|
[f0157b8] | 51 | the_information->auto_extend = false; |
---|
[8f71a36] | 52 | |
---|
[f4a8ee1] | 53 | while (task_count < MAX_TASKS) |
---|
| 54 | { |
---|
| 55 | rtems_name name; |
---|
| 56 | |
---|
| 57 | printf(" TEST1 : creating task '%c%c%c%c', ", c1, c2, c3, c4); |
---|
[8f71a36] | 58 | |
---|
[f4a8ee1] | 59 | name = rtems_build_name(c1, c2, c3, c4); |
---|
| 60 | |
---|
| 61 | result = rtems_task_create(name, |
---|
| 62 | 10, |
---|
[f59df6b2] | 63 | RTEMS_MINIMUM_STACK_SIZE, |
---|
[f4a8ee1] | 64 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 65 | RTEMS_LOCAL, |
---|
| 66 | &task_id[task_count]); |
---|
| 67 | |
---|
| 68 | if (status_code_bad(result)) |
---|
| 69 | break; |
---|
[8f71a36] | 70 | |
---|
[732276e] | 71 | printf("number = %3" PRIi32 ", id = %08" PRIxrtems_id ", starting, ", task_count, task_id[task_count]); |
---|
[8f71a36] | 72 | |
---|
[f59df6b2] | 73 | fflush(stdout); |
---|
[f4a8ee1] | 74 | result = rtems_task_start(task_id[task_count], |
---|
| 75 | test_task, |
---|
| 76 | (rtems_task_argument) task_count); |
---|
[8f71a36] | 77 | |
---|
[f4a8ee1] | 78 | if (status_code_bad(result)) |
---|
| 79 | break; |
---|
[8f71a36] | 80 | |
---|
[f4a8ee1] | 81 | /* |
---|
| 82 | * Update the name. |
---|
| 83 | */ |
---|
[8f71a36] | 84 | |
---|
[f4a8ee1] | 85 | NEXT_TASK_NAME(c1, c2, c3, c4); |
---|
[8f71a36] | 86 | |
---|
[f4a8ee1] | 87 | task_count++; |
---|
| 88 | } |
---|
| 89 | |
---|
| 90 | if (task_count >= MAX_TASKS) |
---|
| 91 | printf( "\nMAX_TASKS too small for work-space size, please make larger !!\n\n" ); |
---|
[8f71a36] | 92 | |
---|
[7ab11c0] | 93 | if (task_count != (TASK_ALLOCATION_SIZE - 1)) { |
---|
[f4a8ee1] | 94 | printf( " FAIL1 : the number of tasks does not equal the expected size -\n" |
---|
[9b86291b] | 95 | " task created = %" PRIi32 ", required number = %i\n", |
---|
[f4a8ee1] | 96 | task_count, TASK_ALLOCATION_SIZE); |
---|
| 97 | exit( 1 ); |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | destory_all_tasks("TEST1"); |
---|
[8f71a36] | 101 | |
---|
[35290c9] | 102 | the_information->auto_extend = auto_extend; |
---|
[8f71a36] | 103 | |
---|
[f4a8ee1] | 104 | printf( " TEST1 : completed\n" ); |
---|
| 105 | } |
---|