summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/sp40
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-07-25 01:31:07 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-07-25 01:31:07 +0000
commit96b87626103fccf3dc8e3281146d29f7e23079c3 (patch)
tree440f5600ebf565b6d9948b6944892820de451ea7 /testsuites/sptests/sp40
parent2009-07-24 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-96b87626103fccf3dc8e3281146d29f7e23079c3.tar.bz2
2009-07-24 Joel Sherrill <joel.sherrill@oarcorp.com>
* 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.
Diffstat (limited to 'testsuites/sptests/sp40')
-rw-r--r--testsuites/sptests/sp40/Makefile.am2
-rw-r--r--testsuites/sptests/sp40/init.c67
-rw-r--r--testsuites/sptests/sp40/sp40.scn4
-rw-r--r--testsuites/sptests/sp40/system.h38
4 files changed, 59 insertions, 52 deletions
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 <tmacros.h>
+
+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, &registered );
+ 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, &registered );
+ 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 <rtems/confdefs.h>
+
+/* 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 <tmacros.h>
-
-/* 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 <rtems/confdefs.h>
-
-/* end of include file */