Commit | Line | Data |
---|---|---|
0c03554b | 1 | #!/usr/bin/env python3 |
2b6ee9ec | 2 | from ctftestsuite.stress import MetadataTestAssistant |
0c03554b | 3 | |
0c03554b | 4 | |
2b6ee9ec | 5 | class TestAssistant(MetadataTestAssistant): |
9926ec7f | 6 | what = '{size} stream classes' |
0c03554b | 7 | |
9926ec7f PP |
8 | def write_metadata(self, f): |
9 | p1 = \ | |
10 | '''/* CTF 1.8 */ | |
0c03554b | 11 | |
9926ec7f PP |
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; | |
0c03554b | 15 | |
9926ec7f | 16 | trace { |
83fcdab0 FD |
17 | major = 1; |
18 | minor = 8; | |
9926ec7f PP |
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 | }; | |
0c03554b | 27 | |
9926ec7f | 28 | ''' |
0c03554b | 29 | |
9926ec7f PP |
30 | stream_fmt = \ |
31 | '''stream {{ | |
32 | id = {id}; | |
33 | }}; | |
0c03554b | 34 | |
9926ec7f | 35 | ''' |
0c03554b | 36 | |
9926ec7f | 37 | f.write(p1) |
0c03554b | 38 | |
9926ec7f PP |
39 | for i in range(self.size): |
40 | stream = stream_fmt.format(id=i) | |
41 | f.write(stream) | |
0c03554b | 42 | |
0c03554b | 43 | |
9926ec7f | 44 | if __name__ == '__main__': |
2ffbd362 PP |
45 | test_assistant = TestAssistant() |
46 | test_assistant.main() |