Closed Bug 553739 Opened 14 years ago Closed 14 years ago

|cfx testall| on Windows throws the exception "Mozrunner could not locate your binary"

Categories

(Add-on SDK Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: myk, Assigned: avarma)

Details

Attachments

(1 file)

When I run |cfx testall| on Windows, it throws the exception "Mozrunner could not locate your binary":

--------------------------------------------------------------------------------
(C:\Users\myk\jetpack-sdk-0.2rc1) C:\Users\myk\jetpack-sdk-0.2rc1>cfx testall -a

 firefox

Testing all available packages: test-harness, jetpack-core.

Traceback (most recent call last):

  File "C:\Users\myk\jetpack-sdk-0.2rc1\bin\cfx", line 6, in <module>

    cuddlefish.run()

  File "C:\Users\myk\jetpack-sdk-0.2rc1\python-lib\cuddlefish\__init__.py", line

 216, in run

    test_all_packages(env_root, defaults=options.__dict__)

  File "C:\Users\myk\jetpack-sdk-0.2rc1\python-lib\cuddlefish\__init__.py", line

 177, in test_all_packages

    defaults=defaults)

  File "C:\Users\myk\jetpack-sdk-0.2rc1\python-lib\cuddlefish\__init__.py", line

 432, in run

    timeout=timeout)

  File "C:\Users\myk\jetpack-sdk-0.2rc1\python-lib\cuddlefish\runner.py", line 1

22, in run_app

    kp_kwargs=popen_kwargs)

  File "C:\Users\myk\jetpack-sdk-0.2rc1\python-lib\mozrunner\__init__.py", line

322, in __init__

    self.binary = self.find_binary()

  File "C:\Users\myk\jetpack-sdk-0.2rc1\python-lib\mozrunner\__init__.py", line

379, in find_binary

    raise Exception('Mozrunner could not locate your binary, you will need to se

t it.')

Exception: Mozrunner could not locate your binary, you will need to set it.

--------------------------------------------------------------------------------

Note, however, that running |cfx docs| works fine, opening up the documentation in Firefox.  And running |cfx testall| inside MozillaBuild also works.
Erm, note that the example in comment 0 shows me running |cfx testall -a firefox|, but regular |cfx testall| has the same problem.
I ran into this issue on mac though, so not sure if its platform specific or not.  Via terminal:

(jetpack-sdk-0.1)Tony-Chungs-MacBook-Pro:jetpack-sdk-0.1 tchung$ cfx testall -a firefox
Testing all available packages: test-harness, jetpack-core.
Traceback (most recent call last):
  File "/Users/tchung/Desktop/jetpacksdk/jetpack-sdk-0.1/bin/cfx", line 6, in <module>
    cuddlefish.run()
  File "/Users/tchung/Desktop/jetpacksdk/jetpack-sdk-0.1/python-lib/cuddlefish/__init__.py", line 209, in run
    test_all_packages(env_root, defaults=options.__dict__)
  File "/Users/tchung/Desktop/jetpacksdk/jetpack-sdk-0.1/python-lib/cuddlefish/__init__.py", line 170, in test_all_packages
    defaults=defaults)
  File "/Users/tchung/Desktop/jetpacksdk/jetpack-sdk-0.1/python-lib/cuddlefish/__init__.py", line 408, in run
    timeout=timeout)
  File "/Users/tchung/Desktop/jetpacksdk/jetpack-sdk-0.1/python-lib/cuddlefish/runner.py", line 114, in run_app
    kp_kwargs=popen_kwargs)
  File "/Users/tchung/Desktop/jetpacksdk/jetpack-sdk-0.1/python-lib/mozrunner/__init__.py", line 322, in __init__
    self.binary = self.find_binary()
  File "/Users/tchung/Desktop/jetpacksdk/jetpack-sdk-0.1/python-lib/mozrunner/__init__.py", line 379, in find_binary
    raise Exception('Mozrunner could not locate your binary, you will need to set it.')
Exception: Mozrunner could not locate your binary, you will need to set it.
(jetpack-sdk-0.1)Tony-Chungs-MacBook-Pro:jetpack-sdk-0.1 tchung$ 


