source: rtems/testsuites/sptests/spwkspace/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.2 KB
Line 
1/*
2 *  Exercise Classic API Workspace Wrappers
3 *
4 *  COPYRIGHT (c) 1989-2009.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <tmacros.h>
17
18#include <string.h>
19
20#include <rtems/score/wkspace.h>
21
22static void test_workspace_string_duplicate(void)
23{
24  char a [] = "abcd";
25  char b [] = "abc";
26  char c [] = "ab";
27  char d [] = "a";
28  char e [] = "";
29  size_t maxlen = 3;
30  char *dup_a = _Workspace_String_duplicate( a, maxlen );
31  char *dup_b = _Workspace_String_duplicate( b, maxlen );
32  char *dup_c = _Workspace_String_duplicate( c, maxlen );
33  char *dup_d = _Workspace_String_duplicate( d, maxlen );
34  char *dup_e = _Workspace_String_duplicate( e, maxlen );
35
36  rtems_test_assert( dup_a != NULL );
37  rtems_test_assert( dup_b != NULL );
38  rtems_test_assert( dup_c != NULL );
39  rtems_test_assert( dup_d != NULL );
40  rtems_test_assert( dup_e != NULL );
41  rtems_test_assert( strcmp( dup_a, b ) == 0 );
42  rtems_test_assert( strcmp( dup_b, b ) == 0 );
43  rtems_test_assert( strcmp( dup_c, c ) == 0 );
44  rtems_test_assert( strcmp( dup_d, d ) == 0 );
45  rtems_test_assert( strcmp( dup_e, e ) == 0 );
46
47  _Workspace_Free( dup_a );
48  _Workspace_Free( dup_b );
49  _Workspace_Free( dup_c );
50  _Workspace_Free( dup_d );
51  _Workspace_Free( dup_e );
52}
53
54rtems_task Init(
55  rtems_task_argument argument
56)
57{
58  void                   *p1;
59  bool                    retbool;
60  Heap_Information_block  info;
61
62  puts( "\n\n*** TEST WORKSPACE CLASSIC API ***" );
63
64  puts( "rtems_workspace_get_information - null pointer" );
65  retbool = rtems_workspace_get_information( NULL );
66  rtems_test_assert( retbool == false );
67
68  puts( "rtems_workspace_get_information - OK" );
69  retbool = rtems_workspace_get_information( &info );
70  rtems_test_assert( retbool == true );
71
72  puts( "rtems_workspace_allocate - null pointer" );
73  retbool = rtems_workspace_allocate( 42, NULL );
74  rtems_test_assert( retbool == false );
75
76  puts( "rtems_workspace_allocate - 0 bytes" );
77  retbool = rtems_workspace_allocate( 0, &p1 );
78  rtems_test_assert( retbool == false );
79
80  puts( "rtems_workspace_allocate - too many bytes" );
81  retbool = rtems_workspace_allocate( info.Free.largest * 2, &p1 );
82  rtems_test_assert( retbool == false );
83
84  puts( "rtems_workspace_allocate - 42 bytes" );
85  retbool = rtems_workspace_allocate( 42, &p1 );
86  rtems_test_assert( retbool == true );
87  rtems_test_assert( p1 != NULL );
88
89  puts( "rtems_workspace_free - NULL" );
90  retbool = rtems_workspace_free( NULL );
91  rtems_test_assert( retbool == true );
92
93  puts( "rtems_workspace_free - previous pointer to 42 bytes" );
94  retbool = rtems_workspace_free( p1 );
95  rtems_test_assert( retbool == true );
96
97  puts( "_Workspace_String_duplicate - samples" );
98  test_workspace_string_duplicate();
99
100  puts( "*** END OF TEST WORKSPACE CLASSIC API ***" );
101  rtems_test_exit( 0 );
102}
103
104/* configuration information */
105
106#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
107#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
108
109#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
110
111#define CONFIGURE_MAXIMUM_TASKS             1
112
113#define CONFIGURE_INIT
114#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.