summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests/devfs01/init.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-14 23:53:49 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-14 23:53:49 +0000
commit216715075b0f9ae844de5f1b6eea969d1ea67b61 (patch)
tree5c90660e59dac9ce93bd872b0bc38ee12a3f4345 /testsuites/libtests/devfs01/init.c
parent2010-07-14 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-216715075b0f9ae844de5f1b6eea969d1ea67b61.tar.bz2
2010-07-14 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac: Add new test to exercise devFS_Show(). * devfs01/.cvsignore, devfs01/Makefile.am, devfs01/devfs01.doc, devfs01/devfs01.scn, devfs01/init.c: New files.
Diffstat (limited to 'testsuites/libtests/devfs01/init.c')
-rw-r--r--testsuites/libtests/devfs01/init.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/testsuites/libtests/devfs01/init.c b/testsuites/libtests/devfs01/init.c
new file mode 100644
index 0000000000..79fbabf647
--- /dev/null
+++ b/testsuites/libtests/devfs01/init.c
@@ -0,0 +1,73 @@
+/*
+ * 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>
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ int sc;
+ int size;
+ rtems_filesystem_location_info_t *temp_loc;
+ rtems_device_name_t *device_name_table;
+
+ puts( "\n\n*** TEST DEVFS01 ***" );
+
+ puts( "devFS_Show - OK" );
+ sc = devFS_Show();
+ rtems_test_assert( sc == 0 );
+
+ /* save original node access information */
+ temp_loc = &rtems_filesystem_root;
+ device_name_table = (rtems_device_name_t *)temp_loc->node_access;
+ temp_loc->node_access = NULL;
+
+ puts( "devFS_Show - no device table - EFAULT" );
+ sc = devFS_Show();
+ rtems_test_assert( sc == -1 );
+ rtems_test_assert( errno == EFAULT );
+
+ /* restore node access information */
+ temp_loc->node_access = device_name_table;
+
+ /* save original device table size information */
+ size = rtems_device_table_size;
+ rtems_device_table_size = 0;
+ puts( "devFS_Show - devices - OK" );
+ sc = devFS_Show();
+ rtems_test_assert( sc == 0 );
+
+ /* restore original device table size information */
+ rtems_device_table_size = size;
+
+ puts( "*** END OF TEST DEVFS01 ***" );
+
+ rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+/* end of file */