From e379e962b394a84182c7d3d1669a24c405044ff7 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 21 May 2009 19:40:07 +0000 Subject: 2009-05-21 Joel Sherrill PR 1415/cpukit * Makefile.am, configure.ac: Add test for very simple priority ceiling violation. * sp51/.cvsignore, sp51/Makefile.am, sp51/init.c, sp51/sp51.doc, sp51/sp51.scn: New files. --- testsuites/sptests/sp51/.cvsignore | 2 ++ testsuites/sptests/sp51/Makefile.am | 28 +++++++++++++++++ testsuites/sptests/sp51/init.c | 60 +++++++++++++++++++++++++++++++++++++ testsuites/sptests/sp51/sp51.doc | 28 +++++++++++++++++ testsuites/sptests/sp51/sp51.scn | 0 5 files changed, 118 insertions(+) create mode 100644 testsuites/sptests/sp51/.cvsignore create mode 100644 testsuites/sptests/sp51/Makefile.am create mode 100644 testsuites/sptests/sp51/init.c create mode 100644 testsuites/sptests/sp51/sp51.doc create mode 100644 testsuites/sptests/sp51/sp51.scn (limited to 'testsuites/sptests/sp51') diff --git a/testsuites/sptests/sp51/.cvsignore b/testsuites/sptests/sp51/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/sptests/sp51/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/sptests/sp51/Makefile.am b/testsuites/sptests/sp51/Makefile.am new file mode 100644 index 0000000000..2c90400dd9 --- /dev/null +++ b/testsuites/sptests/sp51/Makefile.am @@ -0,0 +1,28 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = sp51 +sp51_SOURCES = init.c + +dist_rtems_tests_DATA = sp51.scn +dist_rtems_tests_DATA += sp51.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +sp51_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(sp51_OBJECTS) $(sp51_LDADD) +LINK_LIBS = $(sp51_LDLIBS) + +sp51$(EXEEXT): $(sp51_OBJECTS) $(sp51_DEPENDENCIES) + @rm -f sp51$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/sp51/init.c b/testsuites/sptests/sp51/init.c new file mode 100644 index 0000000000..ecb2779808 --- /dev/null +++ b/testsuites/sptests/sp51/init.c @@ -0,0 +1,60 @@ +/* + * COPYRIGHT (c) 1989-2009. + * 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. + * + * $Id$ + */ + +#include + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code sc; + rtems_id mutex; + + puts( "\n\n*** TEST 51 ***" ); + + puts( "Create semaphore" ); + sc = rtems_semaphore_create( + rtems_build_name( 'S', 'E', 'M', '1' ), + 1, + RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY_CEILING | RTEMS_PRIORITY, + (RTEMS_MAXIMUM_PRIORITY - 4u), + &mutex + ); + directive_failed( sc, "rtems_semaphore_create" ); + + puts( "Obtain semaphore -- violate ceiling" ); + sc = rtems_semaphore_obtain( mutex, RTEMS_DEFAULT_OPTIONS, 0 ); + fatal_directive_status( sc, RTEMS_INTERNAL_ERROR, "rtems_semaphore_obtain" ); + + puts( "Release semaphore we did not obtain-- violate ceiling" ); + sc = rtems_semaphore_release( mutex ); + fatal_directive_status( + sc, RTEMS_NOT_OWNER_OF_RESOURCE, "rtems_semaphore_release" ); + + puts( "*** END OF TEST 51 ***" ); + rtems_test_exit( 0 ); +} + + +/**************** START OF CONFIGURATION INFORMATION ****************/ + +#define CONFIGURE_INIT +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#include + +/**************** END OF CONFIGURATION INFORMATION ****************/ diff --git a/testsuites/sptests/sp51/sp51.doc b/testsuites/sptests/sp51/sp51.doc new file mode 100644 index 0000000000..bbf162a7b9 --- /dev/null +++ b/testsuites/sptests/sp51/sp51.doc @@ -0,0 +1,28 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989-2009. +# 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: sp51 + +directives: + + rtems_semaphore_create + rtems_semaphore_obtain + rtems_semaphore_mutex + +concepts: + ++ Ensure that obtaining a binary semaphore with priority ceiling enabled + properly detects a ceiling violation when there is no conflict. + ++ Ensure the when the binary semaphore lock fails to acquire the mutex, + it is an error to release it since the lock failed. diff --git a/testsuites/sptests/sp51/sp51.scn b/testsuites/sptests/sp51/sp51.scn new file mode 100644 index 0000000000..e69de29bb2 -- cgit v1.2.3