comparison test/testzcc.py @ 346:3bb7dcfe5529

expanded arm target
author Windel Bouwman
date Fri, 07 Mar 2014 17:05:32 +0100
parents 86b02c98a717
children 899ae3aea803
comparison
equal deleted inserted replaced
345:b4882ff0ed06 346:3bb7dcfe5529
9 from ppci.target import target_list 9 from ppci.target import target_list
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 def relpath(*args):
15 return os.path.join(testdir, *args)
14 16
15 class ZccBaseTestCase(unittest.TestCase): 17 class ZccBaseTestCase(unittest.TestCase):
16 def callZcc(self, arg_list): 18 def callZcc(self, arg_list):
17 parser = zcc.make_parser() 19 parser = zcc.make_parser()
18 arg_list = ['--log', 'warn'] + arg_list 20 arg_list = ['--log', 'warn'] + arg_list
44 arg_list += extra_args 46 arg_list += extra_args
45 self.callZcc(arg_list) 47 self.callZcc(arg_list)
46 48
47 49
48 def testDumpIr(self): 50 def testDumpIr(self):
49 basedir = os.path.join('..', 'examples', 'c3', 'comments.c3') 51 basedir = relpath('..', 'examples', 'c3', 'comments.c3')
50 arg_list = ['compile', basedir] 52 arg_list = ['compile', basedir]
51 arg_list.append('--target') 53 arg_list.append('--target')
52 arg_list.append('thumb') 54 arg_list.append('thumb')
53 self.callZcc(arg_list) 55 self.callZcc(arg_list)
54 56
55 def testKernel(self): 57 def testKernel(self):
56 """ Build kernel using zcc: """ 58 """ Build kernel using zcc: """
57 recipe = os.path.join(testdir, '..', 'kernel', 'recipe.yaml') 59 recipe = relpath('..', 'kernel', 'recipe.yaml')
58 self.buildRecipe(recipe) 60 self.buildRecipe(recipe)
59 61
60 @unittest.skip('Too difficult to fix') 62 @unittest.skip('Too difficult to fix')
61 def testKernelBuildsEqualTwice(self): 63 def testKernelBuildsEqualTwice(self):
62 """ Build kernel two times and check the output is equal """ 64 """ Build kernel two times and check the output is equal """
63 recipe = os.path.join(testdir, '..', 'kernel', 'recipe.yaml') 65 recipe = relpath('..', 'kernel', 'recipe.yaml')
64 bin_filename = os.path.join(testdir, '..', 'kernel', 'kernel.bin') 66 bin_filename = relpath('..', 'kernel', 'kernel.bin')
65 self.buildRecipe(recipe) 67 self.buildRecipe(recipe)
66 with open(bin_filename, 'rb') as f: 68 with open(bin_filename, 'rb') as f:
67 a = f.read() 69 a = f.read()
68 self.buildRecipe(recipe) 70 self.buildRecipe(recipe)
69 with open(bin_filename, 'rb') as f: 71 with open(bin_filename, 'rb') as f:
70 b = f.read() 72 b = f.read()
71 self.assertSequenceEqual(a, b) 73 self.assertSequenceEqual(a, b)
72 74
73 def testUser(self): 75 def testUser(self):
74 """ Build userspace using zcc: """ 76 """ Build userspace using zcc: """
75 recipe = os.path.join(testdir, '..', 'user', 'recipe.yaml') 77 recipe = relpath('..', 'user', 'recipe.yaml')
76 self.buildRecipe(recipe) 78 self.buildRecipe(recipe)
77 79
78 def testBurn2(self): 80 def testBurn2(self):
79 self.do(['burn2.c3'], ['stm32f4xx.c3']) 81 self.do(['burn2.c3'], ['stm32f4xx.c3'])
80 82
81 def testBurn2_recipe(self): 83 def testBurn2_recipe(self):
82 recipe = os.path.join(testdir, '..', 'examples', 'c3', 'recipe.yaml') 84 recipe = relpath('..', 'examples', 'c3', 'recipe.yaml')
85 self.buildRecipe(recipe)
86
87 def test_hello_A9_c3_recipe(self):
88 recipe = relpath('..', 'examples', 'qemu_a9_hello', 'recipe.yaml')
83 self.buildRecipe(recipe) 89 self.buildRecipe(recipe)
84 90
85 @unittest.skip('Skip because of logfile') 91 @unittest.skip('Skip because of logfile')
86 def testBurn2WithLogging(self): 92 def testBurn2WithLogging(self):
87 self.do(['burn2.c3'], ['stm32f4xx.c3'], extra_args=['--report', 'x.rst']) 93 self.do(['burn2.c3'], ['stm32f4xx.c3'], extra_args=['--report', 'x.rst'])