Beispiel #1
0
 def test_hash_different(self):
     stack1 = OptStacktrace.parse('dxl', dxl=os.path.join(os.path.dirname(sys.modules[self.__class__.__module__].__file__), 'test.dxl'))
     self.assertIsNotNone(stack1)
     stack2 = OptStacktrace.parse('dxl', dxl=os.path.join(os.path.dirname(sys.modules[self.__class__.__module__].__file__), 'test2.dxl'))
     self.assertIsNotNone(stack2)
     thread1 = stack1.get_thread(0)
     thread2 = stack2.get_thread(0)
     self.assertNotEqual(thread1.hash(5), thread2.hash(5))
Beispiel #2
0
 def test_hash_number_of_frames(self):
     stack = OptStacktrace.parse('dxl', dxl=os.path.join(os.path.dirname(sys.modules[self.__class__.__module__].__file__), 'test.dxl'))
     self.assertIsNotNone(stack)
     thread = stack.get_thread(0)
     hash1 = thread.hash(4)
     hash2 = thread.hash(3)
     self.assertNotEqual(hash1, hash2)
Beispiel #3
0
 def test_opt_stacktrace_thread(self):
    stack = OptStacktrace.parse('dxl', dxl=os.path.join(os.path.dirname(sys.modules[self.__class__.__module__].__file__), 'test.dxl'))
    thread = stack.get_thread(0)
    self.assertIsNotNone(thread)
    self.assertEqual(thread.number, 0)
    self.assertEqual(len(thread.frames), 8)
    self.assertTrue(len(thread.text) > 0)
Beispiel #4
0
 def test_hash_different(self):
     stack1 = OptStacktrace.parse(
         'dxl',
         dxl=os.path.join(
             os.path.dirname(
                 sys.modules[self.__class__.__module__].__file__),
             'test.dxl'))
     self.assertIsNotNone(stack1)
     stack2 = OptStacktrace.parse(
         'dxl',
         dxl=os.path.join(
             os.path.dirname(
                 sys.modules[self.__class__.__module__].__file__),
             'test2.dxl'))
     self.assertIsNotNone(stack2)
     thread1 = stack1.get_thread(0)
     thread2 = stack2.get_thread(0)
     self.assertNotEqual(thread1.hash(5), thread2.hash(5))
Beispiel #5
0
 def test_first_relevant_stack_frame(self):
     stack = OptStacktrace.parse('dxl', dxl=os.path.join(os.path.dirname(sys.modules[self.__class__.__module__].__file__), 'test.dxl'))
     self.assertIsNotNone(stack)
     thread = stack.get_thread(0)
     frame = thread.get_first_relevant_frame()
     self.assertEqual(frame.function, 'gpdxl::CDXLUtils::PphdxlParseDXLFile')
     self.assertEqual(frame.number, 2)
     self.assertEqual(frame.address, '0x0000000001ba33b8')
     self.assertEqual(frame.line, 888)
     self.assertEqual(frame.file, None)
     self.assertEqual(frame.text, '2    0x0000000001ba33b8 gpdxl::CDXLUtils::PphdxlParseDXLFile + 888')    
Beispiel #6
0
 def test_opt_stackt_frame(self):
    stack = OptStacktrace.parse('dxl', dxl=os.path.join(os.path.dirname(sys.modules[self.__class__.__module__].__file__), 'test.dxl'))
    thread = stack.get_thread(0)
    self.assertIsNotNone(thread)
    frame = thread.frames[0]
    self.assertEqual(frame.function, 'gpos::CException::Raise')
    self.assertEqual(frame.number, 1)
    self.assertEqual(frame.address, '0x00000000013313a5')
    self.assertEqual(frame.line, 165)
    self.assertEqual(frame.file, None)
    self.assertEqual(frame.text, '1    0x00000000013313a5 gpos::CException::Raise + 165')
Beispiel #7
0
 def test_sanity_construction(self):
     stack = OptStacktrace.parse(
         'dxl',
         dxl=os.path.join(
             os.path.dirname(
                 sys.modules[self.__class__.__module__].__file__),
             'test.dxl'))
     self.assertIsNotNone(stack)
     self.assertTrue(len(stack.text) > 0)
     self.assertEqual(stack.binary, 'postgres')
     self.assertEqual(len(stack.threads), 1)
Beispiel #8
0
 def test_opt_stacktrace_thread(self):
     stack = OptStacktrace.parse(
         'dxl',
         dxl=os.path.join(
             os.path.dirname(
                 sys.modules[self.__class__.__module__].__file__),
             'test.dxl'))
     thread = stack.get_thread(0)
     self.assertIsNotNone(thread)
     self.assertEqual(thread.number, 0)
     self.assertEqual(len(thread.frames), 8)
     self.assertTrue(len(thread.text) > 0)
Beispiel #9
0
 def test_hash_with_fewer_frames(self):
     stack = OptStacktrace.parse(
         'dxl',
         dxl=os.path.join(
             os.path.dirname(
                 sys.modules[self.__class__.__module__].__file__),
             'test3.dxl'))
     self.assertIsNotNone(stack)
     thread = stack.get_thread(0)
     hash1 = thread.hash(10)
     hash2 = thread.hash(3)
     self.assertEqual(hash1, hash2)
Beispiel #10
0
 def test_opt_stackt_frame(self):
     stack = OptStacktrace.parse(
         'dxl',
         dxl=os.path.join(
             os.path.dirname(
                 sys.modules[self.__class__.__module__].__file__),
             'test.dxl'))
     thread = stack.get_thread(0)
     self.assertIsNotNone(thread)
     frame = thread.frames[0]
     self.assertEqual(frame.function, 'gpos::CException::Raise')
     self.assertEqual(frame.number, 1)
     self.assertEqual(frame.address, '0x00000000013313a5')
     self.assertEqual(frame.line, 165)
     self.assertEqual(frame.file, None)
     self.assertEqual(
         frame.text,
         '1    0x00000000013313a5 gpos::CException::Raise + 165')
Beispiel #11
0
 def test_first_relevant_stack_frame(self):
     stack = OptStacktrace.parse(
         'dxl',
         dxl=os.path.join(
             os.path.dirname(
                 sys.modules[self.__class__.__module__].__file__),
             'test.dxl'))
     self.assertIsNotNone(stack)
     thread = stack.get_thread(0)
     frame = thread.get_first_relevant_frame()
     self.assertEqual(frame.function,
                      'gpdxl::CDXLUtils::PphdxlParseDXLFile')
     self.assertEqual(frame.number, 2)
     self.assertEqual(frame.address, '0x0000000001ba33b8')
     self.assertEqual(frame.line, 888)
     self.assertEqual(frame.file, None)
     self.assertEqual(
         frame.text,
         '2    0x0000000001ba33b8 gpdxl::CDXLUtils::PphdxlParseDXLFile + 888'
     )
Beispiel #12
0
 def test_sanity_construction(self):
     stack = OptStacktrace.parse('dxl', dxl=os.path.join(os.path.dirname(sys.modules[self.__class__.__module__].__file__), 'test.dxl'))
     self.assertIsNotNone(stack)
     self.assertTrue(len(stack.text) > 0)
     self.assertEqual(stack.binary, 'postgres')
     self.assertEqual(len(stack.threads), 1)