summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/sp51/init.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-05-21 19:40:07 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-05-21 19:40:07 +0000
commite379e962b394a84182c7d3d1669a24c405044ff7 (patch)
tree3c99b4b8f62c5b47d49404f779a13d261fb35fd0 /testsuites/sptests/sp51/init.c
parent2009-05-21 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-e379e962b394a84182c7d3d1669a24c405044ff7.tar.bz2
2009-05-21 Joel Sherrill <joel.sherrill@oarcorp.com>
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.
Diffstat (limited to 'testsuites/sptests/sp51/init.c')
-rw-r--r--testsuites/sptests/sp51/init.c60
1 files changed, 60 insertions, 0 deletions
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 <tmacros.h>
+
+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 <rtems/confdefs.h>
+
+/**************** END OF CONFIGURATION INFORMATION ****************/