Tests/Partition: Compiler delinit
[AROS.git] / test / clib / chdir.c
blob8db786e7fab20b18a2155b0b938f6a426348d243
1 #include <proto/dos.h>
2 #include <dos/dos.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
6 #include <unistd.h>
7 #include "test.h"
9 BPTR lockin = BNULL, lockout = BNULL;
11 int main()
13 char *pathin, *pathout = NULL;
15 pathin = "SYS:";
16 TEST( (lockin = Lock( pathin, SHARED_LOCK )) != BNULL );
17 TEST( chdir( pathin ) == 0 );
18 pathout = getcwd( NULL, 0 );
19 TEST( (lockout = Lock( pathin, SHARED_LOCK )) != BNULL );
20 TEST( SameLock( lockin, lockout ) == LOCK_SAME );
21 free( pathout ); pathout = NULL;
22 UnLock( lockin ); lockin = BNULL;
23 UnLock( lockout ); lockout = BNULL;
25 pathin = "SYS:Tools";
26 TEST( (lockin = Lock( pathin, SHARED_LOCK )) != BNULL );
27 TEST( chdir( pathin ) == 0 );
28 pathout = getcwd( NULL, 0 );
29 TEST( (lockout = Lock( pathin, SHARED_LOCK )) != BNULL );
30 TEST( SameLock( lockin, lockout ) == LOCK_SAME );
31 free( pathout ); pathout = NULL;
32 UnLock( lockin ); lockin = BNULL;
33 UnLock( lockout ); lockout = BNULL;
35 return OK;
38 void cleanup()
40 if ( lockin != BNULL )
41 UnLock( lockin );
42 if ( lockout != BNULL )
43 UnLock( lockout );