diff test/testbintools.py @ 381:6df89163e114

Fix section and ldr pseudo instruction
author Windel Bouwman
date Sat, 26 Apr 2014 17:41:56 +0200
parents 9667d78ba79e
children 173e20a47fda
line wrap: on
line diff
--- a/test/testbintools.py	Fri Apr 18 13:08:45 2014 +0200
+++ b/test/testbintools.py	Sat Apr 26 17:41:56 2014 +0200
@@ -7,6 +7,7 @@
 from ppci import CompilerError
 from ppci.tasks import TaskRunner, TaskError
 from ppci.buildtasks import EmptyTask
+from ppci.buildfunctions import link
 
 
 class TaskTestCase(unittest.TestCase):
@@ -53,16 +54,14 @@
 
 class LinkerTestCase(unittest.TestCase):
     def testUndefinedReference(self):
-        l = Linker()
         o1 = ObjectFile()
         o1.get_section('.text')
         o1.add_relocation('undefined_sym', 0, 'rel8', '.text')
         o2 = ObjectFile()
         with self.assertRaises(CompilerError):
-            o3 = l.link([o1, o2])
+            o3 = link([o1, o2], {})
 
     def testDuplicateSymbol(self):
-        l = Linker()
         o1 = ObjectFile()
         o1.get_section('.text')
         o1.add_symbol('a', 0, '.text')
@@ -70,33 +69,30 @@
         o2.get_section('.text')
         o2.add_symbol('a', 0, '.text')
         with self.assertRaises(CompilerError):
-            o3 = l.link([o1, o2])
+            o3 = link([o1, o2], {})
 
     def testRel8Relocation(self):
-        l = Linker()
         o1 = ObjectFile()
         o1.get_section('.text').add_data(bytes([0]*100))
         o1.add_relocation('a', 0, 'rel8', '.text')
         o2 = ObjectFile()
         o2.get_section('.text').add_data(bytes([0]*100))
         o2.add_symbol('a', 24, '.text')
-        o3 = l.link([o1, o2])
+        o3 = link([o1, o2], {})
 
     def testSymbolValues(self):
-        l = Linker()
         o1 = ObjectFile()
         o1.get_section('.text').add_data(bytes([0]*108))
         o1.add_symbol('b', 24, '.text')
         o2 = ObjectFile()
         o2.get_section('.text').add_data(bytes([0]*100))
         o2.add_symbol('a', 2, '.text')
-        o3 = l.link([o1, o2])
+        o3 = link([o1, o2], {})
         self.assertEqual(110, o3.find_symbol('a').value)
         self.assertEqual(24, o3.find_symbol('b').value)
         self.assertEqual(208, o3.get_section('.text').Size)
 
     def testMemoryLayout(self):
-        l = Linker()
         memory_layout = {'.text': 0x08000000, '.data':0x20000000}
         o1 = ObjectFile()
         o1.get_section('.text').add_data(bytes([0]*108))
@@ -106,7 +102,7 @@
         o2.get_section('.data').add_data(bytes([0]*100))
         o2.add_symbol('a', 2, '.data')
         o2.add_symbol('c', 2, '.text')
-        o3 = l.link([o1, o2], layout=memory_layout)
+        o3 = link([o1, o2], memory_layout)
         self.assertEqual(0x20000000+2, o3.find_symbol('a').value)
         self.assertEqual(0x08000000+24, o3.find_symbol('b').value)
         self.assertEqual(0x08000000+110, o3.find_symbol('c').value)