]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/env-DYLD_FRAMEWORK_PATH.dtest/main.c
8a2b4f659456f603223a7a9ff1bd0f8fe2c29b87
[apple/dyld.git] / testing / test-cases / env-DYLD_FRAMEWORK_PATH.dtest / main.c
1
2 // BUILD: mkdir -p $BUILD_DIR/Frameworks/Foo.framework $BUILD_DIR/Frameworks-alt/Foo.framework
3 // BUILD: $CC foo.c -dynamiclib -o $BUILD_DIR/Frameworks/Foo.framework/Foo -install_name $RUN_DIR/Frameworks/Foo.framework/Foo -DVALUE=1
4 // BUILD: $CC foo.c -dynamiclib -o $BUILD_DIR/Frameworks-alt/Foo.framework/Foo -install_name $RUN_DIR/Frameworks/Foo.framework/Foo -DVALUE=42
5 // BUILD: $CC main.c -o $BUILD_DIR/env-DYLD_FRAMEWORK_PATH.exe $BUILD_DIR/Frameworks/Foo.framework/Foo
6 // BUILD: $DYLD_ENV_VARS_ENABLE $BUILD_DIR/env-DYLD_FRAMEWORK_PATH.exe
7
8 // RUN: ./env-DYLD_FRAMEWORK_PATH.exe
9 // RUN: DYLD_FRAMEWORK_PATH=$RUN_DIR/Frameworks-alt/ ./env-DYLD_FRAMEWORK_PATH.exe
10
11 #include <stdio.h>
12 #include <stdlib.h>
13
14 extern int foo();
15
16 int main()
17 {
18 int expected = (getenv("DYLD_FRAMEWORK_PATH") != NULL) ? 42 : 1;
19
20 printf("[BEGIN] env-DYLD_FRAMEWORK_PATH, expect %d\n", expected);
21
22 if ( foo() == expected )
23 printf("[PASS] env-DYLD_FRAMEWORK_PATH\n");
24 else
25 printf("[FAIL] env-DYLD_FRAMEWORK_PATH\n");
26
27 return 0;
28 }
29