source: rtems/testsuites/sptests/spfifo02/test.c @ cfde6479

4.115
Last change on this file since cfde6479 was cfde6479, checked in by Jennifer Averett <Jennifer.Averett@…>, on Jun 7, 2010 at 7:09:28 PM

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

PR PR1542

  • Makefile.am, configure.ac: Coverage improvement: fifo_open.
  • spfifo01/spfifo01.doc, spfifo01/spfifo01.scn, spfifo01/test.c, spfifo02/Makefile.am, spfifo02/main.c, spfifo02/spfifo02.doc, spfifo02/spfifo02.scn, spfifo02/test.c, spfifo03/Makefile.am, spfifo03/main.c, spfifo03/spfifo03.doc, spfifo03/spfifo03.scn, spfifo03/test.c, spfifo04/Makefile.am, spfifo04/main.c, spfifo04/spfifo04.doc, spfifo04/spfifo04.scn, spfifo04/test.c: New files.
  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*  test_main
2 *
3 *  This routine serves as a test routine.
4 *  Exercises the fifo_open
5 *
6 *  Input parameters:   NONE
7 *
8 *  Output parameters:  NONE
9 *
10 *  COPYRIGHT (c) 1989-1999.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.com/license/LICENSE.
16 *
17 *  $Id$
18 */
19
20/* Includes */
21
22#include <stdio.h>
23#include <sys/types.h>
24#include <sys/stat.h>
25#include <fcntl.h>
26#include <unistd.h>
27#include <errno.h>
28
29#include <tmacros.h>
30#include <rtems.h>
31#include <rtems/libio.h>
32
33
34void test_main(void)
35{
36
37  int status = -1;
38  int fd = 0;
39
40  puts("\n\n*** FIFO / PIPE OPEN TEST - 2 ***");
41  puts(
42"\n\nConfiguration: Pipes configured, \
43but number of barriers configured = 0"
44       );
45
46  puts("\n\nCreating directory /tmp");
47  status = mkdir("/tmp", 0777);
48  rtems_test_assert(status == 0);
49
50  puts("\n\nCreating fifo /tmp/fifo");
51  status = mkfifo("/tmp/fifo01", 0777);
52  rtems_test_assert(status == 0);
53
54  puts("\n\nAttempt to open the fifo file\n");
55  puts(
56"Must result in failure since \n\
57number of barriers = 0 => not all resources\n\
58were acquired"
59       );
60
61  fd = open("/tmp/fifo01", O_RDONLY);
62  rtems_test_assert(fd == -1);
63  rtems_test_assert(errno == EINTR); // Should this
64                                     // be ENOMEM?
65  puts("\n\nRemove the entry /tmp/fifo01");
66  status = unlink("/tmp/fifo01");
67  rtems_test_assert(status == 0);
68
69  puts("\n\nRemove directory /tmp");
70  status = rmdir("/tmp");
71  rtems_test_assert(status == 0);
72
73  puts("\n\n*** END OF FIFO / PIPE OPEN TEST - 2 ***");
74}
75 
Note: See TracBrowser for help on using the repository browser.