Closed Bug 822479 Opened 11 years ago Closed 11 years ago

Detect bad MOZ_HOST_BIN and report specific, helpful error message

Categories

(Testing :: General, defect)

x86
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 826135

People

(Reporter: gbrown, Unassigned)

Details

A common problem for people running remote tests (like mochitest-remote) on their local device is an incorrect MOZ_HOST_BIN. Often, this is mistakenly set to point to the Android build, rather than the desktop build. The resulting error does not explicitly identify the problem, prolonging developer pain. 

I would like to see something like "ERROR: unable to execute xpcshell on local computer; is your MOZ_HOST_BIN set correctly?"

I am not sure how to detect this.
Here's an example of what we get today:

    ddahl@X220:~/code/moz/mobile/src/objdir-droid$ TEST_PATH=dom/tests/mochitest/crypto/test_gRandomValues.html make mochitest-remote
    Android Debug Bridge version 1.0.31
     
    cp: can't create '/mnt/sdcard/tests/sanity/tmpfile': Permission denied
    rm: descend into directory '/mnt/sdcard/tests/sanity'? y
    will use zip to push directories
    {}
    {}
    6 KB/s (287 bytes in 0.045s)
    INFO | runtests.py | Installing extension at /home/ddahl/code/moz/mobile/src/objdir-droid/_tests/testing/mochitest/extensions/specialpowers to /tmp/tmpjkzv69.
    INFO | runtests.py | Installing extension at /home/ddahl/code/moz/mobile/src/objdir-droid/_tests/testing/mochitest/extensions/roboextender@mozilla.org to /tmp/tmpjkzv69.
    INFO | runtests.py | Installing extension at /home/ddahl/code/moz/mobile/src/objdir-droid/_tests/testing/mochitest/extensions/worker to /tmp/tmpjkzv69.
    INFO | runtests.py | Installing extension at /home/ddahl/code/moz/mobile/src/objdir-droid/_tests/testing/mochitest/extensions/workerbootstrap to /tmp/tmpjkzv69.
    1199 KB/s (125545 bytes in 0.102s)
    args: ['/home/ddahl/code/moz/mobile/src/objdir-droid/dist/bin/xpcshell', '-g', '/home/ddahl/code/moz/mobile/src/objdir-droid/dist/bin', '-v', '170', '-f', './httpd.js', '-e', "const _PROFILE_PATH = '/tmp/tmp3uZA7S';const _SERVER_PORT = '8888'; const _SERVER_ADDR = '192.168.1.6';\n                     const _TEST_PREFIX = undefined; const _DISPLAY_RESULTS = false;", '-f', './server.js']
    Automation Error: Exception caught while running tests
    Traceback (most recent call last):
      File "_tests/testing/mochitest/runtestsremote.py", line 540, in main
      File "/home/ddahl/code/moz/mobile/src/objdir-droid/_tests/testing/mochitest/runtests.py", line 700, in runTests
        self.startWebServer(options)
      File "_tests/testing/mochitest/runtestsremote.py", line 271, in startWebServer
      File "/home/ddahl/code/moz/mobile/src/objdir-droid/_tests/testing/mochitest/runtests.py", line 406, in start
        self._process = self._automation.Process([xpcshell] + args, env = env)
      File "/home/ddahl/code/moz/mobile/src/objdir-droid/_tests/testing/mochitest/automation.py", line 179, in __init__
        universal_newlines, startupinfo, creationflags)
      File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
        errread, errwrite)
      File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
        raise child_exception
    OSError: [Errno 8] Exec format error
    Traceback (most recent call last):
      File "_tests/testing/mochitest/runtestsremote.py", line 558, in <module>
        main()
      File "_tests/testing/mochitest/runtestsremote.py", line 544, in main
        mochitest.stopWebServer(options)
      File "_tests/testing/mochitest/runtestsremote.py", line 284, in stopWebServer
        self.server.stop()
      File "/home/ddahl/code/moz/mobile/src/objdir-droid/_tests/testing/mochitest/runtests.py", line 437, in stop
        self._process.kill()
    AttributeError: MochitestServer instance has no attribute '_process'
    make: *** [mochitest-remote] Error 1
one thought is runtestsremote.py could sanity check the stdout/stderr from trying to launch the binary on the system.  If it matches a known pattern we could determine that we do not have a proper binary or environment to run the application.  In this case we can suggest via a nice error message that:
"We are unable to run '<path>/xpcshell', please ensure that you can run this binary and that it is built for your local host computer"
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.