source: rtems/c/src/tests/samples/unlimited/test1.c @ 7ab11c0

4.104.114.84.95
Last change on this file since 7ab11c0 was 7ab11c0, checked in by Joel Sherrill <joel.sherrill@…>, on 01/03/03 at 22:55:54

2003-01-03 Joel Sherrill <joel@…>

  • unlimited/system.h, unlimited/test1.c: Backed off previous modification as it does not compile.
  • Property mode set to 100644
File size: 2.6 KB
RevLine 
[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
15 *  http://www.OARcorp.com/rtems/license.html.
16 *
17 *  $Id$
18 */
19
20#include "system.h"
21#include <rtems/score/object.h>
22#include <stdio.h>
[d25d17b]23#include <stdlib.h>
[f4a8ee1]24
25void test1()
26{
27  boolean           auto_extend;
28  rtems_status_code result;
29  rtems_unsigned32  task_count = 0;
[35290c9]30  Objects_Information *the_information;
[f4a8ee1]31 
32  char              c1 = 'a';
33  char              c2 = 'a';
34  char              c3 = '0';
35  char              c4 = '0';
36   
37  printf( "\n TEST1 : auto-extend disabled.\n" );
38
39  /*
40   * This is a major hack and only recommended for a test. Doing this
41   * saves having another test.
42   */
43
[35290c9]44  the_information =
45    _Objects_Information_table[OBJECTS_CLASSIC_API][OBJECTS_RTEMS_TASKS];
46  auto_extend = the_information->auto_extend;
47  the_information->auto_extend = FALSE;
[7ab11c0]48 
[f4a8ee1]49  while (task_count < MAX_TASKS)
50  {
51    rtems_name name;
52
53    printf(" TEST1 : creating task '%c%c%c%c', ", c1, c2, c3, c4);
54   
55    name = rtems_build_name(c1, c2, c3, c4);
56
57    result = rtems_task_create(name,
58                               10,
[f59df6b2]59                               RTEMS_MINIMUM_STACK_SIZE,
[f4a8ee1]60                               RTEMS_DEFAULT_ATTRIBUTES,
61                               RTEMS_LOCAL,
62                               &task_id[task_count]);
63
64    if (status_code_bad(result))
65      break;
66   
67    printf("number = %3i, id = %08x, starting, ", task_count, task_id[task_count]);
68   
[f59df6b2]69    fflush(stdout);
[f4a8ee1]70    result = rtems_task_start(task_id[task_count],
71                              test_task,
72                              (rtems_task_argument) task_count);
73   
74    if (status_code_bad(result))
75      break;
76   
77    /*
78     *  Update the name.
79     */
80   
81    NEXT_TASK_NAME(c1, c2, c3, c4);
82   
83    task_count++;
84  }
85
86  if (task_count >= MAX_TASKS)
87    printf( "\nMAX_TASKS too small for work-space size, please make larger !!\n\n" );
88   
[7ab11c0]89  if (task_count != (TASK_ALLOCATION_SIZE - 1)) {
[f4a8ee1]90    printf( " FAIL1 : the number of tasks does not equal the expected size -\n"
91            "           task created = %i, required number = %i\n",
92            task_count, TASK_ALLOCATION_SIZE);
93    exit( 1 );
94  }
95
96  destory_all_tasks("TEST1");
97 
[35290c9]98  the_information->auto_extend = auto_extend;
[f4a8ee1]99 
100  printf( " TEST1 : completed\n" );
101}
[7ab11c0]102
103
104
105
106
Note: See TracBrowser for help on using the repository browser.