2014-07-23 3 views
3

지금까지 모두 알고 있듯이 iOS에서 테스트를 실행하는 유일한 방법은 시뮬레이터를 사용하는 것입니다. 내 문제는 우리가 젠킨스를 실행 중이고 iOS 빌드가 슬레이브 (SSH를 통해)에서 실행 중이므로 xcodebuild를 실행하면 시뮬레이터를 시작할 수 없다는 것입니다 (헤드리스로 실행 됨). 내가 어딘가 그것을 SimLauncher (보석 sim_launcher)와 함께 작동하도록하는 것이 가능해야한다고 읽었습니다. 하지만 xcodebuild를 사용하여이를 설정하는 방법에 대한 정보는 찾을 수 없습니다. 모든 포인터를 환영합니다.xcodebuild는 헤드리스 테스트를 실행합니까?

답변

2

헤드리스 및 xcodebuild는 잘 섞이지 않습니다. 이 대안을 고려하십시오 :

jnlp (webstart)를 통해 시작하도록 종속 노드를 구성 할 수 있습니다.

#!/bin/bash 

slave_url="https://gardner.company.com/jenkins/jnlpJars/slave.jar" 

max_attempts=40 # ten minutes 
echo "Waiting to try again. curl returneed $rc" 
curl -fO "${slave_url}" >>slave.log 
rc=$? 
if [ $rc -ne 0 -a $max_attempts -gt 0 ]; then 
    echo "Waiting to try again. curl returneed $rc" 
    sleep 5 
    curl -fO "${slave_url}" >>slave.log 
    rc=$? 
    if [ $rc -eq 0 ]; then 
    zip -T slave.jar 
    rc=$? 
    fi 
    let max_attempts-=1 
fi 

# Simulator 
java -jar slave.jar -jnlpUrl https://gardner.company.com/jenkins/computer/buildmachine/slave-agent.jnlp -secret YOUR_SECRET_KEY 

이 빌드 사용자가 자동으로 로그인 설정 : 다음 내용을 내가 (- -> 사용자> 로그인 항목은 시스템 환경 설정) 로그인 항목으로 .command 확장자가 떠들썩한 파티 스크립트를 사용합니다. OSX 노예에 대한 설명은

gardner:~ buildmachine$ java -jar slave.jar --help 
"--help" is not a valid option 
java -jar slave.jar [options...] 
-auth user:pass     : If your Jenkins is security-enabled, specify 
            a valid user name and password. 
-connectTo HOST:PORT   : make a TCP connection to the given host and 
            port, then start communication. 
-cp (-classpath) PATH   : add the given classpath elements to the 
            system classloader. 
-jar-cache DIR     : Cache directory that stores jar files sent 
            from the master 
-jnlpCredentials USER:PASSWORD : HTTP BASIC AUTH header to pass in for making 
            HTTP requests. 
-jnlpUrl URL     : instead of talking to the master via 
            stdin/stdout, emulate a JNLP client by 
            making a TCP connection to the master. 
            Connection parameters are obtained by 
            parsing the JNLP file. 
-noReconnect     : Doesn't try to reconnect when a communication 
            fail, and exit instead 
-proxyCredentials USER:PASSWORD : HTTP BASIC AUTH header to pass in for making 
            HTTP authenticated proxy requests. 
-secret HEX_SECRET    : Slave connection secret to use instead of 
            -jnlpCredentials. 
-slaveLog FILE     : create local slave error log 
-tcp FILE      : instead of talking to the master via 
            stdin/stdout, listens to a random local 
            port, write that port number to the given 
            file, then wait for the master to connect to 
            that port. 
-text       : encode communication with the master with 
            base64. Useful for running slave over 8-bit 
            unsafe protocol like telnet 

gardner:~ buildmachine$ 

을 마스터가 시작되는 방법이 젠킨스 버그 참조하십시오 : 당신은 실행하여 slave.jar 응용 프로그램에 인수를 볼 수 있습니다 https://issues.jenkins-ci.org/browse/JENKINS-21237

+0

안녕하세요 가드너, 내가 시간이있을 때이 접근법을 시도하고 작동하면 승인합니다 :) – Erik

+0

@Erik 그래서이 대답은 당신을 위해 일 했나요? 비슷한 일을하려고합니다. – chakrit

+0

창 관리자에서 jenkins를 실행하도록 설정하지 않았으므로이 작업을 수행하지 못했습니다. – Erik

2

에릭 - 나는 일을 결국 항목 documented here :

기본적으로

:

첫 번째 문제는, 당신은 또한 그 맥 구축 시스템에 콘솔에 로그인 빌드를 실행하는 사용자가 있어야 할 것입니다. 그것은 시뮬레이터를 팝업 할 수 있어야하고, 사용자가 로그인하지 않으면 실패 할 것입니다. 디스플레이없이 완전히 헤드리스를 할 수 없기 때문입니다.

둘째, XCode 개발자 도구는 단위 테스트에서 모든 작업을 실행하기 위해 상승 된 권한이 필요합니다. 때로는보고 싶지 않을 수도 있지만, 시뮬레이터를 사용하지 않으면 인증 프롬프트가 나타나지 않습니다.

sudo security authorizationdb write system.privilege.taskport allow 

이이 인증 팝업의 하나 개의 클래스를 제거합니다

(댈러스 매버릭스)에 이에 대한 최초의 솔루션을 실행하는 것입니다. 애플의 man 페이지 당

sudo DevToolsSecurity --enable 

을이 도구에 : 당신은 또한 실행해야합니다 일반 사용자 시스템에서

, 처음 주어진 로그인 세션에 이러한 애플 코드 코드가 서명 된 디버거 또는 성능 분석 도구가 사용자 프로세스 중 하나를 검사하는 데 사용되는 인 경우 승인을 위해 관리자 암호 을 묻는 메시지가 표시됩니다. DevToolsSecurity 도구를 으로 변경하면 구성원 인 사용자가 admin 그룹 또는 _developer 그룹에 Apple 코드 서명 디버거 또는 성능 분석 도구를 사용하려면 추가 암호 을 입력 할 필요가 없습니다. .

Xcode 6으로 업그레이드하면 이러한 동일한 문제가 발생하는 것입니다. 그리기 게시판으로 돌아 가기 ....

관련 문제