[google-toolbox-for-mac] r607 committed - Try and make scripted builds more stable by killing the app being laun...

12 views
Skip to first unread message

google-tool...@googlecode.com

unread,
Mar 1, 2013, 11:00:33 AM3/1/13
to google-tool...@googlegroups.com
Revision: 607
Author: gtm.daemon
Date: Fri Mar 1 08:00:18 2013
Log: Try and make scripted builds more stable by killing the app being
launched to
make sure nothing is left between runs to cause problems for the next
launch.

DELTA=24 (19 added, 0 deleted, 5 changed)
http://code.google.com/p/google-toolbox-for-mac/source/detail?r=607

Modified:
/trunk/UnitTesting/RuniOSUnitTestsUnderSimulator.sh

=======================================
--- /trunk/UnitTesting/RuniOSUnitTestsUnderSimulator.sh Fri Nov 16 13:00:16
2012
+++ /trunk/UnitTesting/RuniOSUnitTestsUnderSimulator.sh Fri Mar 1 08:00:18
2013
@@ -100,11 +100,15 @@
echo "${DEVELOPER_DIR}/Tools/RunPlatformUnitTests.include:${1}: ${2}:
${3}"
}

-GTMKillSimulator() {
+GTMKillNamedAndWait() {
# If there is something killed, sleep for few seconds to let the
simulator
# spin down so it isn't still seen as running when the next thing tries
to
# launch it.
- /usr/bin/killall "iPhone Simulator" 2> /dev/null && sleep 2 || true
+ /usr/bin/killall "${1}" 2> /dev/null && sleep 2 || true
+}
+
+GTMKillSimulator() {
+ GTMKillNamedAndWait "iPhone Simulator"
}

# Honor TEST_AFTER_BUILD if requested.
@@ -165,7 +169,7 @@
#
# Build up the command line to run.
#
-
+GTM_TEST_APP_NAME=
GTM_TEST_COMMAND=(
"${SimExecutable}"
"-d" "${GTM_DEVICE_TYPE}"
@@ -177,10 +181,13 @@
if [[ -n "${TEST_HOST}" ]]; then
# When using a test host, it is usually set to the executable within the
app
# bundle, back up one to point at the bundle.
- TEST_HOST_FILENAME=$(basename "${TEST_HOST}")
- TEST_HOST_EXTENSION="${TEST_HOST_FILENAME##*.}"
+ GTM_TEST_APP_NAME=$(basename "${TEST_HOST}")
+ TEST_HOST_EXTENSION="${GTM_TEST_APP_NAME##*.}"
if [[ "${TEST_HOST_EXTENSION}" != "app" ]] ; then
TEST_HOST=$(dirname "${TEST_HOST}")
+ else
+ # Drop the extension.
+ GTM_TEST_APP_NAME="${GTM_TEST_APP_NAME%.*}"
fi
# Yes the DYLD_INSERT_LIBRARIES value below looks odd, that is found from
# looking at what Xcode sets when it invokes unittests directly.
@@ -191,6 +198,13 @@
"${TEST_HOST}"
)
else
+ GTM_TEST_APP_NAME=$(basename "${TEST_BUNDLE_PATH}")
+ TEST_BUNDLE_EXTENSION="${GTM_TEST_APP_NAME##*.}"
+ if [[ "${TEST_BUNDLE_EXTENSION}" == "app" ]] ; then
+ # Drop the extension.
+ GTM_TEST_APP_NAME="${GTM_TEST_APP_NAME%.*}"
+ fi
+
GTM_TEST_COMMAND+=( "${TEST_BUNDLE_PATH}" )
fi
GTM_TEST_COMMAND+=(
@@ -203,6 +217,10 @@
GTM_TEST_COMMAND+=( "${TEST_BUNDLE_PATH}" )
fi

+# Kill the test host just to make sure it wasn't left running and will
cause
+# problems.
+GTMKillNamedAndWait "${GTM_TEST_APP_NAME}"
+
# These two lines seem to fake out Xcode just enough that its log parser
acts
# as though Xcode were running the unit test via the UI. This prevents
false
# failures based on lines including "error" and such (which tends to
happen in
@@ -216,6 +234,7 @@
set -e

GTMKillSimulator
+GTMKillNamedAndWait "${GTM_TEST_APP_NAME}"

if [[ ${TEST_HOST_RESULT} -ne 0 ]]; then
GTMXcodeError ${LINENO} "Tests failed."
Reply all
Reply to author
Forward
0 new messages