Mercurial > lcfOS
diff 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 |
line wrap: on
line diff
--- a/test/testzcc.py Fri Feb 07 12:08:40 2014 +0100 +++ b/test/testzcc.py Fri Feb 07 12:39:59 2014 +0100 @@ -20,46 +20,51 @@ def tearDown(self): os.chdir(testdir) - def do(self, filenames, imps=[]): + def do(self, filenames, imps=[], extra_args=[]): basedir = os.path.join('..', 'examples', 'c3') - arg_list = [os.path.join(basedir, fn) for fn in filenames] + arg_list = ['compile'] + arg_list += [os.path.join(basedir, fn) for fn in filenames] for fn in imps: arg_list.append('-i') arg_list.append(os.path.join(basedir, fn)) arg_list.append('--target') arg_list.append('arm') - args = zcc.parser.parse_args(arg_list) + arg_list += extra_args + self.callZcc(arg_list) + + def callZcc(self, arg_list): + parser = zcc.make_parser() + args = parser.parse_args(arg_list) self.assertEqual(0, zcc.main(args)) + def buildRecipe(self, recipe): + arg_list = ['recipe', recipe] + self.callZcc(arg_list) + def testDumpIr(self): basedir = os.path.join('..', 'examples', 'c3', 'comments.c3') - arg_list = [basedir] + arg_list = ['compile', basedir] arg_list.append('--target') arg_list.append('arm') - args = zcc.parser.parse_args(arg_list) - self.assertEqual(0, zcc.main(args)) + self.callZcc(arg_list) def testKernel(self): - # Build kernel using zcc: - kerneldir = os.path.normpath(os.path.join('..', 'kernel')) - sys.path.insert(0, kerneldir) - from make import make_kernel - os.chdir(kerneldir) - make_kernel() - sys.path.pop(-1) + """ Build kernel using zcc: """ + recipe = os.path.join(testdir, '..', 'kernel', 'recipe.yaml') + self.buildRecipe(recipe) def testUser(self): - # Build userspace using zcc: - userdir = os.path.normpath(os.path.join('..', 'user')) - sys.path.insert(0, userdir) - from makeuser import make_user - os.chdir(userdir) - make_user() - sys.path.pop(-1) + """ Build userspace using zcc: """ + recipe = os.path.join(testdir, '..', 'user', 'recipe.yaml') + self.buildRecipe(recipe) def testBurn2(self): self.do(['burn2.c3'], ['stm32f4xx.c3']) + #@unittest.skip('s') + def testBurn2WithLogging(self): + self.do(['burn2.c3'], ['stm32f4xx.c3'], extra_args=['--report', 'x.rst']) + def testCommentsExample(self): self.do(['comments.c3'])