[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 | * Copyright assigned to U.S. Government, 1994. |
---|
| 13 | * |
---|
| 14 | * The license and distribution terms for this file may in |
---|
| 15 | * the file LICENSE in this distribution or at |
---|
| 16 | * http://www.OARcorp.com/rtems/license.html. |
---|
| 17 | * |
---|
| 18 | * $Id$ |
---|
| 19 | */ |
---|
| 20 | |
---|
| 21 | #include "system.h" |
---|
| 22 | #include <rtems/score/object.h> |
---|
| 23 | #include <stdio.h> |
---|
| 24 | |
---|
| 25 | void test1() |
---|
| 26 | { |
---|
| 27 | boolean auto_extend; |
---|
| 28 | rtems_status_code result; |
---|
| 29 | rtems_unsigned32 task_count = 0; |
---|
| 30 | |
---|
| 31 | char c1 = 'a'; |
---|
| 32 | char c2 = 'a'; |
---|
| 33 | char c3 = '0'; |
---|
| 34 | char c4 = '0'; |
---|
| 35 | |
---|
| 36 | printf( "\n TEST1 : auto-extend disabled.\n" ); |
---|
| 37 | |
---|
| 38 | /* |
---|
| 39 | * This is a major hack and only recommended for a test. Doing this |
---|
| 40 | * saves having another test. |
---|
| 41 | */ |
---|
| 42 | |
---|
| 43 | auto_extend = _Objects_Information_table[OBJECTS_RTEMS_TASKS]->auto_extend; |
---|
| 44 | _Objects_Information_table[OBJECTS_RTEMS_TASKS]->auto_extend = FALSE; |
---|
| 45 | |
---|
| 46 | while (task_count < MAX_TASKS) |
---|
| 47 | { |
---|
| 48 | rtems_name name; |
---|
| 49 | |
---|
| 50 | printf(" TEST1 : creating task '%c%c%c%c', ", c1, c2, c3, c4); |
---|
| 51 | |
---|
| 52 | name = rtems_build_name(c1, c2, c3, c4); |
---|
| 53 | |
---|
| 54 | result = rtems_task_create(name, |
---|
| 55 | 10, |
---|
| 56 | 4096, |
---|
| 57 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 58 | RTEMS_LOCAL, |
---|
| 59 | &task_id[task_count]); |
---|
| 60 | |
---|
| 61 | if (status_code_bad(result)) |
---|
| 62 | break; |
---|
| 63 | |
---|
| 64 | printf("number = %3i, id = %08x, starting, ", task_count, task_id[task_count]); |
---|
| 65 | |
---|
| 66 | result = rtems_task_start(task_id[task_count], |
---|
| 67 | test_task, |
---|
| 68 | (rtems_task_argument) task_count); |
---|
| 69 | |
---|
| 70 | if (status_code_bad(result)) |
---|
| 71 | break; |
---|
| 72 | |
---|
| 73 | /* |
---|
| 74 | * Update the name. |
---|
| 75 | */ |
---|
| 76 | |
---|
| 77 | NEXT_TASK_NAME(c1, c2, c3, c4); |
---|
| 78 | |
---|
| 79 | task_count++; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | if (task_count >= MAX_TASKS) |
---|
| 83 | printf( "\nMAX_TASKS too small for work-space size, please make larger !!\n\n" ); |
---|
| 84 | |
---|
| 85 | if (task_count != (TASK_ALLOCATION_SIZE - 1)) { |
---|
| 86 | printf( " FAIL1 : the number of tasks does not equal the expected size -\n" |
---|
| 87 | " task created = %i, required number = %i\n", |
---|
| 88 | task_count, TASK_ALLOCATION_SIZE); |
---|
| 89 | exit( 1 ); |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | destory_all_tasks("TEST1"); |
---|
| 93 | |
---|
| 94 | _Objects_Information_table[OBJECTS_RTEMS_TASKS]->auto_extend = auto_extend; |
---|
| 95 | |
---|
| 96 | printf( " TEST1 : completed\n" ); |
---|
| 97 | } |
---|
| 98 | |
---|
| 99 | |
---|
| 100 | |
---|
| 101 | |
---|
| 102 | |
---|