source: rtems/testsuites/sptests/spfifo02/init.c @ f94344f

4.115
Last change on this file since f94344f was f94344f, checked in by Jennifer Averett <Jennifer.Averett@…>, on 06/08/10 at 13:59:17

2010-06-08 Jennifer Averett <Jennifer.Averett@…>

  • spfifo01/Makefile.am, spfifo02/Makefile.am, spfifo03/Makefile.am, spfifo04/Makefile.am: Merged fifo main and test files into the standard init file. Fixed copyright information.
  • spfifo01/init.c, spfifo02/init.c, spfifo03/init.c, spfifo04/init.c: New files.
  • spfifo01/main.c, spfifo01/test.c, spfifo02/main.c, spfifo02/test.c, spfifo03/main.c, spfifo03/test.c, spfifo04/main.c, spfifo04/test.c: Removed.
  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[f94344f]1/*
2 *  COPYRIGHT (c) 1989-2010.
[cfde6479]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/* Includes */
[f94344f]13#include <bsp.h>
14#include <tmacros.h>
[cfde6479]15
[f94344f]16/* Includes */
[cfde6479]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 
[f94344f]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_MAXIMUM_TASKS 1
85
86#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
87#define CONFIGURE_PIPES_ENABLED
88#define CONFIGURE_INIT
89
90#include <rtems/confdefs.h>
91
92/* end of file */
Note: See TracBrowser for help on using the repository browser.