【问题标题】:How to reset Instruments after Automation Instrument rejected command自动化仪器拒绝命令后如何重置仪器
【发布时间】:2012-09-17 05:22:27
【问题描述】:

(Xcode 4.5)

从命令行运行仪器时,它第一次可以工作,但直到我重新启动后才会再次运行。

Instruments 的详细输出包括:

Instruments : Loading template 'file://localhost/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate'
Instruments : Setting Instrument Trace Command : Instrument Command (purpose:Idle; output destination:file://localhost/Users/xxxxx/instrumentscli0.trace)
Instruments : Trace Command Recognized
Instruments : Instrument 'Automation - MyProject' rejected command 'Instrument Command (purpose:Trace; output destination:file://localhost/Users/xxxxx/instrumentscli0.trace)' for target 'Executable (name:MyProject; arguments:)'
Instruments : Instruments Rejected Command
Instruments Trace Error : Failed to start trace.

我用来运行仪器的命令行是这样的(为了清楚起见,分成多行):

instruments -v -w <DeviceID>
-t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate
/Users/xxxxx/dev/MyProject/build/Debug-iphoneos/MyProject.app
-e UIASCRIPT /Users/xxxxx/dev/MyProject/UIAutoTests/some_test.js

我尝试比较使用ps 第一次(成功)运行之前和之后正在运行的进程以及在使用lsof 之前和之后打开了哪些文件/管道,但我找不到任何说明原因它不会运行超过一次。

错误似乎表明仪器中的自动化仪器拒绝purpose:Trace 命令,因此我尝试删除输出跟踪目录(以防自动递增的文件名导致问题),我尝试过在两次运行之间使用不同的模板运行仪器,看看这是否能清除阻碍它的东西,但每次重新启动时我不能让它工作超过一次。

我怀疑自动化仪器或仪器使用的共享库中有一些无效状态。我需要一种从命令行重置此状态的方法,以便我可以在 CI 服务器上可靠地运行自动化测试。

有没有办法比较之前/之后加载哪些共享库并卸载它们? 有没有人对可能持续存在的内容以及如何重置它有任何其他想法?

【问题讨论】:

  • 3 个月后我仍然看到这个。我什至尝试了 4.6p4。你有什么新的见解或技巧吗?这让我很沮丧,因为它可以在所有 iOS6 设备上完美运行,除了一台装有 iOS5(故意)的 iPod touch。相关:lists.apple.com/archives/xcode-users/2012/Sep/msg00187.html

标签: instruments ios-ui-automation


【解决方案1】:

尝试下载 Xcode 4.4.1(iOS 开发中心)并使用它的工具 4.4 (4445)。此版本适用于我的所有设备。

仅供参考,当我使用 4.5+,甚至 4.6DP4 时,只有 iOS6 设备正常响应;其他人会因与您相同的信息而失败。试一试,如果 4.4 不好用,甚至可能是 4.3.3。

【讨论】:

    【解决方案2】:

    对于遇到此问题的其他人,我将解释什么对我有用以及我是如何解决这个问题的。

    我执行了ps 命令来查看哪些进程正在运行。我发现仪器仍在运行。然后我做了killall instruments,这杀死了仪器进程。然后我做了我的仪器命令,然后它就完美地工作了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-10
      • 1970-01-01
      • 1970-01-01
      • 2011-07-06
      • 1970-01-01
      • 2015-05-04
      • 2012-01-10
      • 1970-01-01
      相关资源
      最近更新 更多