Lines Matching refs:self

55     def setUp(self):  argument
58 self.elf_file_path = os.path.join(dir_path, 'elf', 'testing',
60 self.elf_file = elf.ElfParser(self.elf_file_path)
62 def tearDown(self): argument
64 self.elf_file.Close()
66 def testGetSectionName(self): argument
68 sh_names = [self.elf_file.GetSectionName(sh)
69 for sh in self.elf_file.Shdr]
70 self.assertFalse(_SECTION_NAMES.difference(sh_names))
72 def testGetSectionsByName(self): argument
74 none_secs = list(self.elf_file.GetSectionsByName('no.such.section'))
75 dup_secs = list(self.elf_file.GetSectionsByName('test.dup'))
76 self.assertEqual(len(none_secs), 0)
77 self.assertEqual(len(dup_secs), 2)
79 def testGetSectionByName(self): argument
81 none_sec = self.elf_file.GetSectionByName('no.such.section')
82 self.assertEqual(none_sec, None)
84 sh = self.elf_file.GetSectionByName(section_name)
85 self.assertIsNotNone(sh)
87 def testGetSymbols(self): argument
89 symtab = self.elf_file.GetSectionByName('.symtab')
90 strtab = self.elf_file.Shdr[symtab.sh_link]
91 syms = self.elf_file.GetSymbols(symtab)
92 sym_names = [self.elf_file.GetString(strtab, sym.st_name)
94 self.assertFalse(_EXPORTED_SYMBOLS.difference(sym_names))
96 def testGetRelocations(self): argument
98 reltab = self.elf_file.GetSectionByName('.rela.dyn')
99 symtab = self.elf_file.Shdr[reltab.sh_link]
100 strtab = self.elf_file.Shdr[symtab.sh_link]
102 for rela in self.elf_file.GetRelocations(reltab):
103 sym = self.elf_file.GetRelocationSymbol(symtab, rela)
104 sym_name = self.elf_file.GetString(strtab, sym.st_name)
106 self.assertFalse(_RELOCATIONS.difference(relocs))
108 def testGetRelocations_Android(self): argument
110 android_rela = self.elf_file.GetSectionByName('test.rela')
112 for rela in self.elf_file.GetRelocations(android_rela):
114 self.assertEqual(relocs, _ANDROID_RELOCATIONS)
116 def testGetRelocations_Relr(self): argument
118 reltab = self.elf_file.GetSectionByName('.relr.dyn')
122 for rela in self.elf_file.GetRelocations(reltab):
124 self.assertEqual(relocs, _RELR_RELOCATIONS)
126 def testIsExecutable(self): argument
128 is_executable = self.elf_file.IsExecutable()
129 self.assertFalse(is_executable)
131 def testIsSharedObject(self): argument
133 is_shared_object = self.elf_file.IsSharedObject()
134 self.assertTrue(is_shared_object)
136 def testHasAndroidIdent(self): argument
138 has_android_ident = self.elf_file.HasAndroidIdent()
139 self.assertTrue(has_android_ident)
141 def testMatchCpuAbi(self): argument
143 self.assertTrue(self.elf_file.MatchCpuAbi("x86_64"))
144 self.assertFalse(self.elf_file.MatchCpuAbi("x86"))
146 def testListDependencies(self): argument
148 deps = self.elf_file.ListDependencies()
149 self.assertEqual(deps, _DEPENDENCIES)
151 def testListGlobalSymbols(self): argument
153 syms = self.elf_file.ListGlobalSymbols(False, '.dynsym', '.dynstr')
154 self.assertFalse(_EXPORTED_SYMBOLS.difference(syms))
156 def testGetProgramInterpreter(self): argument
158 interp = self.elf_file.GetProgramInterpreter()
159 self.assertEqual(interp, "/lib64/ld-linux-x86-64.so.2")