'Check that the fault handler for fatal errors is enabled and check the
traceback from the child process output.
Raise an error if the output doesn\'t match the expected format.'

def check_fatal_error(self, code, line_number, name_regex, filename=None, all_threads=True, other_regex=None):

    if all_threads:
        header = 'Current    thread    XXX    (most    recent    call    first)'
    else:
        header = 'Stack    (most    recent    call    first)'
    regex = '\n                                                ^Fatal    Python    error:    {name}\n\n                                                {header}:\n                                                        File    "<string>",    line    {lineno}    in    <module>\n                                                '
    regex = dedent(regex.format(lineno=line_number, name=name_regex, header=re.escape(header))).strip()
    if other_regex:
        regex += ('|' + other_regex)
    (output, exitcode) = self.get_output(code, filename)
    output = '\n'.join(output)
    self.assertRegex(output, regex)
    self.assertNotEqual(exitcode, 0)
