From ee7229d886582c881280864f3926d6135aa62fbc Mon Sep 17 00:00:00 2001 From: hborders Date: Fri, 30 Mar 2012 14:04:49 -0500 Subject: [PATCH 1/3] Defaulted CFFIXED_USER_HOME to same as google-toolbox-for-mac. When running tests that use the keychain with GHUNIT_CLI, the following warning occurs: Warning: CFFIXED_USER_HOME is not set! It should be set to the simulated home directory. This should stop that warning. --- Scripts/RunTests.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Scripts/RunTests.sh b/Scripts/RunTests.sh index f5b5f5d0..19bab370 100755 --- a/Scripts/RunTests.sh +++ b/Scripts/RunTests.sh @@ -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 "$CFFIXED_USER_HOME" export NSDebugEnabled=YES export NSZombieEnabled=YES From 56312fcac61e8ac3a70226e19ec854178dbe483d Mon Sep 17 00:00:00 2001 From: hborders Date: Fri, 30 Mar 2012 15:55:55 -0500 Subject: [PATCH 2/3] Run $IPHONE_SIMULATOR_ROOT/usr/libexec/securityd to ensure keychain works during GHUNIT_CLI --- Scripts/RunIPhoneSecurityd.sh | 10 ++++++++++ Scripts/RunTests.sh | 8 +++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 Scripts/RunIPhoneSecurityd.sh diff --git a/Scripts/RunIPhoneSecurityd.sh b/Scripts/RunIPhoneSecurityd.sh new file mode 100755 index 00000000..bf488536 --- /dev/null +++ b/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 diff --git a/Scripts/RunTests.sh b/Scripts/RunTests.sh index 19bab370..c8226d9d 100755 --- a/Scripts/RunTests.sh +++ b/Scripts/RunTests.sh @@ -14,7 +14,7 @@ export CFFIXED_USER_HOME="$TEMP_FILES_DIR/iPhone Simulator User Dir" # Be compat if [ -d $"CFFIXED_USER_HOME" ]; then rm -rf "$CFFIXED_USER_HOME" fi -mkdir "$CFFIXED_USER_HOME" +mkdir -p "$CFFIXED_USER_HOME" export NSDebugEnabled=YES export NSZombieEnabled=YES @@ -37,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" From 8bcf71f1b7bb1a2aaf1b677ef3756645314f6f9d Mon Sep 17 00:00:00 2001 From: Gabriel Handford Date: Wed, 11 Jul 2012 14:54:15 -0700 Subject: [PATCH 3/3] Adding securityd script for command line docs --- .../appledoc_include/guide_command_line-template.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/appledoc_include/guide_command_line-template.markdown b/Documentation/appledoc_include/guide_command_line-template.markdown index d26acd2e..2684ffe9 100644 --- a/Documentation/appledoc_include/guide_command_line-template.markdown +++ b/Documentation/appledoc_include/guide_command_line-template.markdown @@ -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.