From e52fb0abf8129cda464dfb612bd3848f8ce3636d Mon Sep 17 00:00:00 2001 From: You Wei Date: Tue, 12 Sep 2023 11:20:12 +0800 Subject: [PATCH] fix(ldgen): duplicate entries in the generated .ld file --- tools/ldgen/test/test_generation.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/ldgen/test/test_generation.py b/tools/ldgen/test/test_generation.py index 086fad43fa..742a7e3032 100755 --- a/tools/ldgen/test/test_generation.py +++ b/tools/ldgen/test/test_generation.py @@ -70,7 +70,10 @@ class GenerationTest(unittest.TestCase): self.entities.add_sections_info(objdump) with open('data/linker_script.ld') as linker_script: - self.linker_script = LinkerScript(linker_script) + self.linker_script_expect = LinkerScript(linker_script) + + with open('data/linker_script.ld') as linker_script: + self.linker_script_actual = LinkerScript(linker_script) @staticmethod def create_fragment_file(contents, name='test_fragment.lf'): @@ -84,11 +87,11 @@ class GenerationTest(unittest.TestCase): self.generation.add_fragments_from_file(fragment_file) def write(self, expected, actual): - self.linker_script.fill(expected) - self.linker_script.write(open('expected.ld', 'w')) + self.linker_script_expect.fill(expected) + self.linker_script_expect.write(open('expected.ld', 'w')) - self.linker_script.fill(actual) - self.linker_script.write(open('actual.ld', 'w')) + self.linker_script_actual.fill(actual) + self.linker_script_actual.write(open('actual.ld', 'w')) def generate_default_rules(self): rules = collections.defaultdict(list)