1

我在 Jenkins 的“执行 shell”命令中添加了一个 perl 脚本。这个 perl 脚本通过命令行启动 Instruments,运行 js 测试(我们使用 tuneup_js 框架)。当脚本统计其中一项测试时,jenkins 控制台输出与仪器输出的完全不同。有关 Jenkins 控制台给出的输出,请参见下文:

Oct 17 15:06:03 macserver.local instruments[7197] <Error>: CGImageCreateWithImageProvider: invalid image size: 0 x 0.
2012-10-17 15:08:10.312 ScriptAgent[13266:13403] actionSheet:<UIAActionSheet_0x7c41ab0 uiaxElement=0x7c41a30 AXUIElementRef=0x7c41940>
2012-10-17 15:08:10.316 ScriptAgent[13266:13403] actionSheet:<UIAActionSheet_0xaa28be0 uiaxElement=0x7c41a30 AXUIElementRef=0x7c41940>
2012-10-17 15:08:10.320 ScriptAgent[13266:13403] actionSheet:<UIAActionSheet_0xaa2a5d0 uiaxElement=0x7c41a30 AXUIElementRef=0x7c41940>
2012-10-17 15:08:10.324 ScriptAgent[13266:13403] actionSheet:<UIAActionSheet_0xa4274e0 uiaxElement=0x7c41a30 AXUIElementRef=0x7c41940>
2012-10-17 15:08:10.328 ScriptAgent[13266:13403] actionSheet:<UIAActionSheet_0x7c433a0 uiaxElement=0x7c41a30 AXUIElementRef=0x7c41940>
2012-10-17 15:08:10.332 ScriptAgent[13266:13403] actionSheet:<UIAActionSheet_0x7c43c50 uiaxElement=0x7c41a30 AXUIElementRef=0x7c41940>
2012-10-17 15:08:10.335 ScriptAgent[13266:13403] actionSheet:<UIAActionSheet_0x7c44d90 uiaxElement=0x7c41a30 AXUIElementRef=0x7c41940>
2012-10-17 15:08:10.339 ScriptAgent[13266:13403] actionSheet:<UIAActionSheet_0x7c43340 uiaxElement=0x7c41a30 AXUIElementRef=0x7c41940>
2012-10-17 15:08:10.343 ScriptAgent[13266:13403] actionSheet:<UIAActionSheet_0x7c45ab0 uiaxElement=0x7c41a30 AXUIElementRef=0x7c41940>

我可以看到测试在模拟器上完美运行。如果我通过 Instruments 运行相同的测试,我的输出将类似于:

2012-10-17 21:10:32 +0000 Start:
2012-10-17 21:10:32 +0000 Pass: 
2012-10-17 21:10:32 +0000 Start: 
2012-10-17 21:10:32 +0000 Issue: 
2012-10-17 21:10:32 +0000 Issue: 
2012-10-17 21:10:32 +0000 Pass: 
2012-10-17 21:10:32 +0000 Start: 
2012-10-17 21:10:32 +0000 Debug: target.setDeviceOrientation("3")
2012-10-17 21:10:33 +0000 Issue: 
2012-10-17 21:10:33 +0000 Debug: target.setDeviceOrientation("1")
2012-10-17 21:10:35 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0].buttons()["t"].tap()
2012-10-17 21:10:36 +0000 Debug: target.setDeviceOrientation("3")
2012-10-17 21:10:38 +0000 Issue: 

我想要控制台的输出类似于上面的输出。这可能吗?

4

1 回答 1

0

我终于让它工作了!

问题出在运行测试的 perl 脚本中。

我没有使用 system($command),而是使用了反勾号运算符。

我不知道为什么反引号运算符不会返回输出,也不知道为什么 system() 在这里工作。

于 2012-10-18T00:16:21.327 回答