Re: Unit testing via SSH in Xcode 6
Re: Unit testing via SSH in Xcode 6
- Subject: Re: Unit testing via SSH in Xcode 6
- From: Joar Wingfors <email@hidden>
- Date: Thu, 15 Jan 2015 22:06:14 -0800
HI Andrew,
When a user logs into OS X sufficient context is established to satisfy the requirements of GUI apps (or really, the frameworks and services used by GUI apps). The context established for a remote SSH connection is different, and on its own typically not sufficient for GUI apps. I would expect that you need to do two things for this to work reliably:
- The user that is invoking xcodebuild need to be logged in to a GUI / Aqua session
- The invocation of xcodebuild should be implemented as a LaunchAgent (not as a LaunchDaemon)
Some background on this topic can be found here:
Technical Note TN2083, Daemons and Agents
<https://developer.apple.com/library/mac/technotes/tn2083/_index.html>
(Note that from the change list it appears to not have been updated in a while, so it's probably no longer correct in every aspect / detail).
Like Jens I'd suggest that you take a look at Xcode Server, as it's designed to handle the stuff mentioned above on your behalf. Xcode Server also offer "triggers", providing the hooks that you mentioned you'd need.
Finally, I'd recommend reviewing the associated WWDC session videos from last year:
<https://developer.apple.com/videos/wwdc/2014/>
Look for "Testing in Xcode 6" and "Continuous Integration with Xcode 6".
Joar
> On 15 jan 2015, at 09:40, Andrew Keller <email@hidden> wrote:
>
> Hello all,
>
> I'm having trouble running my unit tests over SSH after upgrading from Xcode 4 to Xcode 6. My problem appears to be reproducible with a default Xcode project:
>
> 1. Using Xcode 6.1.1 (6A2008a)
> 2. Create an empty Cocoa application
> 3. Run unit tests via an SSH session using: `xcodebuild -scheme MyCocoaApplication test`
>
> Expected behavior: Unit tests behave the same as they do when the same command is ran locally on the machine in a Terminal window with no SSH session.
>
> Found behavior:
>
> $ xcodebuild -scheme MyCocoaApplication test
> === BUILD TARGET MyCocoaApplication OF PROJECT MyCocoaApplication WITH CONFIGURATION Debug ===
>
> Check dependencies
>
> === BUILD TARGET MyCocoaApplicationTests OF PROJECT MyCocoaApplication WITH CONFIGURATION Debug ===
>
> Check dependencies
>
>
> Testing failed:
>
> Test target MyCocoaApplicationTests encountered an error (Test session exited(-1) without checking in. If you believe this error represents a bug, please attach the log file at /var/folders/h2/xngxkxm15_93gm4n50p7s_mm0000gp/T/com.apple.dt.XCTest-status/Session-2015-01-15_12:35:52-0qPMDN.log)
> ** TEST FAILED **
>
> $ cat /var/folders/h2/xngxkxm15_93gm4n50p7s_mm0000gp/T/com.apple.dt.XCTest-status/Session-2015-01-15_12:35:52-0qPMDN.log
> 2015-01-15 12:35:52.372 Beginning test session with Xcode 6A2008a
> 2015-01-15 12:35:52.372 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -scheme MyCocoaApplication test
> 2015-01-15 12:35:52.372 Testing on device: <DVTLocalComputer: 0x7fc76a8b14e0 (My Mac | x86_64h)>
> 2015-01-15 12:35:52.372 Writing testing status log to /var/folders/h2/xngxkxm15_93gm4n50p7s_mm0000gp/T/com.apple.dt.XCTest-status/Session-2015-01-15_12:35:52-0qPMDN.log.
> 2015-01-15 12:35:52.372 Initializing test infrastructure.
> 2015-01-15 12:35:52.372 Waiting for connection to unix domain socket.
> 2015-01-15 12:35:52.516 Launch session started, setting a disallow-finish-token on the run operation.
> 2015-01-15 12:35:53.129 Adding console adaptor for test process.
> 2015-01-15 12:35:55.689 Test operation failure: Test session exited(-1) without checking in.
> 2015-01-15 12:35:55.689 _finishWithError:Error Domain=IDEUnitTestsOperationsObserverErrorDomain Code=3 "Test session exited(-1) without checking in." UserInfo=0x7fc76ade8110 {NSLocalizedDescription=Test session exited(-1) without checking in.} didCancel: 1
>
> What am I missing? How can I run my unit tests via SSH?
>
> Thanks,
> - Andrew Keller
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden