From 96b87626103fccf3dc8e3281146d29f7e23079c3 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Sat, 25 Jul 2009 01:31:07 +0000 Subject: 2009-07-24 Joel Sherrill * sp40/Makefile.am, sp40/init.c, sp40/sp40.scn: Attempt to write test to catch two remaining uncovered cases in rtems_io_register_driver. * sp40/system.h: Removed. --- testsuites/sptests/ChangeLog | 6 ++++ testsuites/sptests/sp40/Makefile.am | 2 +- testsuites/sptests/sp40/init.c | 67 ++++++++++++++++++++++++++++++------- testsuites/sptests/sp40/sp40.scn | 4 ++- testsuites/sptests/sp40/system.h | 38 --------------------- 5 files changed, 65 insertions(+), 52 deletions(-) delete mode 100644 testsuites/sptests/sp40/system.h diff --git a/testsuites/sptests/ChangeLog b/testsuites/sptests/ChangeLog index eca0160445..a2977e2d51 100644 --- a/testsuites/sptests/ChangeLog +++ b/testsuites/sptests/ChangeLog @@ -1,3 +1,9 @@ +2009-07-24 Joel Sherrill + + * sp40/Makefile.am, sp40/init.c, sp40/sp40.scn: Attempt to write test + to catch two remaining uncovered cases in rtems_io_register_driver. + * sp40/system.h: Removed. + 2009-07-24 Joel Sherrill * Makefile.am, configure.ac: Add new test to exercise odd case in diff --git a/testsuites/sptests/sp40/Makefile.am b/testsuites/sptests/sp40/Makefile.am index fa19deffea..23fa7b120c 100644 --- a/testsuites/sptests/sp40/Makefile.am +++ b/testsuites/sptests/sp40/Makefile.am @@ -5,7 +5,7 @@ MANAGERS = all rtems_tests_PROGRAMS = sp40 -sp40_SOURCES = init.c system.h +sp40_SOURCES = init.c dist_rtems_tests_DATA = sp40.scn diff --git a/testsuites/sptests/sp40/init.c b/testsuites/sptests/sp40/init.c index 9bc55c2e90..be0f0c87f4 100644 --- a/testsuites/sptests/sp40/init.c +++ b/testsuites/sptests/sp40/init.c @@ -11,30 +11,73 @@ * $Id$ */ -#define CONFIGURE_INIT -#include "system.h" +#include + +rtems_device_driver test_open( + rtems_device_major_number minor, + rtems_device_minor_number major, + void *ignored +) +{ +} +rtems_driver_address_table test_driver = { + NULL, /* initialization procedure */ + test_open, /* open request procedure */ + NULL, /* close request procedure */ + NULL, /* read request procedure */ + NULL, /* write request procedure */ + NULL, /* special functions procedure */ +}; rtems_task Init( rtems_task_argument argument ) { - puts( "\n\n*** TEST 40 ***" ); + rtems_status_code sc; + rtems_device_major_number registered; - puts( "TBD - Write test case matching this description" ); + puts( "\n\n*** TEST 40 ***" ); /* - * Register two drivers to fill up the table + * Register a driver with init == NULL and open != NULL */ - /* add major = 4 */ + puts( "Init - rtems_io_register_driver - init == NULL, open != NULL OK" ); + sc = rtems_io_register_driver( 0, &test_driver, ®istered ); + printf( "Init - Major slot returned = %d\n", (int) registered ); + directive_failed( sc, "rtems_io_register_driver" ); - /* add major = 3 */ - - /* - * Unregister major = 3 to leave slot which is not at - * the end of the Driver Table. - */ + puts( "Init - rtems_io_register_driver - used slot" ); + sc = rtems_io_register_driver( 1, &test_driver, ®istered ); + fatal_directive_status( + sc, + RTEMS_RESOURCE_IN_USE, + "rtems_io_register_driver slot in use" + ); puts( "*** END OF TEST 40 ***" ); rtems_test_exit( 0 ); } + + +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +/* more one more driver slot than are statically configured */ +#define CONFIGURE_MAXIMUM_DRIVERS 4 + +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT +#include + +/* end of include file */ diff --git a/testsuites/sptests/sp40/sp40.scn b/testsuites/sptests/sp40/sp40.scn index 1057065b8f..365a154b29 100644 --- a/testsuites/sptests/sp40/sp40.scn +++ b/testsuites/sptests/sp40/sp40.scn @@ -1,3 +1,5 @@ *** TEST 40 *** -TBD - Write test case matching this description +Init - rtems_io_register_driver - init == NULL, open != NULL OK +Init - Major slot returned = 3 +Init - rtems_io_register_driver - used slot *** END OF TEST 40 *** diff --git a/testsuites/sptests/sp40/system.h b/testsuites/sptests/sp40/system.h deleted file mode 100644 index f4226a2688..0000000000 --- a/testsuites/sptests/sp40/system.h +++ /dev/null @@ -1,38 +0,0 @@ -/* system.h - * - * This include file contains information that is included in every - * function in the test set. - * - * COPYRIGHT (c) 1989-2007. - * 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 - -/* functions */ - -rtems_task Init( - rtems_task_argument argument -); - -/* configuration information */ - -#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER -#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER - -/* more driver slots than are statically configured */ -#define CONFIGURE_MAXIMUM_DRIVERS 4 - -#define CONFIGURE_RTEMS_INIT_TASKS_TABLE - -#define CONFIGURE_MAXIMUM_TASKS 1 - -#include - -/* end of include file */ -- cgit v1.2.3