alibaba / macaca

Automation solution for multi-platform. 多端自动化解决方案
https://macacajs.github.io
MIT License
3.17k stars 419 forks source link

XCTestWD在真机上正常运行,命令行执行app-inspector -u xxxx后,提示:Terminated due to signal 9 #1006

Open sunpei12 opened 2 years ago

sunpei12 commented 2 years ago

step1:XCTestWD在真机上可正常运行 2022-02-11 13:22:40.301286+0800 XCTestWDUITests-Runner[344:10963] XCTestWDSetup->http://localhost:8001<-XCTestWDSetup step2:终端执行命令—成功 DEVELOPMENT_TEAM_ID=xxxx cnpm i macaca-ios -g step3:终端执行命令—失败 app-inspector -u “真机udid” --verbose xcode-XCTestWD log如下: 2022-02-11 13:28:59.958366+0800 XCTestWDUITests-Runner[357:13208] Running tests... Test Suite 'All tests' started at 2022-02-11 13:29:01.063 Test Suite 'XCTestWDUITests.xctest' started at 2022-02-11 13:29:01.064 Test Suite 'XCTextWDRunner' started at 2022-02-11 13:29:01.064 Test Case '-[XCTestWDUITests.XCTextWDRunner testRunner]' started. t = 0.00s Start Test at 2022-02-11 13:29:01.065 t = 0.03s Set Up 2022-02-11 13:29:01.103188+0800 XCTestWDUITests-Runner[357:13208] initializing wd server 2022-02-11 13:29:01.103512+0800 XCTestWDUITests-Runner[357:13208] check log dir @:["/var/mobile/Containers/Data/Application/B6A5DEC2-8BDE-4A95-911B-D874224CF791/Documents"] 2022-02-11 13:29:01.103825+0800 XCTestWDUITests-Runner[357:13208] CocoaLumberjack: Warning: Usage of DDTTYLogger detected when DDOSLogger is available and can be used! Please consider migrating to DDOSLogger. 2022-02-11 13:29:01:104 XCTestWDUITests-Runner[357:13208] XCTestWD-Debug-Info: setup debug log 2022-02-11 13:29:01.105016+0800 XCTestWDUITests-Runner[357:13389] XCTestWD-Debug-Info: setup debug log 2022-02-11 13:29:01.108418+0800 XCTestWDUITests-Runner[357:13208] XCTestWDRunner.XCTestWDRunner.sundeMacBook-Pro.local.xctrunner 2022-02-11 13:29:01.108484+0800 XCTestWDUITests-Runner[357:13208] XCTestWDSetup->http://localhost:8001<-XCTestWDSetup 2022-02-11 13:29:25:467 XCTestWDUITests-Runner[357:13208] XCTestWD-Debug-Info: bundle ID input is nil, create session with current active app 2022-02-11 13:29:25.468413+0800 XCTestWDUITests-Runner[357:13505] XCTestWD-Debug-Info: bundle ID input is nil, create session with current active app t = 24.43s Find the Application 'com.apple.springboard' 2022-02-11 13:29:25:493 XCTestWDUITests-Runner[357:13208] XCTestWD-Debug-Info: create app failure 2022-02-11 13:29:25.495084+0800 XCTestWDUITests-Runner[357:13504] XCTestWD-Debug-Info: create app failure t = 24.55s Find the Application 'com.apple.springboard' t = 24.85s Find the Application 'com.apple.springboard' t = 24.95s Requesting snapshot of accessibility hierarchy for app with pid 56 t = 25.10s getting device orientation t = 25.14s getting device orientation t = 25.18s getting device orientation t = 25.21s getting device orientation t = 25.24s getting device orientation t = 25.28s getting device orientation t = 25.31s getting device orientation t = 25.34s getting device orientation t = 25.37s getting device orientation t = 25.41s getting device orientation t = 25.44s getting device orientation t = 25.47s getting device orientation t = 25.51s getting device orientation t = 25.54s getting device orientation t = 25.58s getting device orientation t = 25.61s getting device orientation t = 25.64s getting device orientation t = 25.68s getting device orientation t = 25.71s getting device orientation t = 25.74s getting device orientation t = 25.77s getting device orientation t = 25.81s getting device orientation t = 25.84s getting device orientation t = 25.87s getting device orientation t = 25.91s getting device orientation t = 25.94s getting device orientation t = 25.97s getting device orientation t = 26.00s getting device orientation t = 26.04s getting device orientation t = 26.07s getting device orientation t = 26.10s getting device orientation t = 26.14s getting device orientation t = 26.18s getting device orientation t = 26.21s getting device orientation t = 26.24s getting device orientation t = 26.27s getting device orientation t = 26.31s getting device orientation t = 26.34s getting device orientation t = 26.37s getting device orientation t = 26.41s getting device orientation t = 26.44s getting device orientation t = 26.48s getting device orientation t = 26.51s getting device orientation t = 26.55s getting device orientation t = 26.58s getting device orientation t = 26.61s getting device orientation t = 26.65s getting device orientation t = 26.68s getting device orientation t = 26.71s getting device orientation t = 26.75s getting device orientation t = 26.78s getting device orientation t = 26.81s getting device orientation t = 26.84s getting device orientation t = 26.88s getting device orientation t = 26.91s getting device orientation t = 26.95s getting device orientation t = 26.98s getting device orientation t = 27.01s getting device orientation t = 27.04s getting device orientation t = 27.08s getting device orientation t = 27.11s getting device orientation t = 27.15s getting device orientation t = 27.18s getting device orientation t = 27.21s getting device orientation t = 27.25s getting device orientation t = 27.28s getting device orientation t = 27.31s getting device orientation t = 27.34s getting device orientation t = 27.38s getting device orientation 2022-02-11 13:29:28:473 XCTestWDUITests-Runner[357:13208] XCTestWD-Debug-Info: no session id in current request 2022-02-11 13:29:28.474061+0800 XCTestWDUITests-Runner[357:13508] XCTestWD-Debug-Info: no session id in current request 2022-02-11 13:29:28:662 XCTestWDUITests-Runner[357:13208] XCTestWD-Debug-Info: no session id in current request 2022-02-11 13:29:28.663039+0800 XCTestWDUITests-Runner[357:13503] XCTestWD-Debug-Info: no session id in current request Message from debugger: Terminated due to signal 9

