def main():
    logger = logging.getLogger()
    hdlr = logging.StreamHandler()
    logger.addHandler(hdlr)

    parser = OptionParser()
    parser.add_option('', '--debug', dest='debug', action='store_true', help='Enable debug messages (overrides --verbose)')
    parser.add_option('', '--verbose', dest='verbose', action='store_true', help='Enable verbose messages')
    (options, args) = parser.parse_args()

    if options.debug:
        logger.setLevel(logging.DEBUG)
    elif options.verbose:
        logger.setLevel(logging.INFO)
    else:
        logger.setLevel(logging.WARNING)

    for f in args:
        debugger = os.path.splitext(f)[1]
        if debugger == '.gdb':
            g = GDBfile(f)
        elif debugger == '.cw':
            g = CWfile(f)
        elif debugger == '':
            parser.error('No file suffix found, but \'.gdb\' or \'.cw\' expected')
        else:
            parser.error('Unknown file suffix \'%s\' found, but \'.gdb\' or \'.cw\' expected' % debugger)
        print 'Signature=%s' % g.get_testcase_signature(5)
        if g.registers_hex.get(g.pc_name):
            print 'PC=%s' % g.registers_hex[g.pc_name]
Ejemplo n.º 2
0
    def test_get_testcase_signature(self):
        gdbf = GDBfile(self.file)
        self.assertFalse(gdbf._hashable_backtrace())

        gdbf.lines.append('#0 0x11111111 in ??')
        gdbf.lines.append('#1 0x22222222 in foo at foo.c:80')
        gdbf.lines.append('#2 0x33333333 in bar')

        gdbf._process_lines()
        gdbf._hashable_backtrace()
        self.assertEqual(gdbf.get_testcase_signature(1),
                         hashlib.md5('0x11111111').hexdigest())
        self.assertEqual(gdbf.get_testcase_signature(2),
                         hashlib.md5('0x11111111 foo.c:80').hexdigest())
        self.assertEqual(
            gdbf.get_testcase_signature(3),
            hashlib.md5('0x11111111 foo.c:80 0x33333333').hexdigest())
Ejemplo n.º 3
0
def main():
    logger = logging.getLogger()
    hdlr = logging.StreamHandler()
    logger.addHandler(hdlr)

    parser = OptionParser()
    parser.add_option('',
                      '--debug',
                      dest='debug',
                      action='store_true',
                      help='Enable debug messages (overrides --verbose)')
    parser.add_option('',
                      '--verbose',
                      dest='verbose',
                      action='store_true',
                      help='Enable verbose messages')
    (options, args) = parser.parse_args()

    if options.debug:
        logger.setLevel(logging.DEBUG)
    elif options.verbose:
        logger.setLevel(logging.INFO)
    else:
        logger.setLevel(logging.WARNING)

    for f in args:
        debugger = os.path.splitext(f)[1]
        if debugger == '.gdb':
            g = GDBfile(f)
        elif debugger == '.cw':
            g = CWfile(f)
        elif debugger == '':
            parser.error(
                'No file suffix found, but \'.gdb\' or \'.cw\' expected')
        else:
            parser.error(
                'Unknown file suffix \'%s\' found, but \'.gdb\' or \'.cw\' expected'
                % debugger)
        print 'Signature=%s' % g.get_testcase_signature(5)
        if g.registers_hex.get(g.pc_name):
            print 'PC=%s' % g.registers_hex[g.pc_name]