Bug 1188551: treat assertion failures as bad mozconfig; r=mshal

--HG--
extra : commitid : HZsljZRs5uw
extra : rebase_source : 8afac350c5a582d37f01f549e50f429cd6a4b1be
This commit is contained in:
Dustin J. Mitchell 2015-07-29 14:14:05 -04:00
parent 78a7f7fb69
commit 81154a1440

View File

@ -8,6 +8,7 @@ import filecmp
import os
import re
import subprocess
import traceback
from collections import defaultdict
from mach.mixin.process import ProcessExecutionMixin
@ -31,6 +32,13 @@ by a command inside your mozconfig failing. Please change your mozconfig
to not error and/or to catch errors in executed commands.
'''.strip()
MOZCONFIG_BAD_OUTPUT = '''
Evaluation of your mozconfig produced unexpected output. This could be
triggered by a command inside your mozconfig failing or producing some warnings
or error messages. Please change your mozconfig to not error and/or to catch
errors in executed commands.
'''.strip()
class MozconfigFindException(Exception):
"""Raised when a mozconfig location is not defined properly."""
@ -234,7 +242,17 @@ class MozconfigLoader(ProcessExecutionMixin):
raise MozconfigLoadException(path, MOZCONFIG_BAD_EXIT_CODE, lines)
parsed = self._parse_loader_output(output)
try:
parsed = self._parse_loader_output(output)
except AssertionError:
# _parse_loader_output uses assertions to verify the
# well-formedness of the shell output; when these fail, it
# generally means there was a problem with the output, but we
# include the assertion traceback just to be sure.
print('Assertion failed in _parse_loader_output:')
traceback.print_exc()
raise MozconfigLoadException(path, MOZCONFIG_BAD_OUTPUT,
output.splitlines())
def diff_vars(vars_before, vars_after):
set1 = set(vars_before.keys()) - self.IGNORE_SHELL_VARIABLES