]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/no-shared-cache.dtest/main.c
940774096880aed7d612c1c71fbe4507e7a4d13e
[apple/dyld.git] / testing / test-cases / no-shared-cache.dtest / main.c
1 // BUILD_ONLY: MacOSX
2
3 // BUILD: $CC main.c -framework AppKit -o $BUILD_DIR/no_shared_cache.exe
4
5 // RUN: DYLD_SHARED_REGION=avoid ./no_shared_cache.exe
6
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <string.h>
10 #include <mach-o/dyld_priv.h>
11 #include <dlfcn.h>
12
13
14 // This program links with AppKit which in dyld3 mode stress tests building closures when there is no dyld shared cache
15
16 int main()
17 {
18 printf("[BEGIN] no-shared-cache\n");
19
20 size_t cacheLen;
21 const void* cacheStart = _dyld_get_shared_cache_range(&cacheLen);
22
23 if ( cacheStart != NULL ) {
24 printf("[FAIL] no-shared-cache: _dyld_get_shared_cache_range() returned %p even though we are not using a dyld cache\n", cacheStart);
25 return 0;
26 }
27
28 printf("[PASS] no-shared-cache\n");
29 return 0;
30 }
31