コード例 #1
0
ファイル: test_core.py プロジェクト: gapry/L4OS
    def test_replace_section(self):
        seg = SectionedElfSegment(sections=[UnpreparedElfSection("test")])
        old_section = seg.get_sections()[0]
        new_section = UnpreparedElfSection("new")
        seg.replace_section(old_section, new_section)
        self.assertEqual(seg.get_sections(), [new_section])
        new_seg = seg.copy()

        self.assertRaises(InvalidArgument, seg.replace_section, None, new_section)
コード例 #2
0
ファイル: test_core.py プロジェクト: saif1413/L4OS
    def test_replace_section(self):
        seg = SectionedElfSegment(sections=[UnpreparedElfSection("test")])
        old_section = seg.get_sections()[0]
        new_section = UnpreparedElfSection("new")
        seg.replace_section(old_section, new_section)
        self.assertEqual(seg.get_sections(), [new_section])
        new_seg = seg.copy()

        self.assertRaises(InvalidArgument, seg.replace_section, None,
                          new_section)
コード例 #3
0
    def test_replace_section(self):
        elf_from = UnpreparedElfFile()
        elf_to = UnpreparedElfFile()

        seg = SectionedElfSegment(elf_from, sections=[UnpreparedElfSection(elf_from, "test")])
        old_section = seg.get_sections()[0]
        new_section = UnpreparedElfSection(elf_to, "new")
        seg.replace_section(old_section, new_section)
        self.assertEqual(seg.get_sections(), [new_section])
        new_seg = seg.copy_into(elf_to)

        self.assertRaises(InvalidArgument, seg.replace_section, None, new_section)