Refactor test infrastructure for metadata stress
[ctf-testsuite.git] / tests / 1.8 / stress / metadata / pass / many-typedef / test.py
CommitLineData
b7fa458d 1#!/usr/bin/env python3
9926ec7f 2from ctftestsuite.stress import MetadataTest
b7fa458d 3
b7fa458d 4
9926ec7f
PP
5class Test(MetadataTest):
6 what = '{size} typedefs'
b7fa458d 7
9926ec7f
PP
8 def write_metadata(self, f):
9 p1 = \
10'''/* CTF 1.8 */
b7fa458d 11
9926ec7f
PP
12typealias integer { size = 8; align = 8; signed = false; base = 10; } := uint8_t;
13typealias integer { size = 32; align = 8; signed = false; base = hex; } := uint32_t;
b7fa458d 14
9926ec7f
PP
15trace {
16 major = 0;
17 minor = 0;
18 uuid = "2a6422d0-6cee-11e0-8c08-cb07d7b3a564";
19 byte_order = le;
20 packet.header := struct {
21 uint32_t magic;
22 uint8_t uuid[16];
23 };
24};
b7fa458d 25
9926ec7f 26'''
b7fa458d 27
9926ec7f
PP
28 typedef_fmt = \
29'''typedef integer {{ size = 8; align = 8; signed = false; base = 10; }} t{name};
30'''
b7fa458d 31
9926ec7f 32 f.write(p1)
b7fa458d 33
9926ec7f
PP
34 for i in range(self.size):
35 typedef = typedef_fmt.format(name=i)
36 f.write(typedef)
b7fa458d 37
b7fa458d 38
9926ec7f
PP
39if __name__ == '__main__':
40 test = Test()
41 test.main()
This page took 0.028054 seconds and 4 git commands to generate.