Beispiel #1
0
    def test_no_targets(self):
        recipe = """
        <project>
        </project>
        """

        construct(io.StringIO(recipe))
Beispiel #2
0
 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)
Beispiel #3
0
    def test_nonexisting_target(self):
        recipe = """
        <project>
        </project>
        """

        with self.assertRaisesRegex(TaskError, 'target .* not found'):
            construct(io.StringIO(recipe), ["init"])
Beispiel #4
0
 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)
Beispiel #5
0
    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"])
Beispiel #6
0
    def test_missing_argument(self):
        recipe = """
        <project>
            <target name="init">
                <echo />
            </target>
        </project>
        """

        with self.assertRaisesRegex(TaskError, 'attribute .* not'):
            construct(io.StringIO(recipe), ["init"])
Beispiel #7
0
    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"])
Beispiel #8
0
    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())
Beispiel #9
0
 def test_func(self):
     construct(filename)
Beispiel #10
0
 def run_somecommand():
     from ppci.api import construct
     print(construct)
     construct('../examples/linux64/fib/build.xml')
Beispiel #11
0
 def test_bad_xml(self):
     recipe = """<project>"""
     with self.assertRaisesRegex(TaskError, "Invalid xml"):
         construct(io.StringIO(recipe))
Beispiel #12
0
#!/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))