]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dlopen-long-error-message.dtest/main.c
8b0a16aff74c9f086a78d2510ac5c6ff86c638c7
[apple/dyld.git] / testing / test-cases / dlopen-long-error-message.dtest / main.c
1
2 // BUILD: $CC main.c -o $BUILD_DIR/dlopen-long-error-message.exe
3
4 // RUN: ./dlopen-long-error-message.exe
5
6 #include <stdio.h>
7 #include <dlfcn.h>
8 #include <string.h>
9 #include <stdlib.h>
10
11
12
13 int main()
14 {
15 printf("[BEGIN] dlopen-long-error-message\n");
16
17 for (int i=0; i < 10; ++i) {
18 void* handle = dlopen("/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/bogus/path/libbogus.dylib", RTLD_FIRST);
19 if ( handle != NULL ) {
20 printf("[FAIL] dlopen-long-error-message should have failed on non-existent file\n");
21 return 0;
22 }
23 free(strdup("hello there"));
24 }
25
26 printf("[PASS] dlopen-long-error-message\n");
27
28 return 0;
29 }
30