sunpei12 commented 2 years ago

已经将XCTestWD成功安装到手机上,执行命令 app-inspector -u xxxx --verbose 为什么感觉又重新安装XCTestWD? 导致命令执行失败 NSLocalizedDescription = "Unable to install \"XCTestWDUITests-Runner\""; NSUnderlyingError = "Error Domain=com.apple.dt.MobileDeviceErrorDomain Code=-402620394 \"The executable was signed with invalid entitlements.\" UserInfo={MobileDeviceErrorCode=(0xE8008016), com.apple.dtdevicekit.stacktrace=(\n\t0 DTDeviceKitBase 0x00000001265ed316 DTDKCreateNSErrorFromAMDErrorCode + 220\n\t1 DTDeviceKitBase 0x000000012662b84a __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 155\n\t2 DVTFoundation 0x000000010338bea4 DVTInvokeWithStrongOwnership + 71\n\t3 DTDeviceKitBase 0x000000012662b594 -[DT...

xctestwd start with port: 8001 proxy.js:55:14 [master] pid:7240 Proxy: /wd/hub/session:POST to http://127.0.0.1:8001/wd/hub/session:POST with body: {"desiredCapabilities":{}} xctest-client.js:281:16 [master] pid:7240 Error connecting to device: No such file or directory

sunpei12 commented 2 years ago

xctest-client.js:206:16 [master] pid:30637 CodeSign /Users/sun/Library/Developer/Xcode/DerivedData/XCTestWD-chriscfdfibgdwhgiivawgeoepml/Build/Products/Debug-iphoneos/XCTestWDUITests-Runner.app

cd "/usr/local/lib/node_modules/app-inspector/node_modules/_xctestwd@1.4.34@xctestwd/XCTestWD"

export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate

export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/sun/.rvm/gems/ruby-3.0.0/bin:/Users/sun/.rvm/gems/ruby-3.0.0@global/bin:/Users/sun/.rvm/rubies/ruby-3.0.0/bin:/Users/sun/opt/anaconda3/bin:/Users/sun/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/sun/.rvm/bin"

Signing Identity: "Apple Development: xxxxx (xxxxx)"

