comparison test/testzcc.py @ 338:8eb4a6fe8fc8

Added testcase with emulator
author Windel Bouwman
date Fri, 21 Feb 2014 13:31:29 +0100
parents b00219172a42
children 4d204f6f7d4e
comparison
equal deleted inserted replaced
337:b00219172a42 338:8eb4a6fe8fc8
10 10
11 # Store testdir for safe switch back to directory: 11 # Store testdir for safe switch back to directory:
12 testdir = os.path.dirname(os.path.abspath(__file__)) 12 testdir = os.path.dirname(os.path.abspath(__file__))
13 13
14 14
15 class ZccTestCase(unittest.TestCase): 15 class ZccBaseTestCase(unittest.TestCase):
16 def callZcc(self, arg_list):
17 parser = zcc.make_parser()
18 arg_list = ['--log', 'warn'] + arg_list
19 args = parser.parse_args(arg_list)
20 self.assertEqual(0, zcc.main(args))
21
22 def buildRecipe(self, recipe):
23 arg_list = ['recipe', recipe]
24 self.callZcc(arg_list)
25
26
27 class ZccTestCase(ZccBaseTestCase):
16 """ Tests the compiler driver """ 28 """ Tests the compiler driver """
17 def setUp(self): 29 def setUp(self):
18 os.chdir(testdir) 30 os.chdir(testdir)
19 31
20 def tearDown(self): 32 def tearDown(self):
30 arg_list.append('--target') 42 arg_list.append('--target')
31 arg_list.append('arm') 43 arg_list.append('arm')
32 arg_list += extra_args 44 arg_list += extra_args
33 self.callZcc(arg_list) 45 self.callZcc(arg_list)
34 46
35 def callZcc(self, arg_list):
36 parser = zcc.make_parser()
37 arg_list = ['--log', 'warn'] + arg_list
38 args = parser.parse_args(arg_list)
39 self.assertEqual(0, zcc.main(args))
40
41 def buildRecipe(self, recipe):
42 arg_list = ['recipe', recipe]
43 self.callZcc(arg_list)
44 47
45 def testDumpIr(self): 48 def testDumpIr(self):
46 basedir = os.path.join('..', 'examples', 'c3', 'comments.c3') 49 basedir = os.path.join('..', 'examples', 'c3', 'comments.c3')
47 arg_list = ['compile', basedir] 50 arg_list = ['compile', basedir]
48 arg_list.append('--target') 51 arg_list.append('--target')