summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-08-07 00:24:48 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-08-07 00:24:48 +0000
commit58c5a9b59ee083506b3030e823539636a932a3b8 (patch)
tree3f7b7f4cade4837673c1aea681bb71eec81c1895 /testsuites/libtests
parent2010-08-06 Bharath Suri <bharath.s.jois@gmail.com> (diff)
downloadrtems-58c5a9b59ee083506b3030e823539636a932a3b8.tar.bz2
2010-08-06 Bharath Suri <bharath.s.jois@gmail.com>
PR 1654/testing * deviceio01/init.c, deviceio01/deviceio01.doc, deviceio01/deviceio01.scn, deviceio01/test_driver.c, deviceio01/test_driver.h, deviceio01/Makefile.am: New test added. * Makefile.am, configure.ac: Changes to added above test. * tar02/init.c, tar02/tar02.scn: New test case added: IMFS_dump().
Diffstat (limited to 'testsuites/libtests')
-rw-r--r--testsuites/libtests/ChangeLog9
-rw-r--r--testsuites/libtests/Makefile.am2
-rw-r--r--testsuites/libtests/configure.ac1
-rw-r--r--testsuites/libtests/deviceio01/.cvsignore2
-rw-r--r--testsuites/libtests/deviceio01/Makefile.am24
-rw-r--r--testsuites/libtests/deviceio01/deviceio01.doc28
-rw-r--r--testsuites/libtests/deviceio01/deviceio01.scn7
-rw-r--r--testsuites/libtests/deviceio01/init.c78
-rw-r--r--testsuites/libtests/deviceio01/test_driver.c190
-rw-r--r--testsuites/libtests/deviceio01/test_driver.h64
-rw-r--r--testsuites/libtests/tar02/init.c1
-rw-r--r--testsuites/libtests/tar02/tar02.scn7
12 files changed, 412 insertions, 1 deletions
diff --git a/testsuites/libtests/ChangeLog b/testsuites/libtests/ChangeLog
index 68e19b99dd..23886bbb25 100644
--- a/testsuites/libtests/ChangeLog
+++ b/testsuites/libtests/ChangeLog
@@ -1,3 +1,12 @@
+2010-08-06 Bharath Suri <bharath.s.jois@gmail.com>
+
+ PR 1654/testing
+ * deviceio01/init.c, deviceio01/deviceio01.doc,
+ deviceio01/deviceio01.scn, deviceio01/test_driver.c,
+ deviceio01/test_driver.h, deviceio01/Makefile.am: New test added.
+ * Makefile.am, configure.ac: Changes to added above test.
+ * tar02/init.c, tar02/tar02.scn: New test case added: IMFS_dump().
+
2010-08-02 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac: Add test for rtems_print_buffer().
diff --git a/testsuites/libtests/Makefile.am b/testsuites/libtests/Makefile.am
index 135f6053cd..366c2f4f65 100644
--- a/testsuites/libtests/Makefile.am
+++ b/testsuites/libtests/Makefile.am
@@ -7,7 +7,7 @@ ACLOCAL_AMFLAGS = -I ../aclocal
SUBDIRS = POSIX
SUBDIRS += bspcmdline01 cpuuse devfs01 devfs02 devfs03 devfs04 \
- devnullfatal01 dumpbuf01 gxx01 gxx02 \
+ deviceio01 devnullfatal01 dumpbuf01 gxx01 gxx02 \
malloctest malloc02 malloc03 malloc04 malloc05 heapwalk \
putenvtest monitor monitor02 rtmonuse stackchk stackchk01 \
termios termios01 termios02 termios03 termios04 termios05 \
diff --git a/testsuites/libtests/configure.ac b/testsuites/libtests/configure.ac
index f52e86e860..030754ed3f 100644
--- a/testsuites/libtests/configure.ac
+++ b/testsuites/libtests/configure.ac
@@ -53,6 +53,7 @@ devfs01/Makefile
devfs02/Makefile
devfs03/Makefile
devfs04/Makefile
+deviceio01/Makefile
devnullfatal01/Makefile
dumpbuf01/Makefile
gxx01/Makefile
diff --git a/testsuites/libtests/deviceio01/.cvsignore b/testsuites/libtests/deviceio01/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/libtests/deviceio01/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/libtests/deviceio01/Makefile.am b/testsuites/libtests/deviceio01/Makefile.am
new file mode 100644
index 0000000000..1f8c7281c8
--- /dev/null
+++ b/testsuites/libtests/deviceio01/Makefile.am
@@ -0,0 +1,24 @@
+##
+## $Id$
+##
+
+rtems_tests_PROGRAMS = deviceio01
+deviceio01_SOURCES = init.c test_driver.c
+
+dist_rtems_tests_DATA = deviceio01.scn
+dist_rtems_tests_DATA += deviceio01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(deviceio01_OBJECTS) $(deviceio01_LDADD)
+LINK_LIBS = $(deviceio01_LDLIBS)
+
+deviceio01$(EXEEXT): $(deviceio01_OBJECTS) $(deviceio01_DEPENDENCIES)
+ @rm -f deviceio01$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/libtests/deviceio01/deviceio01.doc b/testsuites/libtests/deviceio01/deviceio01.doc
new file mode 100644
index 0000000000..0769865d13
--- /dev/null
+++ b/testsuites/libtests/deviceio01/deviceio01.doc
@@ -0,0 +1,28 @@
+#
+# $Id$
+#
+# COPYRIGHT (c) 1989-2010.
+# 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: devfs04
+
+directives:
+
++ device_read
++ device_write
++ device_ioctl
+
+concepts:
+
++ Custom driver for a device /dev/test lets us exercise the error
+paths in the read / write routines for devFS. These are invoked using
+the system calls read() and write().
+
++ Mostly hits the error paths in the above mentioned routines
diff --git a/testsuites/libtests/deviceio01/deviceio01.scn b/testsuites/libtests/deviceio01/deviceio01.scn
new file mode 100644
index 0000000000..6c39feb7c1
--- /dev/null
+++ b/testsuites/libtests/deviceio01/deviceio01.scn
@@ -0,0 +1,7 @@
+*** TEST DEVICEIO - 01 ***
+Init - attempt to open the /dev/test WR mode -- OK
+Init - attempt to write to /dev/test - expect ENOSYS
+Init - attempt to open the /dev/test RD mode -- OK
+Init - attempt to read from /dev/test - expect ENOSYS
+Init - attempt ioctl on the device - expect ENOSYS
+*** END OF TEST DEVICEIO - 01 ***
diff --git a/testsuites/libtests/deviceio01/init.c b/testsuites/libtests/deviceio01/init.c
new file mode 100644
index 0000000000..f1ff982429
--- /dev/null
+++ b/testsuites/libtests/deviceio01/init.c
@@ -0,0 +1,78 @@
+/*
+ * COPYRIGHT (c) 1989-2010.
+ * 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>
+#include "test_support.h"
+#include <rtems/devfs.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include "test_driver.h"
+#include <rtems/devnull.h>
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ int status;
+ int fdr = 0, fdw = 0;
+ char buf[10];
+
+ puts( "\n\n*** TEST DEVICEIO - 01 ***" );
+
+ puts( "Init - attempt to open the /dev/test WR mode -- OK" );
+ fdw = open( "/dev/test", O_WRONLY );
+ rtems_test_assert( fdw != -1 );
+
+ puts( "Init - attempt to write to /dev/test - expect ENOSYS" );
+ status = write( fdw, "data", 10 );
+ rtems_test_assert( status == -1 );
+ rtems_test_assert( errno == ENOSYS );
+
+ puts( "Init - attempt to open the /dev/test RD mode -- OK" );
+ fdr = open( "/dev/test", O_RDONLY );
+ rtems_test_assert( fdr != -1 );
+
+ puts( "Init - attempt to read from /dev/test - expect ENOSYS" );
+ status = read( fdr, buf, 10 );
+ rtems_test_assert( status == -1 );
+ rtems_test_assert( errno == ENOSYS );
+
+ puts( "Init - attempt ioctl on the device - expect ENOSYS" );
+ status = ioctl( fdr, -1 );
+ rtems_test_assert( status == -1 );
+ rtems_test_assert( errno == ENOSYS );
+
+ puts( "*** END OF TEST DEVICEIO - 01 ***" );
+ rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_EXTRA_DRIVERS TEST_DRIVER_TABLE_ENTRY
+
+/* include an extra slot for registering the termios one dynamically */
+#define CONFIGURE_MAXIMUM_DRIVERS 3
+
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 5
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+/* end of file */
diff --git a/testsuites/libtests/deviceio01/test_driver.c b/testsuites/libtests/deviceio01/test_driver.c
new file mode 100644
index 0000000000..b02852cb1e
--- /dev/null
+++ b/testsuites/libtests/deviceio01/test_driver.c
@@ -0,0 +1,190 @@
+/*
+ * COPYRIGHT (c) 1989-2010.
+ * 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$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+#include "test_driver.h"
+#include <rtems/libio.h>
+#include <rtems/devnull.h>
+/*
+ * The test driver routines are mostly derived from the null driver routines.
+ */
+uint32_t TEST_major;
+static char initialized;
+
+/* testDriver_initialize
+ *
+ * This routine is the test device driver init routine.
+ *
+ * Input parameters:
+ * major - device major number
+ * minor - device minor number
+ * pargp - pointer to parameter block
+ *
+ * Output parameters:
+ * rval - RTEMS_SUCCESSFUL
+ */
+rtems_device_driver testDriver_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor __attribute__((unused)),
+ void *pargp __attribute__((unused))
+)
+{
+ rtems_device_driver status;
+
+ if ( !initialized ) {
+ initialized = 1;
+
+ status = rtems_io_register_name(
+ "/dev/test",
+ major,
+ (rtems_device_minor_number) 0
+ );
+
+ if (status != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred(status);
+
+ TEST_major = major;
+ }
+
+ return RTEMS_SUCCESSFUL;
+}
+
+/* testDriver_open
+ *
+ * This routine is the test device driver open routine.
+ *
+ * Input parameters:
+ * major - device major number
+ * minor - device minor number
+ * pargb - pointer to open parameter block
+ *
+ * Output parameters:
+ * rval - RTEMS_SUCCESSFUL
+ */
+rtems_device_driver testDriver_open(
+ rtems_device_major_number major __attribute__((unused)),
+ rtems_device_minor_number minor __attribute__((unused)),
+ void *pargp __attribute__((unused))
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/* testDriver_close
+ *
+ * This routine is the test device driver close routine.
+ *
+ * Input parameters:
+ * major - device major number
+ * minor - device minor number
+ * pargb - pointer to close parameter block
+ *
+ * Output parameters:
+ * rval - RTEMS_SUCCESSFUL
+ */
+rtems_device_driver testDriver_close(
+ rtems_device_major_number major __attribute__((unused)),
+ rtems_device_minor_number minor __attribute__((unused)),
+ void *pargp __attribute__((unused))
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/* testDriver_read
+ *
+ * This routine is the test device driver read routine.
+ *
+ * Input parameters:
+ * major - device major number
+ * minor - device minor number
+ * pargp - pointer to read parameter block
+ *
+ * Output parameters:
+ * rval - RTEMS_SUCCESSFUL
+ */
+rtems_device_driver testDriver_read(
+ rtems_device_major_number major __attribute__((unused)),
+ rtems_device_minor_number minor __attribute__((unused)),
+ void *pargp
+)
+{
+ rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) pargp;
+
+ if ( rw_args ) {
+ if( rw_args->count == 5 )
+ rw_args->bytes_moved = 0;
+ else {
+ rw_args->bytes_moved = 0;
+ return RTEMS_NOT_IMPLEMENTED;
+ }
+ }
+
+ return RTEMS_SUCCESSFUL;
+}
+
+/* testDriver_write
+ *
+ * This routine is the test device driver write routine.
+ *
+ * Input parameters:
+ * major - device major number
+ * minor - device minor number
+ * pargp - pointer to write parameter block
+ *
+ * Output parameters:
+ * rval - RTEMS_SUCCESSFUL
+ */
+rtems_device_driver testDriver_write(
+ rtems_device_major_number major __attribute__((unused)),
+ rtems_device_minor_number minor __attribute__((unused)),
+ void *pargp
+)
+{
+ rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) pargp;
+
+ if ( rw_args ) {
+ if( rw_args->count == 5 )
+ return null_write( 0, 0, pargp );
+ else {
+ rw_args->bytes_moved = 0;
+ return RTEMS_NOT_IMPLEMENTED;
+ }
+ }
+
+ return RTEMS_SUCCESSFUL;
+}
+
+/* testDriver_control
+ *
+ * This routine is the test device driver control routine.
+ *
+ * Input parameters:
+ * major - device major number
+ * minor - device minor number
+ * pargp - pointer to cntrl parameter block
+ *
+ * Output parameters:
+ * rval - RTEMS_SUCCESSFUL
+ */
+
+rtems_device_driver testDriver_control(
+ rtems_device_major_number major __attribute__((unused)),
+ rtems_device_minor_number minor __attribute__((unused)),
+ void *pargp __attribute__((unused))
+)
+{
+ return RTEMS_NOT_IMPLEMENTED;
+}
diff --git a/testsuites/libtests/deviceio01/test_driver.h b/testsuites/libtests/deviceio01/test_driver.h
new file mode 100644
index 0000000000..999e60c3cc
--- /dev/null
+++ b/testsuites/libtests/deviceio01/test_driver.h
@@ -0,0 +1,64 @@
+/*
+ * COPYRIGHT (c) 1989-2010.
+ * 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$
+ */
+
+#ifndef __TEST_DRIVER_h
+#define __TEST_DRIVER_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TEST_DRIVER_TABLE_ENTRY \
+ { testDriver_initialize, testDriver_open, testDriver_close, testDriver_read, \
+ testDriver_write, testDriver_control }
+
+rtems_device_driver testDriver_initialize(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver testDriver_open(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver testDriver_close(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver testDriver_read(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver testDriver_write(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+rtems_device_driver testDriver_control(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/testsuites/libtests/tar02/init.c b/testsuites/libtests/tar02/init.c
index 040637cb63..a6c05c9d18 100644
--- a/testsuites/libtests/tar02/init.c
+++ b/testsuites/libtests/tar02/init.c
@@ -63,6 +63,7 @@ rtems_task Init(
printf( "\n\n*** TAR02 TEST ***\n" );
test_tarfs_load();
+ IMFS_dump();
printf( "*** END OF TAR02 TEST ***\n" );
exit( 0 );
diff --git a/testsuites/libtests/tar02/tar02.scn b/testsuites/libtests/tar02/tar02.scn
index 04f81df228..3b4d1bc2b0 100644
--- a/testsuites/libtests/tar02/tar02.scn
+++ b/testsuites/libtests/tar02/tar02.scn
@@ -5,4 +5,11 @@ Loading tarfs image ... successful
initial tar image.
*** Skipping symlink -- NOT CURRENTLY SUPPORTED ***
+*************** Dump of Entire IMFS ***************
+/
+....dev/
+........console (device 0, 0)
+....home/
+........test_file (file 73 0x12022c)
+*************** End of Dump ***************
*** END OF TAR02 TEST ***