5 class TraceTestCase(unittest
.TestCase
):
7 self
._trace
= bt2
.Trace()
12 def _add_stream_class(self
):
13 sc
= bt2
.StreamClass()
14 self
._trace
.add_stream_class(sc
)
16 def test_packet_header_ft_no_clock_class_simple(self
):
17 cc
= bt2
.ClockClass('hello', 1000)
18 phft
= bt2
.StructureFieldType()
19 ft
= bt2
.IntegerFieldType(32, mapped_clock_class
=cc
)
20 phft
.append_field('salut', ft
)
21 self
._trace
.add_clock_class(cc
)
22 self
._trace
.packet_header_field_type
= phft
24 with self
.assertRaises(bt2
.Error
):
25 self
._add
_stream
_class
()
27 def test_packet_header_ft_no_clock_class_struct(self
):
28 cc
= bt2
.ClockClass('hello', 1000)
29 phft
= bt2
.StructureFieldType()
30 ft
= bt2
.IntegerFieldType(32, mapped_clock_class
=cc
)
31 struct_ft
= bt2
.StructureFieldType()
32 struct_ft
.append_field('salut', ft
)
33 phft
.append_field('boucane', struct_ft
)
34 self
._trace
.add_clock_class(cc
)
35 self
._trace
.packet_header_field_type
= phft
37 with self
.assertRaises(bt2
.Error
):
38 self
._add
_stream
_class
()
40 def test_packet_header_ft_no_clock_class_variant(self
):
41 cc
= bt2
.ClockClass('hello', 1000)
42 phft
= bt2
.StructureFieldType()
43 ft
= bt2
.IntegerFieldType(32, mapped_clock_class
=cc
)
44 tag_ft
= bt2
.EnumerationFieldType(size
=32)
45 tag_ft
.add_mapping('heille', 12)
46 variant_ft
= bt2
.VariantFieldType('tag', tag_ft
)
47 variant_ft
.append_field('heille', ft
)
48 phft
.append_field('tag', tag_ft
)
49 phft
.append_field('boucane', variant_ft
)
50 self
._trace
.add_clock_class(cc
)
51 self
._trace
.packet_header_field_type
= phft
53 with self
.assertRaises(bt2
.Error
):
54 self
._add
_stream
_class
()
56 def test_packet_header_ft_no_clock_class_array(self
):
57 cc
= bt2
.ClockClass('hello', 1000)
58 phft
= bt2
.StructureFieldType()
59 ft
= bt2
.IntegerFieldType(32, mapped_clock_class
=cc
)
60 array_ft
= bt2
.ArrayFieldType(ft
, 23)
61 phft
.append_field('boucane', array_ft
)
62 self
._trace
.add_clock_class(cc
)
63 self
._trace
.packet_header_field_type
= phft
65 with self
.assertRaises(bt2
.Error
):
66 self
._add
_stream
_class
()
68 def test_packet_header_ft_no_clock_class_sequence(self
):
69 cc
= bt2
.ClockClass('hello', 1000)
70 phft
= bt2
.StructureFieldType()
71 ft
= bt2
.IntegerFieldType(32, mapped_clock_class
=cc
)
72 len_ft
= bt2
.IntegerFieldType(32)
73 seq_ft
= bt2
.SequenceFieldType(ft
, 'len')
74 phft
.append_field('len', len_ft
)
75 phft
.append_field('boucane', seq_ft
)
76 self
._trace
.add_clock_class(cc
)
77 self
._trace
.packet_header_field_type
= phft
79 with self
.assertRaises(bt2
.Error
):
80 self
._add
_stream
_class
()
82 def test_packet_header_ft_no_clock_class_set_static(self
):
83 cc
= bt2
.ClockClass('hello', 1000)
84 phft
= bt2
.StructureFieldType()
85 ft
= bt2
.IntegerFieldType(32, mapped_clock_class
=cc
)
86 phft
.append_field('salut', ft
)
87 self
._trace
.add_clock_class(cc
)
88 self
._trace
.packet_header_field_type
= phft
90 with self
.assertRaises(bt2
.Error
):
91 self
._trace
.set_is_static()
This page took 0.033596 seconds and 4 git commands to generate.