xcodebuild test hangs
| Originator: | szigetics | ||
| Number: | rdar://24973474 | Date Originated: | 04-Mar-2016 |
| Status: | Attention | Resolved: | Not yet |
| Product: | iOS | Product Version: | iOS 9.2, Xcode 7.2.1 |
| Classification: | Reproducible: |
I am running my Unit Tests on my Teamcity Build Agent which is running as a Launch Daemon.
My problem is that sometimes the tests are running successfully, but sometimes I run into a hanging state in the middle of running the tests.
Everything is working fine when I run my tests locally.
I already tried to create a fresh simulator instance for running my tests but that did not solve the issue.
Here is the relevant snippet of my build script :
#Force close the Simulator
killall "Simulator"
local SIMULATOR_DESTINATION_UUID=$($XCODEPATH/usr/bin/xcrun simctl create "iPhone 6" com.apple.CoreSimulator.SimDeviceType.iPhone-6 com.apple.CoreSimulator.SimRuntime.iOS-9-2)
LOG_FILE_AUTOMATED_TESTS="$TEAMCITY_BUILD_CHECKOUTDIR/xcodebuildAutomatedTests.log"
touch "$LOG_FILE_AUTOMATED_TESTS"
$XCODEPATH/usr/bin/xcodebuild $CLEANBUILD test -destination platform="iOS Simulator,id=$SIMULATOR_DESTINATION_UUID" -project "$TEAMCITY_BUILD_CHECKOUTDIR/$SCHEME.xcodeproj" -scheme $SCHEME -configuration "$BUILD_CONFIG_NAME_CAPITAL" -derivedDataPath "$DERIVED_DATA_DIR_DEVICE" OTHER_CODE_SIGN_FLAGS="--keychain $HOME/Library/Keychains/login.keychain" -parallelizeTargets -jobs `sysctl hw.ncpu | awk '{print 2*$2}'` 2>&1 | tee "$LOG_FILE_AUTOMATED_TESTS" | xcpretty --report junit --output automated-test-results/TEST-UnitTests-$BUILD_CONFIG_NAME_CAPITAL.xml
$XCODEPATH/usr/bin/xcrun simctl shutdown $SIMULATOR_DESTINATION_UUID
$XCODEPATH/usr/bin/xcrun simctl delete $SIMULATOR_DESTINATION_UUID
killall "Simulator"
Here are some example results :
Here the tests ran just fine :
[15:50:58][Step 6/38] All tests
[15:50:58][Step 6/38] Test Suite MyAppTests.xctest started
[15:50:58][Step 6/38] MyApp1Tests
[15:50:58][Step 6/38] ��� testSomething1 (0.004 seconds)
[15:51:13][Step 6/38] ��� testSomething2 (5.608 seconds)
[15:51:13][Step 6/38] ��� testSomething3 (0.006 seconds)
[15:51:13][Step 6/38] ��� testSomething4 (0.004 seconds)
[15:51:13][Step 6/38] MyApp2Tests
[15:51:13][Step 6/38] ��� testSomethingOther1 (0.005 seconds)
[15:51:13][Step 6/38] MyApp3Tests
[15:51:13][Step 6/38] ��� testSomethingOtherOther1 (0.019 seconds)
[15:51:13][Step 6/38] MyApp4Tests
[15:51:13][Step 6/38] ��� testSomethingOtherOtherOther1 (0.238 seconds)
[15:51:13][Step 6/38] ��� testSomethingOtherOtherOther2 (0.112 seconds)
[15:51:13][Step 6/38] MyApp5Tests
[15:51:13][Step 6/38] ��� testSomethingOtherOtherOtherOther1 (0.000 seconds)
[15:51:17][Step 6/38] Selected tests
[15:51:17][Step 6/38] Test Suite join.meTests.xctest started
[15:51:17][Step 6/38]
[15:51:17][Step 6/38]
[15:51:17][Step 6/38] Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Here I had a hang :
[16:15:11][Step 6/38] All tests
[16:15:11][Step 6/38] Test Suite MyAppTests.xctest started
[16:15:11][Step 6/38] MyApp1Tests
[16:15:11][Step 6/38] ��� testSomething1 (0.003 seconds)
Do you know what can cause this issue? I am trying to remove the "-parallelizeTargets ..." part now.
Thanks for any help!
UPDATE :
Removing the "-parallelizeTargets ..." part did not help... :( Same results... :(
SIDENOTE :
I couldn't reproduce it locally on my machine yet.
Steps to Reproduce:
Run Unit Tests multiple time.
Expected Results:
"xcodebuild test ..." should not hang
Actual Results:
"xcodebuild test ..." should hangs
Version:
iOS 9.2, Xcode 7.2.1
Notes:
Configuration:
iPhone 6 simulator
Attachments:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!