diff options
author | Thomas Van Lenten <thomasvl@google.com> | 2015-09-08 11:40:01 -0400 |
---|---|---|
committer | Thomas Van Lenten <thomasvl@google.com> | 2015-09-08 11:40:01 -0400 |
commit | 86b1431c5eb83aac2bb622778c7a880fb673df1d (patch) | |
tree | 2f126fb79ac55d14baf9cb09ac42e05fa783e13b /UnitTesting | |
parent | 181ff452f01da8948a9f6c3f0885c2a09f8a095a (diff) |
support invoking the script via symlinks
Diffstat (limited to 'UnitTesting')
-rwxr-xr-x | UnitTesting/RuniOSUnitTestsUnderSimulator.sh | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/UnitTesting/RuniOSUnitTestsUnderSimulator.sh b/UnitTesting/RuniOSUnitTestsUnderSimulator.sh index 190abe9..975ce78 100755 --- a/UnitTesting/RuniOSUnitTestsUnderSimulator.sh +++ b/UnitTesting/RuniOSUnitTestsUnderSimulator.sh @@ -80,10 +80,24 @@ GTM_REMOVE_GCOV_DATA=${GTM_REMOVE_GCOV_DATA:=0} # from the command line, but not when running from within XCode. GTM_USE_TEST_AFTER_BUILD=${GTM_USE_TEST_AFTER_BUILD:=0} +function realpath() { + OLDPWD=${PWD} + cd "$(dirname "$1")" + TARGET="$(readlink "$(basename "$1")")" + while [[ -n "${TARGET}" ]]; do + cd "$(dirname "${TARGET}")" + TARGET=$(readlink "$(basename "$1")") + done + REALPATH="${PWD}/$(basename "$1")" + cd "${OLDPWD}" + echo "${REALPATH}" +} + readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")") readonly ScriptName=$(basename "$0") readonly ThisScript="${ScriptDir}/${ScriptName}" -readonly SimExecutable="${ScriptDir}/iossim" +# iossim fails if it's behind the right combination of symlinks +readonly SimExecutable="$(realpath "${ScriptDir}/iossim")" # Simulator process name changes from Xcode 6. if [[ ${XCODE_VERSION_MINOR} -ge "0600" ]]; then |