Provisioning Profile: "iOS Team Provisioning Profile: XCTestWDRunner.XCTestWDRunner.sundeMacBook-Pro.local"

​ (8fe7e683-cc5b-481e-aefe-bdb363b91479)

/usr/bin/codesign --force --sign 66AD7E301ED0CFD882FA16679BEF9D3C8AF78AC2 --deep --entitlements /Users/sun/Library/Developer/Xcode/DerivedData/XCTestWD-chriscfdfibgdwhgiivawgeoepml/Build/Intermediates.noindex/XCTestWD.build/Debug-iphoneos/XCTestWDUITests.build/XCTestWDUITests.xctest.xcent --timestamp=none /Users/sun/Library/Developer/Xcode/DerivedData/XCTestWD-chriscfdfibgdwhgiivawgeoepml/Build/Products/Debug-iphoneos/XCTestWDUITests-Runner.app

>> xctest-client.js:206:16 [master] pid:30637 /Users/sun/Library/Developer/Xcode/DerivedData/XCTestWD-chriscfdfibgdwhgiivawgeoepml/Build/Products/Debug-iphoneos/XCTestWDUITests-Runner.app: replacing existing signature

>> xctest-client.js:206:16 [master] pid:30637

>> helper.js:20:18 [master] pid:30637 retrying... (7 retries left)

>> xctest-client.js:281:16 [master] pid:30637 Error connecting to device: No such file or directory

>> proxy.js:63:22 [master] pid:30637 xctest client proxy error with: Error: read ECONNRESET

>> helper.js:20:18 [master] pid:30637 retrying... (6 retries left)

>> xctest-client.js:281:16 [master] pid:30637 Error connecting to device: No such file or directory

>> proxy.js:63:22 [master] pid:30637 xctest client proxy error with: Error: read ECONNRESET

>> helper.js:20:18 [master] pid:30637 retrying... (5 retries left)

>> xctest-client.js:281:16 [master] pid:30637 Error connecting to device: No such file or directory

>> proxy.js:63:22 [master] pid:30637 xctest client proxy error with: Error: read ECONNRESET

>> helper.js:20:18 [master] pid:30637 retrying... (4 retries left)

>> xctest-client.js:281:16 [master] pid:30637 Error connecting to device: No such file or directory

>> proxy.js:63:22 [master] pid:30637 xctest client proxy error with: Error: read ECONNRESET

