comparison test/testzcc.py @ 292:534b94b40aa8

Fixup reorganize
author Windel Bouwman
date Wed, 27 Nov 2013 08:06:42 +0100
parents bd2593de3ff8
children 158068af716c
comparison
equal deleted inserted replaced
290:7b38782ed496 292:534b94b40aa8
1 import unittest 1 import unittest
2 import glob
3 import zcc 2 import zcc
4 import outstream 3 import outstream
5 import ppci 4 import ppci
6 import io 5 import io
7 import os 6 import os
7 import target
8 8
9 9
10 class ZccTestCase(unittest.TestCase): 10 class ZccTestCase(unittest.TestCase):
11 """ Tests the compiler driver """ 11 """ Tests the compiler driver """
12 12
14 basedir = 'c3examples' 14 basedir = 'c3examples'
15 arg_list = [os.path.join(basedir, fn) for fn in filenames] 15 arg_list = [os.path.join(basedir, fn) for fn in filenames]
16 for fn in imps: 16 for fn in imps:
17 arg_list.append('-i') 17 arg_list.append('-i')
18 arg_list.append(os.path.join(basedir, fn)) 18 arg_list.append(os.path.join(basedir, fn))
19 arg_list.append('--target')
20 arg_list.append('arm')
19 args = zcc.parser.parse_args(arg_list) 21 args = zcc.parser.parse_args(arg_list)
20 self.assertEqual(0, zcc.main(args)) 22 self.assertEqual(0, zcc.main(args))
21 23
22 @unittest.skip('Not working yet') 24 @unittest.skip('Not working yet')
23 def testBurn(self): 25 def testBurn(self):
37 function void t2() {var int t3; t3 = 2;} 39 function void t2() {var int t3; t3 = 2;}
38 """ 40 """
39 f = io.StringIO(src) 41 f = io.StringIO(src)
40 diag = ppci.DiagnosticsManager() 42 diag = ppci.DiagnosticsManager()
41 outs = outstream.TextOutputStream() 43 outs = outstream.TextOutputStream()
42 self.assertTrue(zcc.zcc([f], [], outs, diag)) 44 tg = target.armtarget
45 self.assertTrue(zcc.zcc([f], [], tg, outs, diag))
43 code = outs.getSection('code') 46 code = outs.getSection('code')
44 self.assertEqual(0x08000000, code.address) 47 self.assertEqual(0x08000000, code.address)
45 data = outs.getSection('data') 48 data = outs.getSection('data')
46 self.assertEqual(0x20000000, data.address) 49 self.assertEqual(0x20000000, data.address)
47 50