Exemplo n.º 1
0
 def testSyzyasanDetector(self):
   """Tests that ``SyzyasanDetector`` detects sysyasn callstack."""
   stack_detector = callstack_detectors.SyzyasanDetector()
   self.assertTupleEqual(
       stack_detector('Crash stack:'),
       StartOfCallStack(0, CallStackFormatType.SYZYASAN, LanguageType.CPP, {}))
   self.assertTupleEqual(
       stack_detector('A stack:'),
       StartOfCallStack(1, CallStackFormatType.SYZYASAN, LanguageType.CPP, {}))
   self.assertIsNone(stack_detector('dummy'))
Exemplo n.º 2
0
  def testChromeCrashDetector(self):
    """Tests that ``ChromeCrashDetector`` detects Fracas/Cracas callstack."""
    stack_detector = callstack_detectors.ChromeCrashStackDetector()

    self.assertTupleEqual(
        stack_detector('CRASHED [EXC @ 0x508]'),
        StartOfCallStack(0, CallStackFormatType.DEFAULT, LanguageType.CPP, {}))
    self.assertTupleEqual(
        stack_detector('(JAVA) CRASHED [EXC @ 0x508]'),
        StartOfCallStack(0, CallStackFormatType.DEFAULT, LanguageType.JAVA, {}))
    self.assertIsNone(stack_detector('dummy'))
Exemplo n.º 3
0
 def testUbsanDetector(self):
   """Tests that ``UbsanDetector`` detects ubsan callstack."""
   stack_detector = callstack_detectors.UbsanDetector()
   flag_manager = FlagManager()
   flag_manager.Register('group',
                         ParsingFlag('is_first_stack_flag', value=True))
   self.assertTupleEqual(
       stack_detector('blabla: runtime error: blabla', flag_manager),
       StartOfCallStack(0, CallStackFormatType.DEFAULT, LanguageType.CPP, {}))
   # After the ``is_first_stack_flag`` is set to False, the priority will be
   # 1.
   self.assertTupleEqual(
       stack_detector('blabla: runtime error: blabla', flag_manager),
       StartOfCallStack(1, CallStackFormatType.DEFAULT, LanguageType.CPP, {}))
   self.assertIsNone(stack_detector('dummy', flag_manager))
Exemplo n.º 4
0
 def testMsanDetector(self):
   """Tests that ``MsanDetector`` detects memory sanitizer callstack."""
   stack_detector = callstack_detectors.MsanDetector()
   self.assertTupleEqual(
       stack_detector('Uninitialized value was created by'),
       StartOfCallStack(0, CallStackFormatType.DEFAULT, LanguageType.CPP, {}))
   # After the ``is_first_stack_flag`` is set to False, the priority will be
   # 1.
   self.assertTupleEqual(
       stack_detector('Uninitialized value was stored to'),
       StartOfCallStack(1, CallStackFormatType.DEFAULT, LanguageType.CPP, {}))
   self.assertTupleEqual(
       stack_detector('==123== ERROR:MemorySanitizer'),
       StartOfCallStack(2, CallStackFormatType.DEFAULT, LanguageType.CPP,
                        {'pid': 123}))
   self.assertIsNone(stack_detector('dummy'))
Exemplo n.º 5
0
 def testTsanDetector(self):
   """Tests that ``TsanDetector`` detects thread sanitizer callstack."""
   stack_detector = callstack_detectors.TsanDetector()
   self.assertTupleEqual(
       stack_detector('Read of size 1023:'),
       StartOfCallStack(0, CallStackFormatType.DEFAULT, LanguageType.CPP, {}))
   self.assertTupleEqual(
       stack_detector('WARNING: ThreadSanitizer'),
       StartOfCallStack(0, CallStackFormatType.DEFAULT, LanguageType.CPP, {}))
   self.assertTupleEqual(
       stack_detector('Previous read of size 102'),
       StartOfCallStack(1, CallStackFormatType.DEFAULT, LanguageType.CPP, {}))
   self.assertTupleEqual(
       stack_detector('Location is heap block of size 3543'),
       StartOfCallStack(1, CallStackFormatType.DEFAULT, LanguageType.CPP, {}))
   self.assertIsNone(stack_detector('dummy'))
Exemplo n.º 6
0
  def testAndroidJobDetector(self):
    """Tests that ``AndroidJobDetector`` detects android job callstack."""
    stack_detector = callstack_detectors.AndroidJobDetector()
    flag_manager = FlagManager()
    flag_manager.Register('group',
                          ParsingFlag('java_main_stack_flag', value=True))

    self.assertTupleEqual(
        stack_detector('java.lang.IllegalStateException: blabla', flag_manager),
        StartOfCallStack(0, CallStackFormatType.JAVA, LanguageType.JAVA, {}))
    self.assertTupleEqual(
        stack_detector('org.chromium.src.BlaBla', flag_manager),
        StartOfCallStack(1, CallStackFormatType.JAVA, LanguageType.JAVA, {}))
    self.assertTupleEqual(
        stack_detector('Caused by:', flag_manager),
        StartOfCallStack(1, CallStackFormatType.JAVA, LanguageType.JAVA, {}))
    self.assertTupleEqual(
        stack_detector('com.google.android.BlaBla', flag_manager),
        StartOfCallStack(1, CallStackFormatType.JAVA, LanguageType.JAVA, {}))
    self.assertIsNone(stack_detector('dummy', flag_manager))
Exemplo n.º 7
0
 def testFromStartOfCallStack(self):
     """Tests ``FromStartOfCallStack`` with ``StartOfCallStack`` input."""
     start_of_callstack = StartOfCallStack(0, CallStackFormatType.DEFAULT,
                                           LanguageType.CPP, {'pid': 123})
     stack_buffer = CallStackBuffer.FromStartOfCallStack(start_of_callstack)
     self.assertEqual(stack_buffer.priority, start_of_callstack.priority)
     self.assertEqual(stack_buffer.format_type,
                      start_of_callstack.format_type)
     self.assertEqual(stack_buffer.language_type,
                      start_of_callstack.language_type)
     self.assertDictEqual(stack_buffer.metadata,
                          start_of_callstack.metadata)
Exemplo n.º 8
0
 def testAsanDetector(self):
   """Tests that ``AsanDetector`` detects address sanitizer callstack."""
   stack_detector = callstack_detectors.AsanDetector()
   self.assertTupleEqual(
       stack_detector('==123== ERROR:AddressSanitizer'),
       StartOfCallStack(0, CallStackFormatType.DEFAULT, LanguageType.CPP,
                        {'pid': 123}))
   # After the ``is_first_stack_flag`` is set to False, the priority will be
   # 1.
   self.assertTupleEqual(
       stack_detector('READ of size 32 at backtrace:'),
       StartOfCallStack(0, CallStackFormatType.DEFAULT, LanguageType.CPP, {}))
   self.assertTupleEqual(
       stack_detector('freed by thread T99 here:'),
       StartOfCallStack(1, CallStackFormatType.DEFAULT, LanguageType.CPP, {}))
   self.assertTupleEqual(
       stack_detector('previously allocated by thread T1 here:'),
       StartOfCallStack(1, CallStackFormatType.DEFAULT, LanguageType.CPP, {}))
   self.assertTupleEqual(
       stack_detector('Thread T9 created by'),
       StartOfCallStack(1, CallStackFormatType.DEFAULT, LanguageType.CPP, {}))
   self.assertIsNone(stack_detector('dummy'))