mesa: simplify dependencies in mmakefiles
[AROS.git] / test / clib / chmod.c
blobc96c538b96acdd492c014bdbcb4c8f8e2b547f17
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <sys/stat.h>
7 #include <sys/types.h>
8 #include <unistd.h>
9 #include <fcntl.h>
10 #include <stdio.h>
11 #include "test.h"
13 char testfilename[] = "RAM:__TEST__";
15 int main()
17 struct stat buf;
18 int fd;
19 fd = creat(testfilename, 0700);
20 TEST((fd != -1));
21 close(fd);
22 TEST((stat(testfilename, &buf) != -1));
23 TEST(((buf.st_mode & 0777) == 0700));
24 TEST((chmod(testfilename, 0111) != -1));
25 TEST((stat(testfilename, &buf) != -1));
26 TEST(((buf.st_mode & 0777) == 0111));
27 TEST((chmod(testfilename, 0222) != -1));
28 TEST((stat(testfilename, &buf) != -1));
29 TEST(((buf.st_mode & 0777) == 0222));
30 TEST((chmod(testfilename, 0333) != -1));
31 TEST((stat(testfilename, &buf) != -1));
32 TEST(((buf.st_mode & 0777) == 0333));
33 TEST((chmod(testfilename, 0444) != -1));
34 TEST((stat(testfilename, &buf) != -1));
35 TEST(((buf.st_mode & 0777) == 0444));
36 TEST((chmod(testfilename, 0555) != -1));
37 TEST((stat(testfilename, &buf) != -1));
38 TEST(((buf.st_mode & 0777) == 0555));
39 TEST((chmod(testfilename, 0666) != -1));
40 TEST((stat(testfilename, &buf) != -1));
41 TEST(((buf.st_mode & 0777) == 0666));
42 TEST((chmod(testfilename, 0777) != -1));
43 TEST((stat(testfilename, &buf) != -1));
44 TEST(((buf.st_mode & 0777) == 0777));
45 cleanup();
46 return OK;
49 void cleanup()
51 remove(testfilename);