3 // BUILD: $CC main.c -o $BUILD_DIR/NSAddImage-fail.exe -Wno-deprecated-declarations
5 // RUN: ./NSAddImage-fail.exe return
6 // RUN: NOCR_TEST_NAME="NSAddImage-fail expected abort" $REQUIRE_CRASH ./NSAddImage-fail.exe abort
13 #include <mach-o/dyld.h>
16 int main(int argc
, const char* argv
[])
18 const char* arg
= argv
[1];
20 if ( strcmp(arg
, "return") == 0 ) {
21 printf("[BEGIN] NSAddImage-fail %s\n", arg
);
22 const struct mach_header
* mh
= NSAddImage("/xqz/42/libnotfound.xxx", NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED
);
24 printf("[PASS] NSAddImage-fail %s\n", arg
);
26 printf("[FAIL] NSAddImage-fail %s\n", arg
);
29 // run with nocr which print BEGIN/PASS/FAIL
30 NSAddImage("/xqz/42/libnotfound.xxx", 0);