bendyworks / bwoken

iOS UIAutomation Test Runner
http://bendyworks.github.com/bwoken/
MIT License
442 stars 67 forks source link

Xcode 6 issue #76

Open vincentjames501 opened 10 years ago

vincentjames501 commented 10 years ago

At least for my two machines, there is no longer a full path to Automation.tracetemplate. Running xcrun instruments -s I'm left with the following templates:

Known Templates:
"Activity Monitor"
"Allocations"
"Automation"
"Blank"
"Cocoa Layout"
"Core Animation"
"Core Data"
"Counters"
"Dispatch"
"Energy Diagnostics"
"File Activity"
"GPU Driver"
"Leaks"
"Multicore"
"Network"
"OpenGL ES Analysis"
"Sudden Termination"
"System Trace"
"System Usage"
"Time Profiler"
"UI Recorder"
"Zombies"

I haven't done much digging into this, but it runs fine for me if I adjust the [-t template] option via a slight code tweak like so:

def path_to_automation_template
  template = nil
  `xcrun instruments -s 2>&1 | grep Automation.tracetemplate`.split("\n").each do |path|
    path = path.gsub(/^\s*"|",\s*$/, "")
    template = path if File.exists?(path)
    break if template
  end
  template || 'Automation' #ADDED HERE
end

We're back in business. I'm not sure if it's safe to assume this as a default, however. Without this, you'll get the following error message:

2014-09-22 17:21:22.000 instruments[9053:1007] *** -[__NSCFConstantString stringByAppendingPathExtension:]: cannot append extension 'tracetemplate' to path ''
Instruments Usage Error : The specified template '' does not exist.
instruments, version 6.0 (56156)
usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument ...]]]
listrophy commented 10 years ago

Downloading Xcode 6.0.1 is taking for...ev...er... :)

Thanks for the bug report. I'll see what I can do.

russelCrowe commented 10 years ago

Having the same problem here as well.

vincentjames501 commented 10 years ago

I'm NOT a ruby expert which is why I'm not just submitting a pull request, but this seems like this would be nice???

def xcode_version
  Gem::Version.new `xcodebuild -version 2>&1`.split("\n").first.gsub(/Xcode /, "")
end

def path_to_automation_template
  if xcode_version >= Gem::Version.new("6")
    "Automation"
  else
    `xcrun instruments -s 2>&1 | grep Automation.tracetemplate`.split("\n").find do |path|
      path = path.gsub(/^\s*"|",\s*$/, "")
      File.exists?(path)
    end
  end
end
dereknex commented 10 years ago

Having the same problem.

listrophy commented 10 years ago

@vincentjames501 @russelCrowe @dereknex please install the version of bwoken I just pushed:

Using Bundler, set the line in your Gemfile to:

gem 'bwoken', '2.1.0.rc.1'

If you just installed bwoken from the command line, do the following:

$ gem uninstall bwoken && gem install bwoken --pre

Let me know if this fixes the problem.

(For reference, the fix is at 227d4056d276474895acb9f6458bb24089fa9833)

russelCrowe commented 9 years ago

@listrophy

Thanks. Unfortunately, it's still failing to run the test. It's not throwing any errors this time though. Just fails to launch the simulator.

It compiles fine and tries to run the example.js and main.js but nothing happens. Fails silently.

Appreciate your help.

liangfenxiaodao commented 9 years ago

@listrophy I got the same problem as @russelCrowe

bodhi commented 9 years ago

It's not throwing any errors this time though. Just fails to launch the simulator.

+1

danielrampanelli commented 9 years ago

I did manage to avoid this problem and the fix can found at #79. Apparently, instruments will default to it's first available device (in my case the computer itself) and therefore fails to run the test.

listrophy commented 9 years ago

I've merged #79 and released version 2.1.0.rc.2. Please test with the new version per my instructions above: https://github.com/bendyworks/bwoken/issues/76#issuecomment-56964853

dereknex commented 9 years ago

@listrophy Thanks. I upgrade to 2.1.0.rc.2, this problem has been solved

extr3mal commented 9 years ago

$bwoken --version 2.1.0.rc.2

when running bwoken i recieve

2014-10-23 09:32:14.346 instruments[6522:25752] * -[__NSCFConstantString stringByAppendingPathExtension:]: cannot append extension 'tracetemplate' to path '' Instruments Usage Error : The specified template '' does not exist. instruments, version 6.1 (56160) usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument ...]]] 2014-10-23 09:32:17.725 instruments[6536:25796] * -[__NSCFConstantString stringByAppendingPathExtension:]: cannot append extension 'tracetemplate' to path '' Instruments Usage Error : The specified template '' does not exist. instruments, version 6.1 (56160) usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument ...]]]

Any ideas how to fix that ?

jmoody commented 9 years ago

I stumbled across this searching for something else.

This is how we find the Automation template in run-loop (Calabash iOS).

Works on Xcode > 5.1.1 and is updated for Xcode 6.3 Beta

truebit commented 9 years ago

When this bug will be fixed? It still exists on Xcode 6.3.1 with bwoken 2.1.0.rc.2:

Instruments Usage Error : Specified target process is invalid: /Users/some/Documents/bwoken/Workspace/build/iphonesimulator/Some.app
instruments, version 6.3 (57536)
usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument ...]]]