Skip to content

Instantly share code, notes, and snippets.

@lxcid
Created April 27, 2013 13:02
Show Gist options
  • Save lxcid/5473043 to your computer and use it in GitHub Desktop.
Save lxcid/5473043 to your computer and use it in GitHub Desktop.
Xcode's Build Phases' Run Script: Test with ios-sim.
if [ "$RUN_UNIT_TEST_WITH_IOS_SIM" = "YES" ]; then
test_bundle_path="$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.$WRAPPER_EXTENSION"
ios-sim launch "$(dirname "$TEST_HOST")" --setenv DYLD_INSERT_LIBRARIES=/../../Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection --setenv XCInjectBundle="$test_bundle_path" --setenv XCInjectBundleInto="$TEST_HOST" --args -SenTest All "$test_bundle_path" 2> log.txt
echo "Finished running tests with ios-sim"
failure=$(grep -q "with 0 failures" log.txt; echo $?)
if [ $failure != 0 ]; then
printf "\n"
grep --color=always "error:" log.txt
fi
rm log.txt
exit $failure
else
"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment