Skip to content

Commit

Permalink
Merge branch 'master' into approved-image-color
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Schulze committed Jul 16, 2012
2 parents b14a639 + 8bcf71f commit b168806
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
Expand Up @@ -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.

Expand Down
10 changes: 10 additions & 0 deletions Scripts/RunIPhoneSecurityd.sh
@@ -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
13 changes: 13 additions & 0 deletions Scripts/RunTests.sh
Expand Up @@ -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
Expand All @@ -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"
Expand Down

0 comments on commit b168806

Please sign in to comment.