Closed Bug 1638965 Opened 4 months ago Closed 4 months ago

Convert 'mach gtest' to run with Python 3

Categories

(Testing :: General, task, P3)

task

Tracking

(firefox78 fixed)

RESOLVED FIXED
mozilla78
Tracking Status
firefox78 --- fixed

People

(Reporter: KrisWright, Assigned: gbrown)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

mach gtest still runs with python 2 [1]. We want to convert all mach commands to python 3.

To do this, any dependencies of the command may need to be converted as well as the command itself.

[1] https://searchfox.org/mozilla-central/rev/9193635dca8cfdcb68f114306194ffc860456044/python/mozbuild/mozbuild/mach_commands.py

Severity: -- → S3
Keywords: in-triage
Priority: -- → P3
Severity: S3 → --
Keywords: in-triage
Priority: P3 → --
Product: Firefox Build System → Testing
Assignee: nobody → gbrown
Severity: -- → S3
Priority: -- → P3

On desktop, 'mach gtest' seems to work, but reports non-fatal errors:

--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.6/logging/__init__.py", line 994, in emit
    msg = self.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 840, in format
    return fmt.format(record)
  File "/home/gbrown/src/python/mach/mach/logging.py", line 67, in format
    return json.dumps([record.created, action, params])
  File "/usr/lib/python3.6/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.6/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.6/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
TypeError: keys must be a string
Call stack:
  File "./mach", line 232, in <module>
    main(sys.argv[1:])
  File "./mach", line 228, in main
    sys.exit(mach.run(args))
  File "/home/gbrown/src/python/mach/mach/main.py", line 360, in run
    return self._run(argv)
  File "/home/gbrown/src/python/mach/mach/main.py", line 475, in _run
    **vars(args.command_args))
  File "/home/gbrown/src/python/mach/mach/registrar.py", line 109, in _run_command_handler
    result = fn(**kwargs)
  File "/home/gbrown/src/python/mozbuild/mozbuild/mach_commands.py", line 565, in gtest
    pass_thru=True)
  File "/home/gbrown/src/python/mach/mach/mixin/process.py", line 115, in run_process
    self.log(logging.DEBUG, 'process', {'env': use_env}, 'Environment: {env}')
  File "/home/gbrown/src/python/mach/mach/mixin/logging.py", line 54, in log
    extra={'action': action, 'params': params})
Message: 'Environment: {env}'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.6/logging/__init__.py", line 994, in emit
    msg = self.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 840, in format
    return fmt.format(record)
  File "/home/gbrown/src/python/mach/mach/logging.py", line 67, in format
    return json.dumps([record.created, action, params])
  File "/usr/lib/python3.6/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.6/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.6/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
TypeError: keys must be a string
Call stack:
  File "./mach", line 232, in <module>
    main(sys.argv[1:])
  File "./mach", line 228, in main
    sys.exit(mach.run(args))
  File "/home/gbrown/src/python/mach/mach/main.py", line 360, in run
    return self._run(argv)
  File "/home/gbrown/src/python/mach/mach/main.py", line 475, in _run
    **vars(args.command_args))
  File "/home/gbrown/src/python/mach/mach/registrar.py", line 109, in _run_command_handler
    result = fn(**kwargs)
  File "/home/gbrown/src/python/mozbuild/mozbuild/mach_commands.py", line 565, in gtest
    pass_thru=True)
  File "/home/gbrown/src/python/mach/mach/mixin/process.py", line 115, in run_process
    self.log(logging.DEBUG, 'process', {'env': use_env}, 'Environment: {env}')
  File "/home/gbrown/src/python/mach/mach/mixin/logging.py", line 54, in log
    extra={'action': action, 'params': params})
Message: 'Environment: {env}'
Arguments: ()

Pushed by gbrown@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cb9093694c0a
Run 'mach gtest' in python 3; r=bc
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
You need to log in before you can comment on or make changes to this bug.