comparison test/testzcc.py @ 329:8f6f3ace4e78

Added build tasks
author Windel Bouwman
date Wed, 05 Feb 2014 21:29:31 +0100
parents 44f336460c2a
children a78b41ff6ad2
comparison
equal deleted inserted replaced
328:0bb16d2a5699 329:8f6f3ace4e78
5 import zcc 5 import zcc
6 import outstream 6 import outstream
7 import ppci 7 import ppci
8 import io 8 import io
9 import target 9 import target
10
11 10
12 # Store testdir for safe switch back to directory: 11 # Store testdir for safe switch back to directory:
13 testdir = os.path.dirname(os.path.abspath(__file__)) 12 testdir = os.path.dirname(os.path.abspath(__file__))
14 13
15 14
73 def testSectionAddress(self): 72 def testSectionAddress(self):
74 src = """module tst; 73 src = """module tst;
75 function void t2() {var int t3; t3 = 2;} 74 function void t2() {var int t3; t3 = 2;}
76 """ 75 """
77 f = io.StringIO(src) 76 f = io.StringIO(src)
78 diag = ppci.DiagnosticsManager()
79 outs = outstream.TextOutputStream() 77 outs = outstream.TextOutputStream()
80 tg = target.target_list.armtarget 78 tg = target.target_list.armtarget
81 self.assertTrue(zcc.zcc([f], [], tg, outs, diag)) 79 tr = ppci.tasks.TaskRunner()
80 tr.add_task(ppci.buildtasks.Compile([f], [], tg, outs))
81 tr.run_tasks()
82 code = outs.getSection('code') 82 code = outs.getSection('code')
83 self.assertEqual(0x08000000, code.address) 83 self.assertEqual(0x0, code.address)
84 data = outs.getSection('data')
85 self.assertEqual(0x20000000, data.address)
86 84
87 85
88 if __name__ == '__main__': 86 if __name__ == '__main__':
89 unittest.main() 87 unittest.main()