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/init.c | 60 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 testsuites/sptests/sp51/init.c (limited to 'testsuites/sptests/sp51/init.c') 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 ****************/ -- cgit v1.2.3