But I do confirm cfx docs works.  Changing platform to all.
OS: Windows 7 → All
Hardware: x86_64 → All
Hmm, so I suspect that we should intercept this exception and re-raise one that says "please use the -b/--binary option to specify a binary for cfx to use".
(In reply to comment #3)
> Hmm, so I suspect that we should intercept this exception and re-raise one that
> says "please use the -b/--binary option to specify a binary for cfx to use".

That's a good idea, but we should also make sure that Mozrunner can locate binaries in conventional locations like C:\Program Files\Mozilla Firefox\firefox.exe, which is where the Firefox binary is on my Windows 7 machine where Mozrunner can't find it.
I think something unusual is happening on your system that doesn't have to do with where your Firefox is located: my Firefox is at the exact same location, and Mozrunner finds it without a problem. See Bug 554241 comment 9 for more thoughts on this.

What version of Python are you using? What happens if you put the following code in a .py file and run it?

  import os
  import subprocess

  DEFAULT_FIREFOX_PATH = 'c:\\Program Files\\Mozilla Firefox\\firefox.exe'

  print os.stat(DEFAULT_FIREFOX_PATH)
  f = open(DEFAULT_FIREFOX_PATH, 'r').close()
  subprocess.call([DEFAULT_FIREFOX_PATH])
Erm, sorry, I made a mistake.  Firefox is actually installed at C:\Program Files (x86)\Mozilla Firefox\firefox.exe on my system, which is 64-bit.  Specifying the binary works fine.  So the issue in my case is that Mozrunner doesn't look for Firefox in the 32-bit Program Files directory on 64-bit Windows systems.
Just filed bug 554709 for your problem.

It sounds like the solution to this particular bug, then, is just the one mentioned in comment 3?
(In reply to comment #7)
> Just filed bug 554709 for your problem.
> 
> It sounds like the solution to this particular bug, then, is just the one
> mentioned in comment 3?

Yes, that sounds right. However, we should also figure out Tony's problem; perhaps do that in a separate bug, since it's a different problem than the one for which you filed bug 554709.
Oh, true dat. Tony, where's your Firefox binary located?
i have a few.  but the one i was trying to reference is at:

/Users/tchung/Desktop/Fx36/Firefox.app/Contents/MacOS

So within the jetpack sdk folder, i was trying to run:

cfx testall -b /Users/tchung/Desktop/Fx36/Firefox.app/Contents/MacOS

and error now returns:
OSError: [Errno 13] Permission denied
aha!  my bad.

i needed to run 

cfx testall -b /Users/tchung/Desktop/Fx36/Firefox.app/Contents/MacOS/firefox-bin


Result:
Testing all available packages: test-harness, jetpack-core.
............................................................................................................................................................................................
Malloc bytes allocated (in use by application): 8465680
Malloc bytes mapped (not necessarily committed): 29257728
Malloc bytes committed (r/w) in default zone: 8464880
Malloc bytes allocated (in use) in default zone: 25063424
Tracked memory objects in testing sandbox: 2

188 of 188 tests passed.
OK
Total time: 4.510151 seconds
Program terminated successfully.


That look about right?
That looks exactly right!  So I guess there isn't a bug there after all, it's just that your copy of Firefox is installed in a non-default location, necessitating the use of the -b/--binary flag to specify it for Mozrunner.
cool, i'll resolve this wfm.   will continue through the tutorial.  thanks guys.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
Actually, I do think this is a bug though, in that "Mozrunner could not locate your binary" doesn't help the user figure out how to fix the problem. :)  So as I mentioned in comment 3, we should at the very least change this error to be more friendly, letting the end-user know they need to use the "-b/--binary" option.

Reopening this bug to ensure that this gets done... Let me know if you disagree though!
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
fine by me.  i'll just mention though, that im' a power user that has multiple versions of firefox running (release, branch, trunk, debug builds, etc..) with multiple profiles for each scenario.  these all exists in custom directories i create, and not the default /applications or /Program Files/Firefox or whatever.   So how you plan to fix -b to point to the selected location of a certain mozrunner binary may be something you want to consider for your power users!
Attached patch patch 1Splinter Review
Assignee: nobody → avarma
Pushed: http://hg.mozilla.org/labs/jetpack-sdk/rev/9643c45b8953
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → FIXED
The Add-on SDK is no longer a Mozilla Labs experiment and has become a big enough project to warrant its own Bugzilla product, so the "Add-on SDK" product has been created for it, and I am moving its bugs to that product.

To filter bugmail related to this change, filter on the word "looptid".
Component: Jetpack SDK → General
Product: Mozilla Labs → Add-on SDK
QA Contact: jetpack-sdk → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: