Xcode测试:域= NSCocoa错误域代码=516 /代码=17:文件已存在

6ioyuze2  于 2023-03-19  发布在  其他
关注(0)|答案(1)|浏览(187)

当我运行Xcode测试时,我会遇到间歇性的失败,即构建在Touching App.app阶段冻结了5分钟左右,然后失败,错误暗示无法创建日志文件,因为已经存在一个日志文件:

2023-03-13 10:43:47.473 xcodebuild[3695:44355]  IDETestOperationsObserverDebug: Failure collecting logarchive: Error Domain=NSCocoaErrorDomain Code=516 "“test-session-systemlogs-2023.03.13_10-41-40-+0000.logarchive” couldn’t be moved to “My Mac_CF8A13ED-B04E-49BF-AD2D-FFDF9B7679D9” because an item with the same name already exists." UserInfo={NSSourceFilePathErrorKey=/var/tmp/test-session-systemlogs-2023.03.13_10-41-40-+0000.logarchive, NSUserStringVariant=(
    Move
), NSDestinationFilePath=/var/folders/xq/sfn_fz953jb36ptp2g68wc2r0000gn/T/XCUITestOutput780702278/Test-Debug.xcresult/Staging/2_Test/Diagnostics/My Mac_CF8A13ED-B04E-49BF-AD2D-FFDF9B7679D9/test-session-systemlogs-2023.03.13_10-41-40-+0000.logarchive, NSFilePath=/var/tmp/test-session-systemlogs-2023.03.13_10-41-40-+0000.logarchive, NSUnderlyingError=0x600001593180 {Error Domain=NSPOSIXErrorDomain Code=17 "File exists"}}
2023-03-13 10:43:47.476 xcodebuild[3695:16404] [MT] IDETestOperationsObserverDebug: 342.133 elapsed -- Testing started completed.
2023-03-13 10:43:47.476 xcodebuild[3695:16404] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
2023-03-13 10:43:47.476 xcodebuild[3695:16404] [MT] IDETestOperationsObserverDebug: 342.133 sec, +342.133 sec -- end
hkmswyz6

hkmswyz61#

这个问题是由Xcode测试中默认包含的并行测试选项引起的。在Edit Scheme / Test Scheme / Tests / UITests / Options下禁用该选项修复了我的所有问题。

相关问题