def test_no_targets(self): recipe = """ <project> </project> """ construct(io.StringIO(recipe))
def test_a9_bare(self): """ Build vexpress cortex-A9 binary and emulate it """ recipe = relpath('..', 'examples', 'realview-pb-a8', 'build.xml') construct(recipe) if has_qemu(): bin_file = relpath('..', 'examples', 'realview-pb-a8', 'hello.bin') data = run_qemu(bin_file, machine='realview-pb-a8') self.assertEqual('Hello worle', data)
def test_nonexisting_target(self): recipe = """ <project> </project> """ with self.assertRaisesRegex(TaskError, 'target .* not found'): construct(io.StringIO(recipe), ["init"])
def test_m3_bare(self): """ Build bare m3 binary and emulate it """ recipe = relpath('..', 'examples', 'lm3s6965evb', 'bare', 'build.xml') construct(recipe) if has_qemu(): bin_file = relpath('..', 'examples', 'lm3s6965evb', 'bare', 'bare.bin') data = run_qemu(bin_file) self.assertEqual('Hello worle', data)
def test_unknown_task(self): recipe = """ <project> <target name="init"> <domagic /> </target> </project> """ with self.assertRaisesRegex(TaskError, 'Task .* not be found'): construct(io.StringIO(recipe), ["init"])
def test_missing_argument(self): recipe = """ <project> <target name="init"> <echo /> </target> </project> """ with self.assertRaisesRegex(TaskError, 'attribute .* not'): construct(io.StringIO(recipe), ["init"])
def test_missing_property(self): recipe = """ <project> <target name="init"> <echo message="${nonexisting}" /> </target> </project> """ with self.assertRaisesRegex(TaskError, 'Property .* not found'): construct(io.StringIO(recipe), ["init"])
def test_recipe(self, mock_stdout): recipe = """ <project> <target name="init"> <property name="a" value="Hello" /> <empty /> <echo message="${a}" /> </target> </project> """ construct(io.StringIO(recipe), ["init"]) self.assertIn("Hello", mock_stdout.getvalue())
def test_func(self): construct(filename)
def run_somecommand(): from ppci.api import construct print(construct) construct('../examples/linux64/fib/build.xml')
def test_bad_xml(self): recipe = """<project>""" with self.assertRaisesRegex(TaskError, "Invalid xml"): construct(io.StringIO(recipe))
#!/usr/bin/python from ppci.api import construct construct('build.xml') with open('hello.bin', 'rb') as f: hello_bin = f.read() flash_size = 4 * 1024 * 1024 with open('lx60.flash', 'wb') as f: f.write(hello_bin) padding = flash_size - len(hello_bin) f.write(bytes(padding))