source: rtems/testsuites/sptests/sp48/init.c @ 072d2a09

4.104.115
Last change on this file since 072d2a09 was b84f1fdc, checked in by Joel Sherrill <joel.sherrill@…>, on 05/10/09 at 14:39:46

2009-05-10 Joel Sherrill <joel.sherrill@…>

  • sp04/system.h, sp04/task1.c, sp04/tswitch.c, sp07/init.c, sp12/init.c, sp13/putbuff.c, sp13/system.h, sp13/task1.c, sp15/init.c, sp16/system.h, sp19/fptask.c, sp25/system.h, sp26/task1.c, sp27/init.c, sp28/init.c, sp29/init.c, sp31/task1.c, sp33/init.c, sp34/changepri.c, sp35/priinv.c, sp37/init.c, sp38/init.c, sp39/init.c, sp41/init.c, sp42/init.c, sp43/init.c, sp44/init.c, sp45/init.c, sp46/init.c, sp47/init.c, sp48/init.c, spfatal03/testcase.h, spfatal05/testcase.h, spfatal06/testcase.h, spfatal_support/system.h, spobjgetnext/init.c, spsize/getint.c, spsize/size.c: Fix warnings.
  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2 *  Verify creation of semaphores with unlimited attribute works.
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 *  $Id$
12 */
13
14#include <tmacros.h>
15#include <rtems/libcsupport.h>
16
17rtems_task Init(rtems_task_argument ignored);
18
19#define MAX 5000
20rtems_id Semaphores[MAX];
21
22rtems_task Init(rtems_task_argument ignored)
23{
24  rtems_status_code sc;
25  int               i;
26  int               created;
27
28  puts( "\n\n*** TEST 48 ***" );
29
30  printf( "Largest C program heap block available: %d\n", malloc_free_space() );
31  for (i=0 ; i<MAX ; i++ ) {
32    sc = rtems_semaphore_create(
33      rtems_build_name('s', 'e', 'm', ' '),
34      1,
35      RTEMS_DEFAULT_ATTRIBUTES,
36      0,
37      &Semaphores[i]
38    );
39    /* printf("Creating %i id=0x%08x\n", i, Semaphores[i]); */
40
41    if (sc == RTEMS_TOO_MANY) {
42      printf("We run out at %i!\n", i);
43      break;
44    }
45    if (sc != RTEMS_SUCCESSFUL) {
46      printf("FAILED creating at %i\n", i);
47      directive_failed( sc, "rtems_semaphore_create " );
48      rtems_test_exit( 0 );
49    }
50  }
51
52  created = i;
53  if ( created == MAX )
54    puts( "Created all semaphores allowed in this test" );
55
56  printf( "%d semaphores created\n", i );
57  printf( "Largest C program heap block available: %d\n", malloc_free_space() );
58
59  for ( i-- ; i ; i-- ) {
60    sc = rtems_semaphore_delete( Semaphores[i] );
61    if (sc != RTEMS_SUCCESSFUL) {
62      printf("FAILED deleting at %i\n", i);
63      directive_failed( sc, "rtems_semaphore_delete " );
64      rtems_test_exit( 0 );
65    }
66  }
67
68  printf( "%d semaphores successfully deleted\n", created );
69  printf( "Largest C program heap block available: %d\n", malloc_free_space() );
70
71  puts( "*** END OF TEST 48 ***" );
72  rtems_test_exit( 0 );
73}
74
75/* configuration stuff */
76
77#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
78#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
79
80#define CONFIGURE_MAXIMUM_TASKS        1
81#define CONFIGURE_MAXIMUM_SEMAPHORES   rtems_resource_unlimited(5)
82#if 1
83  #define CONFIGURE_UNIFIED_WORK_AREAS
84#else
85  #define CONFIGURE_MEMORY_OVERHEAD    1024
86#endif
87
88#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
89
90#define CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
91
92#define CONFIGURE_INIT
93#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.