alsa.audio: add debug logs
[AROS.git] / test / clib / open.c
blob4cf79c810d4a0c8d202fda44cee473f4fa5a45a8
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <sys/types.h>
7 #include <stdio.h>
8 #include <unistd.h>
9 #include <fcntl.h>
10 #include "test.h"
12 #define FIFO1 "T:fifo1"
13 #define FIFO2 "T:fifo2"
15 int f1filedesc[2];
16 int f2filedesc[2];
18 int main()
20 int tmpfd;
22 f1filedesc[0] = f1filedesc[1] = -1;
24 tmpfd = open(FIFO1, O_RDWR | O_CREAT);
25 TEST((tmpfd >= 0));
26 close(tmpfd);
28 f1filedesc[1] = open(FIFO1, O_WRONLY);
29 f1filedesc[0] = open(FIFO1, O_RDONLY);
31 TEST((f1filedesc[1] >= 0));
32 TEST((f1filedesc[0] >= 0));
34 f2filedesc[0] = f2filedesc[1] = -1;
36 f2filedesc[1] = open(FIFO2, O_WRONLY | O_CREAT, 0644);
37 f2filedesc[0] = open(FIFO2, O_RDONLY);
39 TEST((f2filedesc[1] >= 0));
40 TEST((f2filedesc[0] >= 0));
42 cleanup();
44 return OK;
47 void cleanup()
49 if (f1filedesc[1] >= 0) close(f1filedesc[1]);
50 if (f1filedesc[0] >= 0) close(f1filedesc[0]);
51 if (f2filedesc[1] >= 0) close(f2filedesc[1]);
52 if (f2filedesc[0] >= 0) close(f2filedesc[0]);
53 remove(FIFO1);
54 remove(FIFO2);