Mercurial > lcfOS
diff test/testsamples.py @ 377:9667d78ba79e
Switched to xml for project description
author | Windel Bouwman |
---|---|
date | Fri, 11 Apr 2014 15:47:50 +0200 |
parents | 19eacf4f7270 |
children | 6df89163e114 |
line wrap: on
line diff
--- a/test/testsamples.py Tue Mar 25 19:36:51 2014 +0100 +++ b/test/testsamples.py Fri Apr 11 15:47:50 2014 +0200 @@ -3,9 +3,7 @@ import io from testemulation import runQemu, has_qemu from testzcc import relpath -from ppci.tasks import TaskRunner -from ppci.buildtasks import Assemble, Compile, Link -from ppci.objectfile import ObjectFile +from ppci.buildfunctions import assemble, c3compile, link startercode = """ mov sp, 0x30000 ; setup stack pointer @@ -121,23 +119,18 @@ def do(self, src, expected_output): # Construct binary file from snippet: - o1 = ObjectFile() - o2 = ObjectFile() - asmb = Assemble(io.StringIO(startercode), 'arm', o1) - comp = Compile([ + o1 = assemble(io.StringIO(startercode), 'arm') + o2 = c3compile([ relpath('..', 'kernel', 'src', 'io.c3'), relpath('..', 'kernel', 'arch', 'vexpressA9.c3'), - io.StringIO(src)], [], 'arm', o2) - sample_filename = 'testsample.bin' - layout = {'code': 0x10000, 'data':0x20000} - link = Link([o1, o2], layout, sample_filename) + io.StringIO(src)], [], 'arm') + layout = {'code': 0x10000, 'data': 0x20000} + o3 = link([o1, o2], layout) - # Create task executor: - runner = TaskRunner() - runner.add_task(asmb) - runner.add_task(comp) - runner.add_task(link) - runner.run_tasks() + sample_filename = 'testsample.bin' + with open(sample_filename, 'wb') as f: + f.write(o3.get_section('code').data) + # Check bin file exists: self.assertTrue(os.path.isfile(sample_filename)) @@ -149,3 +142,4 @@ if __name__ == '__main__': unittest.main() +