]> git.saurik.com Git - apple/dyld.git/blobdiff - unit-tests/test-cases/insert-libraries-with-suid/Makefile
dyld-851.27.tar.gz
[apple/dyld.git] / unit-tests / test-cases / insert-libraries-with-suid / Makefile
index 7e6ad2ab1d58314b7f0cd73148b6b4134e2edc2d..c06cad5f7f5324eaa8e2c13fcfcc9668f1cf16c7 100644 (file)
@@ -1,5 +1,5 @@
 ##
 ##
-# Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+# Copyright (c) 2005-2009 Apple Inc. All rights reserved.
 #
 # @APPLE_LICENSE_HEADER_START@
 # 
 #
 # @APPLE_LICENSE_HEADER_START@
 # 
 TESTROOT = ../..
 include ${TESTROOT}/include/common.makefile
 
 TESTROOT = ../..
 include ${TESTROOT}/include/common.makefile
 
-run: all
-       export DYLD_INSERT_LIBRARIES="/usr/lib/libldap.dylib:/usr/lib/libpcap.dylib" && ./main
+SHELL = bash # use bash shell so we can redirect just stderr
+
+PWD = `pwd`
+
+ifeq "$(OS_NAME)" "iPhoneOS"
+       RUN_AS_USER = login -f -l mobile
+else
+       RUN_AS_USER = 
+endif
+
+all-check: all check
+
+check:
+       ${RUN_AS_USER} $(PWD)/main-with-env insert-libraries-with-suid 2>/dev/null
 
 all: main
 
 
 all: main
 
@@ -32,7 +44,11 @@ main: main.c
        ${CC} ${CCFLAGS} -I${TESTROOT}/include -o main main.c
        sudo chown root main
        sudo chmod 4755 main
        ${CC} ${CCFLAGS} -I${TESTROOT}/include -o main main.c
        sudo chown root main
        sudo chmod 4755 main
+       echo "#!/bin/sh" > main-with-env
+       echo "export DYLD_INSERT_LIBRARIES=/usr/lib/libz.dylib" >> main-with-env
+       echo "$(PWD)/main" >> main-with-env
+       chmod +x main-with-env
 
 clean:
 
 clean:
-       ${RM} ${RMFLAGS} *~ main
+       ${RM} ${RMFLAGS} *~ main main-with-env