Permalink
Browse files

Merge branch 'master' into approved-image-color

  • Loading branch information...
x2on committed Jul 16, 2012
2 parents b14a639 + 8bcf71f commit b16880682fb3d4031a9d5def09a1730008ca9ed9
@@ -2,7 +2,7 @@
To run the tests from the command line:
-- Copy the [RunTests.sh](http://github.com/gabriel/gh-unit/tree/master/Scripts/RunTests.sh) file into your project in the same directory as the xcodeproj file.
+- Copy [RunTests.sh](http://github.com/gabriel/gh-unit/tree/master/Scripts/RunTests.sh) and [RunIPhoneSecurityd.sh](http://github.com/gabriel/gh-unit/tree/master/Scripts/RunIPhoneSecurityd.sh) into your project in the same directory as the xcodeproj file.
- In the Tests target, Build Phases, Select Add Build Phase + button, and select Add Run Script.
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+set -u
+
+export DYLD_ROOT_PATH="$1"
+export IPHONE_SIMULATOR_ROOT="$1"
+export CFFIXED_USER_HOME="$2"
+
+"$IPHONE_SIMULATOR_ROOT"/usr/libexec/securityd
View
@@ -8,6 +8,13 @@ fi
export DYLD_ROOT_PATH="$SDKROOT"
export DYLD_FRAMEWORK_PATH="$CONFIGURATION_BUILD_DIR"
export IPHONE_SIMULATOR_ROOT="$SDKROOT"
+export CFFIXED_USER_HOME="$TEMP_FILES_DIR/iPhone Simulator User Dir" # Be compatible with google-toolbox-for-mac
+
+# Always reset CFFIXED_USER_HOME
+if [ -d $"CFFIXED_USER_HOME" ]; then
+ rm -rf "$CFFIXED_USER_HOME"
+fi
+mkdir -p "$CFFIXED_USER_HOME"
export NSDebugEnabled=YES
export NSZombieEnabled=YES
@@ -30,6 +37,12 @@ if [ ! -e "$TEST_TARGET_EXECUTABLE_PATH" ]; then
exit 1
fi
+# If trapping fails, make sure we kill any running securityd
+launchctl list | grep GHUNIT_RunIPhoneSecurityd && launchctl remove GHUNIT_RunIPhoneSecurityd
+SCRIPTS_PATH=`cd $(dirname $0); pwd`
+launchctl submit -l GHUNIT_RunIPhoneSecurityd -- "$SCRIPTS_PATH"/RunIPhoneSecurityd.sh $IPHONE_SIMULATOR_ROOT $CFFIXED_USER_HOME
+trap "launchctl remove GHUNIT_RunIPhoneSecurityd" EXIT TERM INT
+
RUN_CMD="\"$TEST_TARGET_EXECUTABLE_PATH\" -RegisterForSystemEvents"
echo "Running: $RUN_CMD"

0 comments on commit b168806

Please sign in to comment.