summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/sp48
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-01-30 22:20:39 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-01-30 22:20:39 +0000
commitc83a33ccbbcbf108412a116356b6168b8b3b8b99 (patch)
tree13d913b50ab2b913336a81c7658d2bf0f8fff05a /testsuites/sptests/sp48
parent2009-01-30 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-c83a33ccbbcbf108412a116356b6168b8b3b8b99.tar.bz2
2009-01-30 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac: Add sp48 which tests that configuring for unlimited objects when configured for a unified workspace works as expected. * sp48/.cvsignore, sp48/Makefile.am, sp48/init.c, sp48/sp48.doc, sp48/sp48.scn: New files.
Diffstat (limited to 'testsuites/sptests/sp48')
-rw-r--r--testsuites/sptests/sp48/.cvsignore2
-rw-r--r--testsuites/sptests/sp48/Makefile.am28
-rw-r--r--testsuites/sptests/sp48/init.c84
-rw-r--r--testsuites/sptests/sp48/sp48.doc24
-rw-r--r--testsuites/sptests/sp48/sp48.scn11
5 files changed, 149 insertions, 0 deletions
diff --git a/testsuites/sptests/sp48/.cvsignore b/testsuites/sptests/sp48/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/sptests/sp48/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/sptests/sp48/Makefile.am b/testsuites/sptests/sp48/Makefile.am
new file mode 100644
index 0000000000..5c705d4d16
--- /dev/null
+++ b/testsuites/sptests/sp48/Makefile.am
@@ -0,0 +1,28 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = sp48.exe
+sp48_exe_SOURCES = init.c
+
+dist_rtems_tests_DATA = sp48.scn
+dist_rtems_tests_DATA += sp48.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+sp48_exe_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(sp48_exe_OBJECTS) $(sp48_exe_LDADD)
+LINK_LIBS = $(sp48_exe_LDLIBS)
+
+sp48.exe$(EXEEXT): $(sp48_exe_OBJECTS) $(sp48_exe_DEPENDENCIES)
+ @rm -f sp48.exe$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/sp48/init.c b/testsuites/sptests/sp48/init.c
new file mode 100644
index 0000000000..33c8315c1c
--- /dev/null
+++ b/testsuites/sptests/sp48/init.c
@@ -0,0 +1,84 @@
+/*
+ * Verify creation of semaphores with unlimited attribute works.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+#include <rtems/libcsupport.h>
+
+#define MAX 5000
+rtems_id Semaphores[MAX];
+
+rtems_task Init(rtems_task_argument ignored)
+{
+ rtems_status_code sc;
+ int i;
+ int created;
+
+ puts( "\n\n*** TEST 48 ***" );
+
+ printf( "Largest C program heap block available: %d\n", malloc_free_space() );
+ for (i=0 ; i<MAX ; i++ ) {
+ sc = rtems_semaphore_create(
+ rtems_build_name('s', 'e', 'm', ' '),
+ 1,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ 0,
+ &Semaphores[i]
+ );
+ /* printf("Creating %i id=0x%08x\n", i, Semaphores[i]); */
+
+ if (sc == RTEMS_TOO_MANY) {
+ printf("We run out at %i!\n", i);
+ break;
+ }
+ if (sc != RTEMS_SUCCESSFUL) {
+ printf("FAILED creating at %i\n", i);
+ directive_failed( sc, "rtems_semaphore_create " );
+ rtems_test_exit( 0 );
+ }
+ }
+
+ created = i;
+ if ( created == MAX )
+ puts( "Created all semaphores allowed in this test" );
+
+ printf( "%d semaphores created\n", i );
+ printf( "Largest C program heap block available: %d\n", malloc_free_space() );
+
+ for ( i-- ; i ; i-- ) {
+ sc = rtems_semaphore_delete( Semaphores[i] );
+ if (sc != RTEMS_SUCCESSFUL) {
+ printf("FAILED deleting at %i\n", i);
+ directive_failed( sc, "rtems_semaphore_delete " );
+ rtems_test_exit( 0 );
+ }
+ }
+
+ printf( "%d semaphores successfully deleted\n", created );
+ printf( "Largest C program heap block available: %d\n", malloc_free_space() );
+
+ puts( "*** END OF TEST 48 ***" );
+ rtems_test_exit( 0 );
+}
+
+/* configuration stuff */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+#define CONFIGURE_MAXIMUM_SEMAPHORES rtems_resource_unlimited(5)
+#if 1
+ #define CONFIGURE_UNIFIED_WORK_AREAS
+#else
+ #define CONFIGURE_MEMORY_OVERHEAD 1024
+#endif
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
diff --git a/testsuites/sptests/sp48/sp48.doc b/testsuites/sptests/sp48/sp48.doc
new file mode 100644
index 0000000000..5e71aee8d9
--- /dev/null
+++ b/testsuites/sptests/sp48/sp48.doc
@@ -0,0 +1,24 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989-2008.
+# On-Line Applications Research Corporation (OAR).
+#
+# The license and distribution terms for this file may be
+# found in the file LICENSE in this distribution or at
+# http://www.rtems.com/license/LICENSE.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: sp48
+
+directives:
+
+ rtems_semaphore_create
+ rtems_semaphore_delete
+
+concepts:
+
++ Ensure that unlimited object configuration works properly when
+ configured for unified C program heap and Executive Workspace.
diff --git a/testsuites/sptests/sp48/sp48.scn b/testsuites/sptests/sp48/sp48.scn
new file mode 100644
index 0000000000..98049cfe16
--- /dev/null
+++ b/testsuites/sptests/sp48/sp48.scn
@@ -0,0 +1,11 @@
+*** TEST 48 ***
+Largest C program heap block available: 4006096
+Created all semaphores allowed in this test
+5000 semaphores created
+Largest C program heap block available: 2376296
+5000 semaphores successfully deleted
+Largest C program heap block available: 2376296
+*** END OF TEST 48 ***
+
+NOTE: Heap block size and maximum objects created vary based upon target.
+ The maximum semaphores that will be created is 5000.