| 1 | #!/usr/bin/env python3 |
| 2 | from ctftestsuite.stress import MetadataTestAssistant |
| 3 | |
| 4 | |
| 5 | class TestAssistant(MetadataTestAssistant): |
| 6 | what = '{size} stream classes' |
| 7 | |
| 8 | def write_metadata(self, f): |
| 9 | p1 = \ |
| 10 | '''/* CTF 1.8 */ |
| 11 | |
| 12 | typealias integer { size = 8; align = 8; signed = false; base = 10; } := uint8_t; |
| 13 | typealias integer { size = 32; align = 8; signed = false; base = hex; } := uint32_t; |
| 14 | typealias integer { size = 64; align = 8; signed = false; base = hex; } := uint64_t; |
| 15 | |
| 16 | trace { |
| 17 | major = 1; |
| 18 | minor = 8; |
| 19 | uuid = "2a6422d0-6cee-11e0-8c08-cb07d7b3a564"; |
| 20 | byte_order = le; |
| 21 | packet.header := struct { |
| 22 | uint32_t magic; |
| 23 | uint8_t uuid[16]; |
| 24 | uint64_t stream_id; |
| 25 | }; |
| 26 | }; |
| 27 | |
| 28 | ''' |
| 29 | |
| 30 | stream_fmt = \ |
| 31 | '''stream {{ |
| 32 | id = {id}; |
| 33 | }}; |
| 34 | |
| 35 | ''' |
| 36 | |
| 37 | f.write(p1) |
| 38 | |
| 39 | for i in range(self.size): |
| 40 | stream = stream_fmt.format(id=i) |
| 41 | f.write(stream) |
| 42 | |
| 43 | |
| 44 | if __name__ == '__main__': |
| 45 | test_assistant = TestAssistant() |
| 46 | test_assistant.main() |