source: rtems/testsuites/samples/unlimited/test1.c @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

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