source: rtems/testsuites/samples/unlimited/test1.c @ 8f71a36

4.104.114.84.9
Last change on this file since 8f71a36 was 8f71a36, checked in by Ralf Corsepius <ralf.corsepius@…>, on Apr 20, 2004 at 7:09:31 AM

Remove stray white spaces.

  • Property mode set to 100644
File size: 2.5 KB
Line 
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.rtems.com/license/LICENSE.
16 *
17 *  $Id$
18 */
19
20#include "system.h"
21#include <rtems/score/object.h>
22#include <stdio.h>
23#include <stdlib.h>
24
25void test1()
26{
27  boolean           auto_extend;
28  rtems_status_code result;
29  uint32_t    task_count = 0;
30  Objects_Information *the_information;
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
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;
48
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,
59                               RTEMS_MINIMUM_STACK_SIZE,
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
69    fflush(stdout);
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
89  if (task_count != (TASK_ALLOCATION_SIZE - 1)) {
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
98  the_information->auto_extend = auto_extend;
99
100  printf( " TEST1 : completed\n" );
101}
Note: See TracBrowser for help on using the repository browser.