Added options to disable vbr move and copymem patches.
[AROS.git] / test / clib / fchdir.c
blob3301cd4e9f271659ef3b001ff8973e1a6da13245
1 #include <unistd.h>
2 #include <stdio.h>
3 #include <fcntl.h>
4 #include <string.h>
5 #include <errno.h>
6 #include <proto/dos.h>
7 #include "test.h"
9 int fd = -1;
11 int main()
13 char path1[256];
14 char path2[256];
16 /* First something simple */
17 TEST((chdir("SYS:") != -1));
18 TEST((getcwd(path1, sizeof(path1)) != (char*) -1));
19 TEST(((fd = open("SYS:", 0)) != -1));
20 TEST((fchdir(fd) != -1));
21 close(fd); fd = -1;
22 TEST((getcwd(path2, sizeof(path2)) != (char*) -1));
23 printf("Comparing paths: %s and %s\n", path1, path2);
24 TEST((strcmp(path1, path2) == 0));
26 /* Now more complicated case */
27 TEST((mkdir("T:__TEST__", 0777) != -1));
29 TEST((chdir("T:__TEST__") != -1));
30 TEST((getcwd(path1, sizeof(path1)) != (char*) -1));
31 TEST(((fd = open("T:__TEST__", 0)) != -1));
32 TEST((fchdir(fd) != -1));
33 close(fd); fd = -1;
34 TEST((getcwd(path2, sizeof(path2)) != (char*) -1));
35 printf("Comparing paths: %s and %s\n", path1, path2);
36 TEST((strcmp(path1, path2) == 0));
38 /* Test directory is going to disappear soon, evacuate! */
39 TEST((chdir("SYS:") != -1));
41 cleanup();
42 return OK;
45 void cleanup()
47 if(fd != -1)
48 close(fd);
50 DeleteFile("T:__TEST__");