alsa.audio: add debug logs
[AROS.git] / test / clib / chdir.c
blob595f0d3f1c1a15f3ac2c5a34da3eb3e66f4108cf
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/dos.h>
7 #include <dos/dos.h>
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include <unistd.h>
12 #include "test.h"
14 BPTR lockin = BNULL, lockout = BNULL;
16 int main()
18 char *pathin, *pathout = NULL;
20 pathin = "SYS:";
21 TEST( (lockin = Lock( pathin, SHARED_LOCK )) != BNULL );
22 TEST( chdir( pathin ) == 0 );
23 pathout = getcwd( NULL, 0 );
24 TEST( (lockout = Lock( pathin, SHARED_LOCK )) != BNULL );
25 TEST( SameLock( lockin, lockout ) == LOCK_SAME );
26 free( pathout ); pathout = NULL;
27 UnLock( lockin ); lockin = BNULL;
28 UnLock( lockout ); lockout = BNULL;
30 pathin = "SYS:Tools";
31 TEST( (lockin = Lock( pathin, SHARED_LOCK )) != BNULL );
32 TEST( chdir( pathin ) == 0 );
33 pathout = getcwd( NULL, 0 );
34 TEST( (lockout = Lock( pathin, SHARED_LOCK )) != BNULL );
35 TEST( SameLock( lockin, lockout ) == LOCK_SAME );
36 free( pathout ); pathout = NULL;
37 UnLock( lockin ); lockin = BNULL;
38 UnLock( lockout ); lockout = BNULL;
40 return OK;
43 void cleanup()
45 if ( lockin != BNULL )
46 UnLock( lockin );
47 if ( lockout != BNULL )
48 UnLock( lockout );