Open Bug 1306133 Opened 3 years ago Updated 3 years ago

mach mochitest fails when --debugger is specified

Categories

(Testing :: Mochitest, defect)

Version 3
defect
Not set

Tracking

(Not tracked)

People

(Reporter: aklotz, Unassigned)

Details

Traceback (most recent call last):
  File "c:/Users/dblohm7/src/moz/obj-ff-prof-dbg\_tests\testing\mochitest\runtests.py", line 2420, in doTests
    marionette_args=marionette_args,
  File "c:/Users/dblohm7/src/moz/obj-ff-prof-dbg\_tests\testing\mochitest\runtests.py", line 2017, in runApp
    outputTimeout=timeout)
  File "c:\Users\dblohm7\src\moz\testing/mozbase/mozrunner\mozrunner\base\browser.py", line 81, in start
    BaseRunner.start(self, *args, **kwargs)
  File "c:\Users\dblohm7\src\moz\testing/mozbase/mozrunner\mozrunner\base\runner.py", line 112, in start
    self.process_handler = subprocess.Popen(cmd, env=self.env)
  File "c:\Users\dblohm7\mozilla-build\python\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "c:\Users\dblohm7\mozilla-build\python\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
TypeError: environment can only contain strings


Dumping the enviornment being passed into subprocess.Popen, I see that the value of the MOZ_GMP_PATH variable is of type unicode when all other values of the environment are strings.

The odd thing about this is that the unicode MOZ_GMP_PATH is present in both debugging and non-debugging contexts, but for some reason it only causes a failure in the debugging case.

Wrapping the insertion of that entry into the environment dict to be a string results in a successful launch of the debugger.
Also note that the unicode originates from options.gmp_path which is derived from build_obj.bindir. I'm not sure where the right place is to convert this stuff to a regular string.
On Windows, when not using a debugger, we use a special subclass of Popen which re-implements _execute_child so it can create a new process group, so it wouldn't hit that built-in code in the subprocess module:
https://dxr.mozilla.org/mozilla-central/rev/b1d60f2f68c7cccc96fcf9a2075bb430a500a0f2/testing/mozbase/mozprocess/mozprocess/processhandler.py#208

You can see that mozrunner uses the normal subprocess.Popen for interactive debuggers (where we're not capturing stdin/stdout), and mozprocess otherwise:
https://dxr.mozilla.org/mozilla-central/rev/b1d60f2f68c7cccc96fcf9a2075bb430a500a0f2/testing/mozbase/mozrunner/mozrunner/base/runner.py#104
You need to log in before you can comment on or make changes to this bug.