]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/env-DYLD_LIBRARY_PATH-cache.dtest/main.c
2 // BUILD: $CC myzlib.c -dynamiclib -o $BUILD_DIR/override/libz.1.dylib -install_name /usr/lib/libz.1.dylib -compatibility_version 1.0 -framework CoreFoundation
3 // BUILD: $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
4 // BUILD: $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
5 // BUILD: $CC main.c -o $BUILD_DIR/env-DYLD_LIBRARY_PATH-cache.exe -lz
6 // BUILD: $DYLD_ENV_VARS_ENABLE $BUILD_DIR/env-DYLD_LIBRARY_PATH-cache.exe
8 // RUN: ./env-DYLD_LIBRARY_PATH-cache.exe
9 // RUN: DYLD_LIBRARY_PATH=$RUN_DIR/override/ ./env-DYLD_LIBRARY_PATH-cache.exe
10 // RUN: DYLD_LIBRARY_PATH=$RUN_DIR/re-export-override/ ./env-DYLD_LIBRARY_PATH-cache.exe
17 #include <mach-o/dyld_priv.h>
19 #include "test_support.h"
21 // The test here is to override libz.1.dylib which is in the dyld cache with our own implementation.
23 int main(int argc
, const char* argv
[], const char* envp
[], const char* apple
[]) {
24 bool expectMyDylib
= (getenv("DYLD_LIBRARY_PATH") != NULL
) && !_dyld_shared_cache_optimized();
26 bool usingMyDylib
= (strcmp(zlibVersion(), "my") == 0);
28 if ( usingMyDylib
== expectMyDylib
)
31 FAIL("Expected %s, got %s", expectMyDylib
? "my" : "os", expectMyDylib
? "os" : "my");