]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dlopen-signing.dtest/main.c
1 // BUILD: $CC dylib.c -dynamiclib -o $BUILD_DIR/signed.dylib
2 // BUILD: $CC dylib.c -dynamiclib -o $BUILD_DIR/unsigned.dylib
3 // BUILD: $CC main.c -o $BUILD_DIR/dlopen-signed.exe
4 // BUILD: $CC main.c -o $BUILD_DIR/dlopen-unsigned.exe
6 // FIXME: add builds that sign the executable and the dylib in in various ways
7 // At this time we don't have a way to do that, so this test must be run
14 printf("[BEGIN] dlopen-signing\n");
15 void* handle
= dlopen("signed.dylib", RTLD_LAZY
);
16 if ( handle
== NULL
) {
17 printf("dlerror(): %s\n", dlerror());
18 printf("[FAIL] dlopen-signing (signed loading signed)\n");
21 int result
= dlclose(handle
);
23 printf("dlclose() returned %c\n", result
);
24 printf("[FAIL] dlopen-signing (signed unloading signed)\n");
29 handle
= dlopen("unsigned.dylib", RTLD_LAZY
);
30 if ( handle
!= NULL
) {
31 printf("dlerror(): %s\n", dlerror());
32 printf("[FAIL] dlopen-signing (signed loading unsigned)\n");
35 int result
= dlclose(handle
);
37 printf("dlclose() returned %c\n", result
);
38 printf("[FAIL] dlopen-signing (signed unloading signed)\n");
43 printf("[PASS] dlopen-signing\n");