]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/_dyld_shared_cache_real_path.dtest/main.c
2 // BUILD: $CC main.c -o $BUILD_DIR/_dyld_shared_cache_real_path.exe
4 // RUN: ./_dyld_shared_cache_real_path.exe
9 #include <mach-o/dyld_priv.h>
12 #include "test_support.h"
14 int main(int argc
, const char* argv
[], const char* envp
[], const char* apple
[])
17 bool hasCache
= ( _dyld_get_shared_cache_range(&length
) != NULL
);
19 const char* path
= _dyld_shared_cache_real_path("/usr/lib/libSystem.dylib");
21 FAIL("libSystem.dylib is not in dyld cache");
22 else if ( strcmp(path
, "/usr/lib/libSystem.B.dylib") != 0 )
23 FAIL("libSystem.B.dylib != %s", path
);
27 path
= _dyld_shared_cache_real_path("/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation");
29 FAIL("Foundation is not in dyld cache");
30 else if ( strcmp(path
, "/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation") != 0 )
31 FAIL("Foundation != %s", path
);
33 // symlink inside the shared cache
34 path
= _dyld_shared_cache_real_path("/System/Library/Frameworks/Foundation.framework/Foundation");
36 FAIL("Foundation is not in dyld cache");
37 else if ( strcmp(path
, "/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation") != 0 )
38 FAIL("Foundation != %s", path
);
40 // symlink not in the shared cache (as we don't handle directory symlinks today)
41 path
= _dyld_shared_cache_real_path("/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation");
43 FAIL("Foundation is not in dyld cache");
44 else if ( strcmp(path
, "/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation") != 0 )
45 FAIL("Foundation != %s", path
);
48 const char* path
= _dyld_shared_cache_real_path("/usr/lib/libSystem.B.dylib");
50 FAIL("no cache, but libSystem.B.dylib is in dyld cache");
56 FAIL("libSystem.B.dylib is not in dyld cache");
58 FAIL("no cache, but libSystem.B.dylib is in dyld cache");
61 if ( _dyld_shared_cache_real_path("/System/Library/Frameworks/Foundation.framework/Foundation") != hasCache
) {
63 FAIL("Foundation.framework is not in dyld cache");
65 FAIL("no cache, but Foundation.framework is in dyld cache");
69 if ( _dyld_shared_cache_real_path("/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation") != hasCache
) {
71 FAIL("Current/Foundation.framework is not in dyld cache");
73 FAIL("no cache, but Current/Foundation.framework is in dyld cache");