Mercurial > lcfOS
comparison test/testzcc.py @ 331:a78b41ff6ad2
Added better recipe files
author | Windel Bouwman |
---|---|
date | Fri, 07 Feb 2014 12:39:59 +0100 |
parents | 8f6f3ace4e78 |
children | 6f4753202b9a |
comparison
equal
deleted
inserted
replaced
330:a79ac866732f | 331:a78b41ff6ad2 |
---|---|
18 os.chdir(testdir) | 18 os.chdir(testdir) |
19 | 19 |
20 def tearDown(self): | 20 def tearDown(self): |
21 os.chdir(testdir) | 21 os.chdir(testdir) |
22 | 22 |
23 def do(self, filenames, imps=[]): | 23 def do(self, filenames, imps=[], extra_args=[]): |
24 basedir = os.path.join('..', 'examples', 'c3') | 24 basedir = os.path.join('..', 'examples', 'c3') |
25 arg_list = [os.path.join(basedir, fn) for fn in filenames] | 25 arg_list = ['compile'] |
26 arg_list += [os.path.join(basedir, fn) for fn in filenames] | |
26 for fn in imps: | 27 for fn in imps: |
27 arg_list.append('-i') | 28 arg_list.append('-i') |
28 arg_list.append(os.path.join(basedir, fn)) | 29 arg_list.append(os.path.join(basedir, fn)) |
29 arg_list.append('--target') | 30 arg_list.append('--target') |
30 arg_list.append('arm') | 31 arg_list.append('arm') |
31 args = zcc.parser.parse_args(arg_list) | 32 arg_list += extra_args |
33 self.callZcc(arg_list) | |
34 | |
35 def callZcc(self, arg_list): | |
36 parser = zcc.make_parser() | |
37 args = parser.parse_args(arg_list) | |
32 self.assertEqual(0, zcc.main(args)) | 38 self.assertEqual(0, zcc.main(args)) |
39 | |
40 def buildRecipe(self, recipe): | |
41 arg_list = ['recipe', recipe] | |
42 self.callZcc(arg_list) | |
33 | 43 |
34 def testDumpIr(self): | 44 def testDumpIr(self): |
35 basedir = os.path.join('..', 'examples', 'c3', 'comments.c3') | 45 basedir = os.path.join('..', 'examples', 'c3', 'comments.c3') |
36 arg_list = [basedir] | 46 arg_list = ['compile', basedir] |
37 arg_list.append('--target') | 47 arg_list.append('--target') |
38 arg_list.append('arm') | 48 arg_list.append('arm') |
39 args = zcc.parser.parse_args(arg_list) | 49 self.callZcc(arg_list) |
40 self.assertEqual(0, zcc.main(args)) | |
41 | 50 |
42 def testKernel(self): | 51 def testKernel(self): |
43 # Build kernel using zcc: | 52 """ Build kernel using zcc: """ |
44 kerneldir = os.path.normpath(os.path.join('..', 'kernel')) | 53 recipe = os.path.join(testdir, '..', 'kernel', 'recipe.yaml') |
45 sys.path.insert(0, kerneldir) | 54 self.buildRecipe(recipe) |
46 from make import make_kernel | |
47 os.chdir(kerneldir) | |
48 make_kernel() | |
49 sys.path.pop(-1) | |
50 | 55 |
51 def testUser(self): | 56 def testUser(self): |
52 # Build userspace using zcc: | 57 """ Build userspace using zcc: """ |
53 userdir = os.path.normpath(os.path.join('..', 'user')) | 58 recipe = os.path.join(testdir, '..', 'user', 'recipe.yaml') |
54 sys.path.insert(0, userdir) | 59 self.buildRecipe(recipe) |
55 from makeuser import make_user | |
56 os.chdir(userdir) | |
57 make_user() | |
58 sys.path.pop(-1) | |
59 | 60 |
60 def testBurn2(self): | 61 def testBurn2(self): |
61 self.do(['burn2.c3'], ['stm32f4xx.c3']) | 62 self.do(['burn2.c3'], ['stm32f4xx.c3']) |
63 | |
64 #@unittest.skip('s') | |
65 def testBurn2WithLogging(self): | |
66 self.do(['burn2.c3'], ['stm32f4xx.c3'], extra_args=['--report', 'x.rst']) | |
62 | 67 |
63 def testCommentsExample(self): | 68 def testCommentsExample(self): |
64 self.do(['comments.c3']) | 69 self.do(['comments.c3']) |
65 | 70 |
66 def testCast(self): | 71 def testCast(self): |