source: rtems/testsuites/libtests/deviceio01/init.c @ 58c5a9b

4.115
Last change on this file since 58c5a9b was 58c5a9b, checked in by Joel Sherrill <joel.sherrill@…>, on 08/07/10 at 00:24:48

2010-08-06 Bharath Suri <bharath.s.jois@…>

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().
  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2010.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#include <tmacros.h>
13#include "test_support.h"
14#include <rtems/devfs.h>
15#include <errno.h>
16#include <unistd.h>
17#include <sys/types.h>
18#include <sys/stat.h>
19#include <fcntl.h>
20#include "test_driver.h"
21#include <rtems/devnull.h>
22
23rtems_task Init(
24  rtems_task_argument argument
25)
26{
27  int status;
28  int fdr = 0, fdw = 0;
29  char buf[10];
30
31  puts( "\n\n*** TEST DEVICEIO - 01 ***" );
32
33  puts( "Init - attempt to open the /dev/test WR mode -- OK" );
34  fdw = open( "/dev/test", O_WRONLY );
35  rtems_test_assert( fdw != -1 );
36 
37  puts( "Init - attempt to write to /dev/test - expect ENOSYS" );
38  status = write( fdw, "data", 10 );
39  rtems_test_assert( status == -1 );
40  rtems_test_assert( errno == ENOSYS );
41
42  puts( "Init - attempt to open the /dev/test RD mode -- OK" );
43  fdr = open( "/dev/test", O_RDONLY );
44  rtems_test_assert( fdr != -1 );
45
46  puts( "Init - attempt to read from /dev/test - expect ENOSYS" );
47  status = read( fdr, buf, 10 );
48  rtems_test_assert( status == -1 );
49  rtems_test_assert( errno == ENOSYS );
50
51  puts( "Init - attempt ioctl on the device - expect ENOSYS" );
52  status = ioctl( fdr, -1 );
53  rtems_test_assert( status == -1 );
54  rtems_test_assert( errno == ENOSYS );
55
56  puts( "*** END OF TEST DEVICEIO - 01 ***" );
57  rtems_test_exit(0);
58}
59
60/* configuration information */
61
62#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
63#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
64#define CONFIGURE_APPLICATION_EXTRA_DRIVERS TEST_DRIVER_TABLE_ENTRY
65
66/* include an extra slot for registering the termios one dynamically */
67#define CONFIGURE_MAXIMUM_DRIVERS 3
68
69#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 5
70
71#define CONFIGURE_MAXIMUM_TASKS             1
72#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
73
74#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
75
76#define CONFIGURE_INIT
77#include <rtems/confdefs.h>
78/* end of file */
Note: See TracBrowser for help on using the repository browser.