Open Bug 1306133 Opened 8 years ago Updated 2 years ago

mach mochitest fails when --debugger is specified


(Testing :: Mochitest, defect)

Version 3


(Not tracked)


(Reporter: bugzilla, Unassigned)


Traceback (most recent call last):
  File "c:/Users/dblohm7/src/moz/obj-ff-prof-dbg\_tests\testing\mochitest\", line 2420, in doTests
  File "c:/Users/dblohm7/src/moz/obj-ff-prof-dbg\_tests\testing\mochitest\", line 2017, in runApp
  File "c:\Users\dblohm7\src\moz\testing/mozbase/mozrunner\mozrunner\base\", line 81, in start
    BaseRunner.start(self, *args, **kwargs)
  File "c:\Users\dblohm7\src\moz\testing/mozbase/mozrunner\mozrunner\base\", line 112, in start
    self.process_handler = subprocess.Popen(cmd, env=self.env)
  File "c:\Users\dblohm7\mozilla-build\python\lib\", line 710, in __init__
    errread, errwrite)
  File "c:\Users\dblohm7\mozilla-build\python\lib\", line 958, in _execute_child
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:

You can see that mozrunner uses the normal subprocess.Popen for interactive debuggers (where we're not capturing stdin/stdout), and mozprocess otherwise:
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.