source: rtems/testsuites/sptests/spfifo01/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: 1.9 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 - 1 ***");
33  puts(
34"\n\nConfiguration: Pipes not enabled"
35       );
36
37  puts("\n\nCreating directory /tmp");
38  status = mkdir("/tmp", 0777);
39  rtems_test_assert(status == 0);
40
41  puts("\n\nCreating fifo /tmp/fifo");
42  status = mkfifo("/tmp/fifo01", 0777);
43  rtems_test_assert(status == 0);
44
45  puts("\n\nAttempt to open the fifo file\n");
46  puts(
47       "Must result in failure since \
48pipes are not enabled in the configuration"
49       );
50
51  fd = open("/tmp/fifo01", O_RDONLY);
52  rtems_test_assert(fd == -1);
53  rtems_test_assert(errno == EINTR); // Should this
54                                     // be ENOMEM?
55  puts("\n\nRemove the entry /tmp/fifo01");
56  status = unlink("/tmp/fifo01");
57  rtems_test_assert(status == 0);
58
59  puts("\n\nRemove directory /tmp");
60  status = rmdir("/tmp");
61  rtems_test_assert(status == 0);
62
63  puts("\n\n*** END OF FIFO / PIPE OPEN TEST - 1 ***");
64}
65 
66
67rtems_task Init(
68  rtems_task_argument not_used
69)
70{
71  test_main();
72  rtems_test_exit(0);
73}
74
75#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
76#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
77
78#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
79#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 6
80
81#define CONFIGURE_MAXIMUM_TASKS 1
82
83#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
84
85#define CONFIGURE_INIT
86
87#include <rtems/confdefs.h>
88
89/* end of file */
Note: See TracBrowser for help on using the repository browser.