Ejemplo n.º 1
0
    def test_remove_app(self):
        setup = Setup()
        setup._setup = dummy_setup()

        setup.remove_app('app2')

        expected = {
            'app1': {
                'func1': {
                    'traced': False,
                    'parameters': {},
                    'mangled': 'mangledfunc1'
                },
                'func3': {
                    'traced': False,
                    'parameters': {},
                    'mangled': 'mangledfunc3'
                }
            }
        }
        self.assertEqual(setup._setup, expected)
Ejemplo n.º 2
0
 def test_init_binary_raises_error_if_binary_already_added(self):
     setup = Setup()
     setup._setup = dummy_setup()
     with self.assertRaises(BinaryAlreadyAddedError):
         setup.initialize_binary('app1')
Ejemplo n.º 3
0
 def test_init_binary_raises_error_if_binary_not_exists(self):
     setup = Setup()
     with self.assertRaises(BinaryNotExistsError):
         setup.initialize_binary('non_existent_app')
Ejemplo n.º 4
0
 def test_remove_function_from_trace_raises_error_if_function_not_exists(
         self):
     setup = Setup()
     setup._setup = dummy_setup()
     with self.assertRaises(FunctionNotInBinaryError):
         setup.remove_function_from_trace('app1', 'func4')
Ejemplo n.º 5
0
 def test_load_from_file_adds_built_in_if_binary_not_found(
         self, read, load):
     setup = Setup()
     setup.load_from_file('dummy/path')
     self.assertIn('built-ins', setup._setup)
     self.assertIn('dummy_built_in', setup._setup['built-ins'])
Ejemplo n.º 6
0
 def test_get_offset_for_function_no_match(self, check_output):
     setup = Setup()
     result = setup.get_offset_for_function('app', 'func')
     expected = 0
     self.assertEqual(result, expected)
Ejemplo n.º 7
0
 def test_get_offset_for_function_extra_lines(self, check_output):
     setup = Setup()
     result = setup.get_offset_for_function('app', 'func2')
     expected = 8
     self.assertEqual(result, expected)
Ejemplo n.º 8
0
 def test_get_offset_for_function_hexadecimal(self, check_output):
     setup = Setup()
     result = setup.get_offset_for_function('app', 'func1')
     expected = 26
     self.assertEqual(result, expected)
Ejemplo n.º 9
0
 def test_get_offset_for_built_in_non_existing(self):
     setup = Setup()
     with self.assertRaises(BuiltInNotExistsError):
         setup.get_offset_for_built_in('no_such_built_in')
Ejemplo n.º 10
0
 def test_get_offset_for_built_in_no_match(self, check_output):
     setup = Setup()
     result = setup.get_offset_for_built_in('builtin_func')
     expected = 0
     self.assertEqual(result, expected)