summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests/devfs01/init.c
blob: aa7b146824d1333e41b23c750e25c6882765d72e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
 *  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 <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 */