source: rtems/testsuites/sptests/spprivenv01/init.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: 3.6 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2011.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <tmacros.h>
15#include "test_support.h"
16#include <rtems/libio_.h>
17#include <rtems/malloc.h>
18#include <rtems/libcsupport.h>
19
20rtems_task task_routine( rtems_task_argument not_used )
21{
22  rtems_status_code sc;
23
24  puts( "task_routine - setting up a private environment" );
25
26  sc = rtems_libio_set_private_env();
27  directive_failed( sc, "set private env" );
28  sleep( 1 );
29
30  rtems_task_delete( RTEMS_SELF );
31}
32
33rtems_task Init(
34  rtems_task_argument argument
35)
36{
37  rtems_status_code       sc;
38  void                   *opaque;
39  rtems_id                current_task_id;
40  rtems_id                task_id;
41  rtems_name              another_task_name;
42  Heap_Information_block  Info;
43 
44  puts( "\n\n*** TEST USER ENVIRONMENT ROUTINE - 01 ***" );
45
46  puts( "Init - allocating most of heap -- OK" );
47  opaque = rtems_heap_greedy_allocate( 0 );
48
49  puts( "Init - attempt to reset env - expect RTEMS_NO_MEMORY" );
50  sc = rtems_libio_set_private_env();
51  rtems_test_assert( sc == RTEMS_NO_MEMORY );
52
53  puts( "Init - freeing the allocated memory" );
54  rtems_heap_greedy_free( opaque );
55
56  puts( "Init - allocating most of workspace memory" );
57  opaque = rtems_workspace_greedy_allocate( 0 );
58 
59  puts( "Init - attempt to reset env - expect RTEMS_TOO_MANY" );
60  sc = rtems_libio_set_private_env();
61  rtems_test_assert( sc == RTEMS_TOO_MANY );
62
63  puts( "Init - freeing the workspace memory" );
64  rtems_workspace_greedy_free( opaque );
65
66  puts( "Init - creating a task name and a task -- OK" );
67
68  another_task_name =
69    rtems_build_name( 'T','S','K','D' );
70
71  sc = rtems_task_create( another_task_name,
72                          1,
73                          RTEMS_MINIMUM_STACK_SIZE * 2,
74                          RTEMS_INTERRUPT_LEVEL(31),
75                          RTEMS_DEFAULT_ATTRIBUTES,
76                          &task_id
77                          );
78
79  puts( "Init - starting the task_routine, to set its private environment" );
80  sc = rtems_task_start( task_id, task_routine, 0);
81  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
82
83  puts( "Init - attempt to share the env with another task -- Expect error" );
84  sc = rtems_libio_share_private_env( task_id );
85  rtems_test_assert( sc == RTEMS_UNSATISFIED );
86
87  sleep( 1 );
88
89  puts( "Init - attempt to share the env with another task -- OK" );
90  sc = rtems_libio_share_private_env( task_id );
91  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
92  rtems_test_assert( rtems_current_user_env->task_id == task_id );
93
94  puts( "Init - Get current task id" );
95  current_task_id = rtems_task_self();
96
97  puts( "Init - Attempt to reset current task's environment" );
98  sc = rtems_libio_set_private_env();
99  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
100  rtems_test_assert( rtems_current_user_env->task_id == current_task_id );
101 
102  puts( "Init - attempt to share the env with another task -- OK" );
103  sc = rtems_libio_share_private_env( task_id );
104  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
105  rtems_test_assert( rtems_current_user_env->task_id == task_id );
106
107  puts( "Init - attempt to share with self -- OK" );
108  sc = rtems_libio_share_private_env( task_id );
109  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
110
111  puts( "*** END OF TEST USER ENVIRONMENT ROUTINE - 01 ***" );
112
113  rtems_test_exit(0);
114}
115
116/* configuration information */
117
118#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
119#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
120
121#define CONFIGURE_MAXIMUM_TASKS             3
122#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
123
124#define CONFIGURE_INIT
125
126#include <rtems/confdefs.h>
127/* end of file */
Note: See TracBrowser for help on using the repository browser.