コード例 #1
0
ファイル: test_fragments.py プロジェクト: huybk213/esp-idf
    def test_flag_order(self):
        # Test that the order in which the flags are specified is retained
        test_fragment = self.create_fragment_file(u"""
[mapping:map]
archive: libmain.a
entries:
    obj1 (default);
        text->flash_text ALIGN(4) KEEP() SURROUND(sym1) ALIGN(8) SORT(name),
        rodata->flash_rodata KEEP() ALIGN(4) KEEP() SURROUND(sym1) ALIGN(8) ALIGN(4) SORT(name)
""")
        fragment_file = FragmentFile(test_fragment, self.sdkconfig)
        fragment = fragment_file.fragments[0]

        expected = [('text', 'flash_text', [
            Mapping.Align(4, True, False),
            Mapping.Keep(),
            Mapping.Surround('sym1'),
            Mapping.Align(8, True, False),
            Mapping.Sort('name')
        ]),
                    ('rodata', 'flash_rodata', [
                        Mapping.Keep(),
                        Mapping.Align(4, True, False),
                        Mapping.Keep(),
                        Mapping.Surround('sym1'),
                        Mapping.Align(8, True, False),
                        Mapping.Align(4, True, False),
                        Mapping.Sort('name')
                    ])]
        actual = fragment.flags[('obj1', None, 'default')]
        self.assertEqual(expected, actual)
コード例 #2
0
ファイル: test_fragments.py プロジェクト: huybk213/esp-idf
    def test_flags_entries_multiple_flags_and_entries(self):
        # Not an error, generation step handles this, since
        # it that step has a more complete information
        # about all mappings. This can happen across multiple
        # mapping fragments.
        test_fragment = self.create_fragment_file(u"""
[mapping:map]
archive: libmain.a
entries:
    obj1 (default);
        text->flash_text ALIGN(4) KEEP() SURROUND(sym1) SORT(name)
    obj1 (default);
        text->flash_text ALIGN(4) KEEP() SURROUND(sym1) SORT(name)
""")
        fragment_file = FragmentFile(test_fragment, self.sdkconfig)
        fragment = fragment_file.fragments[0]

        expected = [('text', 'flash_text', [
            Mapping.Align(4, True, False),
            Mapping.Keep(),
            Mapping.Surround('sym1'),
            Mapping.Sort('name')
        ]),
                    ('text', 'flash_text', [
                        Mapping.Align(4, True, False),
                        Mapping.Keep(),
                        Mapping.Surround('sym1'),
                        Mapping.Sort('name')
                    ])]
        actual = fragment.flags[('obj1', None, 'default')]
        self.assertEqual(expected, actual)
コード例 #3
0
ファイル: test_fragments.py プロジェクト: huybk213/esp-idf
    def test_keep_flag(self):
        # Test parsing combinations and orders of flags
        test_fragment = self.create_fragment_file(u"""
[mapping:map]
archive: libmain.a
entries:
    obj1 (default);
        text->flash_text KEEP(),
        rodata->flash_rodata KEEP() KEEP()
""")
        fragment_file = FragmentFile(test_fragment, self.sdkconfig)

        fragment = fragment_file.fragments[0]

        expected = [('text', 'flash_text', [Mapping.Keep()]),
                    ('rodata', 'flash_rodata',
                     [Mapping.Keep(), Mapping.Keep()])]
        actual = fragment.flags[('obj1', None, 'default')]

        self.assertEqual(expected, actual)