7 class MetadataTestAssitant
:
11 typealias integer { size = 8; align = 8; signed = false; base = 10; } := uint8_t;
12 typealias integer { size = 32; align = 8; signed = false; base = hex; } := uint32_t;
17 uuid = "2a6422d0-6cee-11e0-8c08-cb07d7b3a564";
19 packet.header := struct {
29 'prepare': self
._prepare
,
35 print('Error: {}'.format(str), file=sys
.stderr
)
38 def _parse_args(self
):
39 ap
= argparse
.ArgumentParser()
41 ap
.add_argument('-s', '--size', action
='store', metavar
='SIZE',
42 type=int, required
=True, help='size')
43 ap
.add_argument('action', metavar
='ACTION', action
='store',
47 args
= ap
.parse_args()
51 MetadataTestAssitant
._perror
('wrong size: {}'.format(args
.size
))
56 return self
.what
.format(size
=self
.size
)
59 # make sure everything is clean first
62 print('Preparing test for {}'.format(self
._get
_what
()))
65 os
.mkdir(self
._trace
_dir
_path
)
67 # open and write metadata file
68 with
open(self
._metadata
_path
, 'w') as f
:
69 self
.write_metadata(f
)
72 print('Cleaning up test for {}'.format(self
._get
_what
()))
75 shutil
.rmtree(self
._trace
_dir
_path
, ignore_errors
=True)
76 except Exception as e
:
81 if self
._action
not in self
._actions
:
82 msg
= 'invalid action: "{}"'.format(self
._action
)
83 MetadataTestAssitant
._perror
(msg
)
85 self
._actions
[self
._action
]()
92 args
= self
._parse
_args
()
93 self
._size
= args
.size
94 self
._trace
_dir
_path
= 'trace-{}'.format(args
.size
)
95 self
._metadata
_path
= os
.path
.join(self
._trace
_dir
_path
, 'metadata')
96 self
._action
= args
.action
This page took 0.031089 seconds and 4 git commands to generate.