]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/env-DYLD_LIBRARY_PATH-cache-iOSMac.dtest/main.c
1 // BUILD(macos): $CC myzlib.c -dynamiclib -o $BUILD_DIR/override/libz.1.dylib -install_name /usr/lib/libz.1.dylib -compatibility_version 1.0 -framework CoreFoundation -target x86_64-apple-macos10.16 -target-variant x86_64-apple-ios14.0-macabi
2 // BUILD(macos): $CC reexported-myzlib.c -dynamiclib -o $BUILD_DIR/re-export-override/reexported.dylib -compatibility_version 1.0 -framework CoreFoundation -install_name $RUN_DIR/re-export-override/reexported.dylib -target x86_64-apple-macos10.16 -target-variant x86_64-apple-ios14.0-macabi
3 // BUILD(macos): $CC reexporter.c -dynamiclib -o $BUILD_DIR/re-export-override/libz.1.dylib -install_name /usr/lib/libz.1.dylib -compatibility_version 1.0 -Wl,-reexport_library,$BUILD_DIR/re-export-override/reexported.dylib -Wl,-debug_variant -target x86_64-apple-macos10.16 -target-variant x86_64-apple-ios14.0-macabi
4 // BUILD(macos): $CC main.c -o $BUILD_DIR/env-DYLD_LIBRARY_PATH-cache-iOSMac.exe -lz -target x86_64-apple-ios14.0-macabi
5 // BUILD(macos): $DYLD_ENV_VARS_ENABLE $BUILD_DIR/env-DYLD_LIBRARY_PATH-cache-iOSMac.exe
7 // BUILD(ios,tvos,watchos,bridgeos):
9 // RUN: ./env-DYLD_LIBRARY_PATH-cache-iOSMac.exe
10 // RUN: DYLD_LIBRARY_PATH=$RUN_DIR/override/ ./env-DYLD_LIBRARY_PATH-cache-iOSMac.exe
11 // RUN: DYLD_LIBRARY_PATH=$RUN_DIR/re-export-override/ ./env-DYLD_LIBRARY_PATH-cache-iOSMac.exe
18 #include <mach-o/dyld_priv.h>
20 #include "test_support.h"
22 // The test here is to override libz.1.dylib which is in the dyld cache with our own implementation.
24 int main(int argc
, const char* argv
[], const char* envp
[], const char* apple
[]) {
25 bool expectMyDylib
= (getenv("DYLD_LIBRARY_PATH") != NULL
) && !_dyld_shared_cache_optimized();
27 bool usingMyDylib
= (strcmp(zlibVersion(), "my") == 0);
29 if ( usingMyDylib
== expectMyDylib
)
32 FAIL("Expected %s, got %s", expectMyDylib
? "my" : "os", expectMyDylib
? "os" : "my");