From c7fb7dfd794700bf6977a907a8612e9b644e4fe4 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 4 Jul 2016 21:53:55 +0200 Subject: o Improved parser. --- .../main/test/io/trygvis/ld/FullScriptsTest.java | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 cmake/elfinfo/src/main/test/io/trygvis/ld/FullScriptsTest.java (limited to 'cmake/elfinfo/src/main/test/io/trygvis/ld/FullScriptsTest.java') diff --git a/cmake/elfinfo/src/main/test/io/trygvis/ld/FullScriptsTest.java b/cmake/elfinfo/src/main/test/io/trygvis/ld/FullScriptsTest.java new file mode 100644 index 0000000..1452f1f --- /dev/null +++ b/cmake/elfinfo/src/main/test/io/trygvis/ld/FullScriptsTest.java @@ -0,0 +1,34 @@ +package io.trygvis.ld; + +import io.trygvis.ld.test1.Test1Test; +import org.junit.Test; + +import java.io.File; + +public class FullScriptsTest { + + @Test + public void testD2000() throws Exception { + fullScript2("lds/d2000.ld"); + } + + @Test + public void testStm32() throws Exception { + fullScript2("lds/stm32.ld"); + } + + private void fullScript2(String fileName) throws Exception { + try { + LdScript script = LdScript.parse(new File(fileName)); + + System.out.println("--------------------------------------------------------"); + for (LdScript.MemoryArea area : script.memoryAreas) { + System.out.println(" " + area.name + "(" + area.prettyAttributes() + ") : ORIGIN = " + area.prettyOrigin() + ", LENGTH=" + area.prettyLength()); + } + } catch (LdScript.ParseErrorException e) { + Test1Test.showTokens(e.tokens, e.parser); + System.out.println("Got " + e.errors.size() + " errors:"); + e.errors.forEach(System.out::println); + } + } +} -- cgit v1.2.3