[google-toolbox-for-mac] r694 committed - After switching to Xcode 6, the Simulator sometimes fails to open caus...

59 views
Skip to first unread message

google-tool...@googlecode.com

unread,
Oct 29, 2014, 11:33:25 AM10/29/14
to google-tool...@googlegroups.com
Revision: 694
Author: thomasvl
Date: Wed Oct 29 15:33:04 2014 UTC
Log: After switching to Xcode 6, the Simulator sometimes fails to open
causing the
tests to fail. The projects that have more test targets are more vulnerable
to
the issue. When the simulator fails to open, we should reset it and try
again.

https://code.google.com/p/google-toolbox-for-mac/source/detail?r=694

Modified:
/trunk/UnitTesting/RuniOSUnitTestsUnderSimulator.sh

=======================================
--- /trunk/UnitTesting/RuniOSUnitTestsUnderSimulator.sh Wed Oct 8 15:30:05
2014 UTC
+++ /trunk/UnitTesting/RuniOSUnitTestsUnderSimulator.sh Wed Oct 29 15:33:04
2014 UTC
@@ -129,6 +129,13 @@
GTMKillSimulator() {
GTMKillNamedAndWait "${SimulatorProcessName}"
}
+
+GTMResetSimulator() {
+ GTMKillSimulator
+ device_id=`xcrun simctl list | grep "${GTM_DEVICE_TYPE} (" | sed -n 2p |
\
+ cut -d "(" -f2 | cut -d ")" -f1`
+ xcrun simctl erase $device_id || true
+}

# Honor TEST_AFTER_BUILD if requested.
if [[ "$GTM_USE_TEST_AFTER_BUILD" == 1 && "$TEST_AFTER_BUILD" == "NO" ]];
then
@@ -265,6 +272,17 @@
GTMKillSimulator
GTMKillNamedAndWait "${GTM_TEST_APP_NAME}"

+# If the simulator fails to open with error
FBSOpenApplicationErrorDomain:4,
+# reset the sim and try again (Known simulator issue for Xcode 6).
+if [ ${TEST_HOST_RESULT} -eq 4 ] && [ ${XCODE_VERSION_MINOR} -ge "0600" ];
then
+ GTMFakeUnitTestingMsg ${LINENO} "Simulator failed to
open" "$TEST_HOST_RESULT, trying again."
+ GTMResetSimulator
+ set +e
+ "${GTM_TEST_COMMAND[@]}"
+ TEST_HOST_RESULT=$?
+ set -e
+fi
+
if [[ ${TEST_HOST_RESULT} -ne 0 ]]; then
GTMXcodeError ${LINENO} "Tests failed."
exit 1
Reply all
Reply to author
Forward
0 new messages