diff --git a/testsuites/sptests/ChangeLog b/testsuites/sptests/ChangeLog index 34c1942330..2e9156e081 100644 --- a/testsuites/sptests/ChangeLog +++ b/testsuites/sptests/ChangeLog @@ -1,3 +1,12 @@ +2009-05-21 Joel Sherrill + + 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 * sp04/tswitch.c: Lower sample count for small memory targets. diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index e1d94dc6d0..696e2ec9f4 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -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 diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index 036d21f205..35c3ad786a 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -73,6 +73,7 @@ sp45/Makefile sp46/Makefile sp47/Makefile sp48/Makefile +sp49/Makefile spwatchdog/Makefile spsize/Makefile spfatal/Makefile diff --git a/testsuites/sptests/sp49/.cvsignore b/testsuites/sptests/sp49/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/sptests/sp49/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/sptests/sp49/Makefile.am b/testsuites/sptests/sp49/Makefile.am new file mode 100644 index 0000000000..e4c08da6f5 --- /dev/null +++ b/testsuites/sptests/sp49/Makefile.am @@ -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 diff --git a/testsuites/sptests/sp49/init.c b/testsuites/sptests/sp49/init.c new file mode 100644 index 0000000000..52b58a4ab8 --- /dev/null +++ b/testsuites/sptests/sp49/init.c @@ -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 + +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 diff --git a/testsuites/sptests/sp49/sp49.doc b/testsuites/sptests/sp49/sp49.doc new file mode 100644 index 0000000000..b8679752f1 --- /dev/null +++ b/testsuites/sptests/sp49/sp49.doc @@ -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. diff --git a/testsuites/sptests/sp49/sp49.scn b/testsuites/sptests/sp49/sp49.scn new file mode 100644 index 0000000000..1cf9145153 --- /dev/null +++ b/testsuites/sptests/sp49/sp49.scn @@ -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 ***