2009-05-21 Joel Sherrill <joel.sherrill@oarcorp.com>

PR 1414/cpukit
	* Makefile.am, configure.ac: Tighten math on extraction of index so it
	is harder to trick by passing in a valid id of an incorrect object
	class.
	* sp49/.cvsignore, sp49/Makefile.am, sp49/init.c, sp49/sp49.doc,
	sp49/sp49.scn: New files.
This commit is contained in:
Joel Sherrill
2009-05-21 14:34:15 +00:00
parent be0eebc1be
commit 1dc1da58a1
8 changed files with 125 additions and 1 deletions

View File

@@ -1,3 +1,12 @@
2009-05-21 Joel Sherrill <joel.sherrill@oarcorp.com>
PR 1414/cpukit
* Makefile.am, configure.ac: Tighten math on extraction of index so it
is harder to trick by passing in a valid id of an incorrect object
class.
* sp49/.cvsignore, sp49/Makefile.am, sp49/init.c, sp49/sp49.doc,
sp49/sp49.scn: New files.
2009-05-19 Chris Johns <chrisj@rtems.org>
* sp04/tswitch.c: Lower sample count for small memory targets.

View File

@@ -8,7 +8,7 @@ ACLOCAL_AMFLAGS = -I ../aclocal
SUBDIRS = sp01 sp02 sp03 sp04 sp05 sp06 sp07 sp08 sp09 sp11 sp12 sp13 sp14 \
sp15 sp16 sp17 sp19 sp20 sp21 sp22 sp23 sp24 sp25 sp26 sp27 sp28 sp29 \
sp30 sp31 sp32 sp33 sp34 sp35 sp37 sp38 sp39 sp40 sp41 sp42 sp43 sp44 \
sp45 sp46 sp47 sp48 spsize spwatchdog spfatal01 spfatal02 spfatal03 \
sp45 sp46 sp47 sp48 sp49 spsize spwatchdog spfatal01 spfatal02 spfatal03 \
spfatal04 spfatal05 spfatal06 spfatal07 spfatal08 spfatal09 spobjgetnext \
spprintk spwkspace

View File

@@ -73,6 +73,7 @@ sp45/Makefile
sp46/Makefile
sp47/Makefile
sp48/Makefile
sp49/Makefile
spwatchdog/Makefile
spsize/Makefile
spfatal/Makefile

View File

@@ -0,0 +1,2 @@
Makefile
Makefile.in

View File

@@ -0,0 +1,28 @@
##
## $Id$
##
MANAGERS = all
rtems_tests_PROGRAMS = sp49
sp49_SOURCES = init.c
dist_rtems_tests_DATA = sp49.scn
dist_rtems_tests_DATA += sp49.doc
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
sp49_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
LINK_OBJS = $(sp49_OBJECTS) $(sp49_LDADD)
LINK_LIBS = $(sp49_LDLIBS)
sp49$(EXEEXT): $(sp49_OBJECTS) $(sp49_DEPENDENCIES)
@rm -f sp49$(EXEEXT)
$(make-exe)
include $(top_srcdir)/../automake/local.am

View File

@@ -0,0 +1,54 @@
/*
* 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 ignored)
{
rtems_status_code sc;
rtems_id q;
uint32_t flushed;
puts( "\n\n*** TEST 49 ***" );
puts( "Create Message Queue" );
sc = rtems_message_queue_create(
rtems_build_name('m', 's', 'g', ' '),
1,
sizeof(uint32_t),
RTEMS_DEFAULT_ATTRIBUTES,
&q
);
directive_failed( sc, "rtems_message_queue_create" );
puts( "Flush Message Queue using Task Self ID" );
sc = rtems_message_queue_flush( rtems_task_self(), &flushed );
fatal_directive_status( sc, RTEMS_INVALID_ID, "flush" );
puts( "Flush returned INVALID_ID as expected" );
puts( "*** END OF TEST 49 ***" );
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_MESSAGE_QUEUES 1
#define CONFIGURE_MESSAGE_BUFFER_MEMORY 256 /* overkill */
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>

View File

@@ -0,0 +1,25 @@
#
# $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: sp49
directives:
rtems_task_self
rtems_message_queue_create
rtems_message_queue_flush
concepts:
+ Ensure that the id for a task cannot be used to operate upon
another object.

View File

@@ -0,0 +1,5 @@
*** TEST 49 ***
Create Message Queue
Flush Message Queue using Task Self ID
Flush returned INVALID_ID as expected
*** END OF TEST 49 ***