summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests/deviceio01/init.c
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/deviceio01/init.c
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/deviceio01/init.c')
-rw-r--r--testsuites/libtests/deviceio01/init.c78
1 files changed, 78 insertions, 0 deletions
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 */