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