source: rtems/testsuites/sptests/spfifo02/init.c @ 7d1a2437

4.11
Last change on this file since 7d1a2437 was 7d1a2437, checked in by Joel Sherrill <joel.sherrill@…>, on Jun 20, 2010 at 10:02:24 PM

2010-06-20 Joel Sherrill <joel.sherrill@…>

  • spfifo02/init.c, spfifo03/init.c, spfifo04/init.c: Configure pipes used.
  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 *  COPYRIGHT (c) 2010
3 *  Bharath Suri<bharath.s.jois@gmail.com>.
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/* Includes */
13#include <bsp.h>
14#include <tmacros.h>
15
16/* Includes */
17#include <stdio.h>
18#include <sys/types.h>
19#include <sys/stat.h>
20#include <fcntl.h>
21#include <unistd.h>
22#include <errno.h>
23
24#include <rtems.h>
25#include <rtems/libio.h>
26
27
28void test_main(void)
29{
30
31  int status = -1;
32  int fd = 0;
33
34  puts("\n\n*** FIFO / PIPE OPEN TEST - 2 ***");
35  puts(
36"\n\nConfiguration: Pipes configured, \
37but number of barriers configured = 0"
38       );
39
40  puts("\n\nCreating directory /tmp");
41  status = mkdir("/tmp", 0777);
42  rtems_test_assert(status == 0);
43
44  puts("\n\nCreating fifo /tmp/fifo");
45  status = mkfifo("/tmp/fifo01", 0777);
46  rtems_test_assert(status == 0);
47
48  puts("\n\nAttempt to open the fifo file\n");
49  puts(
50"Must result in failure since \n\
51number of barriers = 0 => not all resources\n\
52were acquired"
53       );
54
55  fd = open("/tmp/fifo01", O_RDONLY);
56  rtems_test_assert(fd == -1);
57  rtems_test_assert(errno == EINTR); // Should this
58                                     // be ENOMEM?
59  puts("\n\nRemove the entry /tmp/fifo01");
60  status = unlink("/tmp/fifo01");
61  rtems_test_assert(status == 0);
62
63  puts("\n\nRemove directory /tmp");
64  status = rmdir("/tmp");
65  rtems_test_assert(status == 0);
66
67  puts("\n\n*** END OF FIFO / PIPE OPEN TEST - 2 ***");
68}
69 
70rtems_task Init(
71  rtems_task_argument not_used
72)
73{
74  test_main();
75  rtems_test_exit(0);
76}
77
78#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
79#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
80
81#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
82#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 6
83
84#define CONFIGURE_PIPES_ENABLED
85#define CONFIGURE_MAXIMUM_PIPES 1
86#define CONFIGURE_MAXIMUM_TASKS 1
87
88#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
89#define CONFIGURE_INIT
90
91#include <rtems/confdefs.h>
92
93/* end of file */
Note: See TracBrowser for help on using the repository browser.