]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/env-DYLD_FRAMEWORK_PATH.dtest/main.c
dyld-851.27.tar.gz
[apple/dyld.git] / testing / test-cases / env-DYLD_FRAMEWORK_PATH.dtest / main.c
1
2 // BUILD: $CC foo.c -dynamiclib -o $BUILD_DIR/Frameworks/Foo.framework/Foo -install_name $RUN_DIR/Frameworks/Foo.framework/Foo -DVALUE=1
3 // BUILD: $CC foo.c -dynamiclib -o $BUILD_DIR/Frameworks-alt/Foo.framework/Foo -install_name $RUN_DIR/Frameworks/Foo.framework/Foo -DVALUE=42
4 // BUILD: $CC main.c -o $BUILD_DIR/env-DYLD_FRAMEWORK_PATH.exe $BUILD_DIR/Frameworks/Foo.framework/Foo
5 // BUILD: $DYLD_ENV_VARS_ENABLE $BUILD_DIR/env-DYLD_FRAMEWORK_PATH.exe
6
7 // RUN: ./env-DYLD_FRAMEWORK_PATH.exe
8 // RUN: DYLD_FRAMEWORK_PATH=$RUN_DIR/Frameworks-alt/ ./env-DYLD_FRAMEWORK_PATH.exe
9
10 #include <stdio.h>
11 #include <stdlib.h>
12
13 #include "test_support.h"
14
15 extern int foo();
16
17 int main(int argc, const char* argv[], const char* envp[], const char* apple[]) {
18 int expected = (getenv("DYLD_FRAMEWORK_PATH") != NULL) ? 42 : 1;
19
20 if ( foo() == expected )
21 PASS("Success");
22 else
23 FAIL("Incorrect libfoo.dylib loaded");
24 }
25