>> xctest-client.js:232:18 [master] pid:30637 2022-02-13 05:55:49.178 xcodebuild[30646:439049] iPhoneConnect: 📱<DVTiOSDevice (0x7feb5d9f6c40), xxx的 iPhone, iPhone, 13.7 (17H35), 9b84b9e47fcfb1806720a0928ddc51d0b0443739> installApplicationBundleAtPath:withOptions:andError:withCallback: failed with {

NSLocalizedDescription = "Unable to install \"XCTestWDUITests-Runner\"";

NSUnderlyingError = "Error Domain=com.apple.dt.MobileDeviceErrorDomain Code=-402620394 \"The executable was signed with invalid entitlements.\" UserInfo={MobileDeviceErrorCode=(0xE8008016), com.apple.dtdevicekit.stacktrace=(\n\t0 DTDeviceKitBase 0x000000012bcd1316 DTDKCreateNSErrorFromAMDErrorCode + 220\n\t1 DTDeviceKitBase 0x000000012bd0f84a __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 155\n\t2 DVTFoundation 0x0000000108a87ea4 DVTInvokeWithStrongOwnership + 71\n\t3 DTDeviceKitBase 0x000000012bd0f594 -[D...

>> xctest-client.js:232:18 [master] pid:30637 2022-02-13 05:55:49.325 xcodebuild[30646:439044] iPhoneConnect: 📱<DVTiOSDevice (0x7feb5d9f6c40), xxx的 iPhone, iPhone, 13.7 (17H35), 9b84b9e47fcfb1806720a0928ddc51d0b0443739> failed to install /Users/sun/Library/Developer/Xcode/DerivedData/XCTestWD-chriscfdfibgdwhgiivawgeoepml/Build/Products/Debug-iphoneos/XCTestWDUITests-Runner.app - error Error Domain=com.apple.dt.MobileDeviceErrorDomain Code=-402620394 "Unable to install "XCTestWDUITests-Runner"" UserInfo={NSLocalizedDescription=Unable to install "XCTestWDUITests-Runner", NSUnderlyingError=0x7feb5e1c0f90 {Error Domain=com.apple.dt.MobileDeviceErrorDomain Code=-402620394 "The executable was signed with invalid entitlements." UserInfo={MobileDeviceErrorCode=(0xE8008016), com.apple.dtdevicekit.stacktrace=(

​ 0 DTDeviceKitBase 0x000000012bcd1316 DTDKCreateNSErrorFromAMDErrorCode + 220

​ 1 DTDeviceKitBase 0x000000012bd0f84a __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:an...

>> xctest-client.js:206:16 [master] pid:30637

*** If you believe this error represents a bug, please attach the result bundle at /Users/sun/Library/Developer/Xcode/DerivedData/XCTestWD-chriscfdfibgdwhgiivawgeoepml/Logs/Test/Run-XCTestWDUITests-2022.02.13_05-55-31--0600.xcresult

>> xctest-client.js:234:18 [master] pid:30637 2022-02-13 05:55:49.332 xcodebuild[30646:438965] [MT] IDETestOperationsObserverDebug: 8.194 elapsed -- Testing started completed.

2022-02-13 05:55:49.332 xcodebuild[30646:438965] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start

>> xctest-client.js:234:18 [master] pid:30637 2022-02-13 05:55:49.332 xcodebuild[30646:438965] [MT] IDETestOperationsObserverDebug: 8.194 sec, +8.194 sec -- end

>> helper.js:20:18 [master] pid:30637 retrying... (3 retries left)

>> xctest-client.js:281:16 [master] pid:30637 Error connecting to device: No such file or directory

>> proxy.js:63:22 [master] pid:30637 xctest client proxy error with: Error: read ECONNRESET

>> xctest-client.js:206:16 [master] pid:30637

Test session results, code coverage, and logs:

​ /Users/sun/Library/Developer/Xcode/DerivedData/XCTestWD-chriscfdfibgdwhgiivawgeoepml/Logs/Test/Run-XCTestWDUITests-2022.02.13_05-55-31--0600.xcresult

>> xctest-client.js:234:18 [master] pid:30637 Testing failed:

​ XCTestWDUITests:

​ Command builtin-rm failed with exit code 512

​ XCTestWDUITests-Runner encountered an error (Failed to install or launch the test runner. If you believe this error represents a bug, please attach the result bundle at /Users/sun/Library/Developer/Xcode/DerivedData/XCTestWD-chriscfdfibgdwhgiivawgeoepml/Logs/Test/Run-XCTestWDUITests-2022.02.13_05-55-31--0600.xcresult. (Underlying Error: Unable to install "XCTestWDUITests-Runner". (Underlying Error: The executable was signed with invalid entitlements.)))

TEST FAILED

>> xctest-client.js:206:16 [master] pid:30637 Testing started

>> xctest-client.js:340:14 [master] pid:30637 killing runnerProc pid: 30646

>> xctest-client.js:346:14 [master] pid:30637 killing iproxyProc pid: 30702

>> xctest-client.js:257:16 [master] pid:30637 xctest client exit with code: 65, signal: null

>> xctest-client.js:290:14 [master] pid:30637 iproxy exit with code: null, signal: SIGKILL

>> helper.js:20:18 [master] pid:30637 retrying... (2 retries left)

>> proxy.js:63:22 [master] pid:30637 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001

>> helper.js:20:18 [master] pid:30637 retrying... (1 retries left)

>> proxy.js:63:22 [master] pid:30637 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001

>> xctest-client.js:327:14 [master] pid:30637 Fail to start xctest: Error: connect ECONNREFUSED 127.0.0.1:8001

Error: connect ECONNREFUSED 127.0.0.1:8001

at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16) {

errno: -61,

code: 'ECONNREFUSED',

syscall: 'connect',

address: '127.0.0.1',

port: 8001

}

>> iOS device started: 9b84b9e47fcfb1806720a0928ddc51d0b0443739

>> inspector start at: http://192.168.1.9:5678/

<-- GET /

>> helper.js:94:16 [master] pid:30637 xctest client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:8001

Error: connect ECONNREFUSED 127.0.0.1:8001

at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16)