示例#1
0
    def test_rewrite_apex_modules(self):
        graph = ELFLinker()

        libfoo = graph.add_lib(PT_SYSTEM, '/system/apex/foo/lib/libfoo.so',
                               ELF(ELF.ELFCLASS32, ELF.ELFDATA2LSB))
        libbar = graph.add_lib(PT_SYSTEM, '/system/apex/bar/lib/libbar.so',
                               ELF(ELF.ELFCLASS32, ELF.ELFDATA2LSB))

        graph.rewrite_apex_modules()

        self.assertEqual(libfoo.path, '/apex/foo/lib/libfoo.so')
        self.assertEqual(libbar.path, '/apex/bar/lib/libbar.so')
示例#2
0
    def test_link_apex_modules(self):
        graph = ELFLinker()

        libfoo = graph.add_lib(PT_SYSTEM, '/system/apex/foo/lib/libfoo.so',
                               ELF(ELF.ELFCLASS32, ELF.ELFDATA2LSB))
        libbar = graph.add_lib(
            PT_SYSTEM, '/system/lib/libbar.so',
            ELF(ELF.ELFCLASS32, ELF.ELFDATA2LSB, dt_needed=['libfoo.so']))

        graph.rewrite_apex_modules()
        graph.resolve_deps()

        self.assertIn(libfoo, libbar.deps_all)
示例#3
0
    def test_link_apex_bionic(self):
        graph = ELFLinker()

        libc = graph.add_lib(
            PT_SYSTEM, '/system/apex/com.android.runtime/lib/bionic/libc.so',
            ELF(ELF.ELFCLASS32, ELF.ELFDATA2LSB))
        libbar = graph.add_lib(
            PT_SYSTEM, '/system/lib/libbar.so',
            ELF(ELF.ELFCLASS32, ELF.ELFDATA2LSB, dt_needed=['libc.so']))

        graph.rewrite_apex_modules()
        graph.resolve_deps()

        self.assertIn(libc, libbar.deps_all)
 def __init__(self):
     self.graph = ELFLinker()