]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/_dyld_get_image_name-cache-symlink.dtest/main.c
2 // BUILD: $CC foo.c -dynamiclib -install_name /System/Library/Frameworks/IOKit.framework/IOKit -o $BUILD_DIR/libfoo.dylib
3 // BUILD: $CC main.c -o $BUILD_DIR/_dyld_get_image_name-cache-symlink.exe $BUILD_DIR/libfoo.dylib
5 // RUN: DYLD_LIBRARY_PATH=/usr/lib/system/introspection ./_dyld_get_image_name-cache-symlink.exe
11 #include <mach-o/dyld.h>
12 #include <mach-o/dyld_priv.h>
14 #include "test_support.h"
16 int main(int argc
, const char* argv
[], const char* envp
[], const char* apple
[]) {
17 // walk images to see if path was converted to real path
18 const char* foundPath
= NULL
;
19 int count
= _dyld_image_count();
20 for (int i
=0; i
< count
; ++i
) {
21 const char* path
= _dyld_get_image_name(i
);
22 LOG("path[%2d]=%s", i
, path
);
23 if ( strstr(path
, "/IOKit") != NULL
) {
24 if ( foundPath
== NULL
) {
28 FAIL("More than one libfoo found");
32 if ( foundPath
== NULL
) {
33 FAIL("No IOKit found");
35 if ( strcmp(foundPath
, "/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit") != 0 ) {
36 FAIL("Path is symlink not real path: %s", foundPath
);