Commit | Line | Data |
---|---|---|
bed7233f PP |
1 | #!/usr/bin/env bats |
2 | ||
0a7000dc PP |
3 | # The MIT License (MIT) |
4 | # | |
5 | # Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com> | |
6 | # | |
7 | # Permission is hereby granted, free of charge, to any person obtaining a copy | |
8 | # of this software and associated documentation files (the "Software"), to deal | |
9 | # in the Software without restriction, including without limitation the rights | |
10 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
11 | # copies of the Software, and to permit persons to whom the Software is | |
12 | # furnished to do so, subject to the following conditions: | |
13 | # | |
14 | # The above copyright notice and this permission notice shall be included in | |
15 | # all copies or substantial portions of the Software. | |
16 | # | |
17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
19 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
20 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
22 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
23 | # THE SOFTWARE. | |
24 | ||
4810b707 | 25 | load ../../../common |
bed7233f PP |
26 | |
27 | @test 'unknown property in stream object makes barectf fail' { | |
60522caf | 28 | barectf_config_check_fail unknown-prop.yaml |
bed7233f PP |
29 | } |
30 | ||
31 | @test 'no "packet-context-type" property in stream object makes barectf fail' { | |
60522caf | 32 | barectf_config_check_fail pct-no.yaml |
bed7233f PP |
33 | } |
34 | ||
35 | @test 'wrong "packet-context-type" property type in stream object makes barectf fail' { | |
60522caf | 36 | barectf_config_check_fail pct-invalid-type.yaml |
bed7233f PP |
37 | } |
38 | ||
39 | @test 'invalid "packet-context-type" property field type (not a structure) in stream object makes barectf fail' { | |
60522caf | 40 | barectf_config_check_fail pct-not-struct.yaml |
bed7233f PP |
41 | } |
42 | ||
43 | @test 'invalid "timestamp_begin" field type (not an integer) in packet context type makes barectf fail' { | |
60522caf | 44 | barectf_config_check_fail pct-tb-not-int.yaml |
bed7233f PP |
45 | } |
46 | ||
47 | @test 'invalid "timestamp_begin" field type (signed) in packet context type makes barectf fail' { | |
60522caf | 48 | barectf_config_check_fail pct-tb-wrong-signed.yaml |
bed7233f PP |
49 | } |
50 | ||
51 | @test 'invalid "timestamp_begin" field type (not mapped to a clock) in packet context type makes barectf fail' { | |
60522caf | 52 | barectf_config_check_fail pct-tb-wrong-pm.yaml |
bed7233f PP |
53 | } |
54 | ||
55 | @test 'no "timestamp_begin" field with an existing "timestamp_end" field in packet context type makes barectf fail' { | |
60522caf | 56 | barectf_config_check_fail pct-te-yes-tb-no.yaml |
bed7233f PP |
57 | } |
58 | ||
59 | @test 'invalid "timestamp_end" field type (not an integer) in packet context type makes barectf fail' { | |
60522caf | 60 | barectf_config_check_fail pct-te-not-int.yaml |
bed7233f PP |
61 | } |
62 | ||
63 | @test 'invalid "timestamp_end" field type (signed) in packet context type makes barectf fail' { | |
60522caf | 64 | barectf_config_check_fail pct-te-wrong-signed.yaml |
bed7233f PP |
65 | } |
66 | ||
67 | @test 'invalid "timestamp_end" field type (not mapped to a clock) in packet context type makes barectf fail' { | |
60522caf | 68 | barectf_config_check_fail pct-te-wrong-pm.yaml |
bed7233f PP |
69 | } |
70 | ||
71 | @test 'no "timestamp_end" field with an existing "timestamp_begin" field in packet context type makes barectf fail' { | |
60522caf | 72 | barectf_config_check_fail pct-tb-yes-te-no.yaml |
bed7233f PP |
73 | } |
74 | ||
75 | @test '"timestamp_begin" field and "timestamp_end" field are not mapped to the same clock in packet context type makes barectf fail' { | |
60522caf | 76 | barectf_config_check_fail pct-tb-te-different-clocks.yaml |
bed7233f PP |
77 | } |
78 | ||
79 | @test 'invalid "packet_size" field type (not an integer) in packet context type makes barectf fail' { | |
60522caf | 80 | barectf_config_check_fail pct-ps-not-int.yaml |
bed7233f PP |
81 | } |
82 | ||
83 | @test 'invalid "packet_size" field type (signed) in packet context type makes barectf fail' { | |
60522caf | 84 | barectf_config_check_fail pct-ps-wrong-signed.yaml |
bed7233f PP |
85 | } |
86 | ||
87 | @test 'no "packet_size" field with an existing "content_size" field in packet context type makes barectf fail' { | |
60522caf | 88 | barectf_config_check_fail pct-cs-yes-ps-no.yaml |
bed7233f PP |
89 | } |
90 | ||
91 | @test 'invalid "content_size" field type (not an integer) in packet context type makes barectf fail' { | |
60522caf | 92 | barectf_config_check_fail pct-cs-not-int.yaml |
bed7233f PP |
93 | } |
94 | ||
95 | @test 'invalid "content_size" field type (signed) in packet context type makes barectf fail' { | |
60522caf | 96 | barectf_config_check_fail pct-cs-wrong-signed.yaml |
bed7233f PP |
97 | } |
98 | ||
99 | @test 'no "content_size" field with an existing "packet_size" field in packet context type makes barectf fail' { | |
60522caf | 100 | barectf_config_check_fail pct-ps-yes-cs-no.yaml |
bed7233f PP |
101 | } |
102 | ||
bed7233f | 103 | @test 'invalid "events_discarded" field type (not an integer) in packet context type makes barectf fail' { |
60522caf | 104 | barectf_config_check_fail pct-ed-not-int.yaml |
bed7233f PP |
105 | } |
106 | ||
107 | @test 'invalid "events_discarded" field type (signed) in packet context type makes barectf fail' { | |
60522caf | 108 | barectf_config_check_fail pct-ed-wrong-signed.yaml |
bed7233f PP |
109 | } |
110 | ||
111 | @test 'wrong "event-header-type" property type in stream object makes barectf fail' { | |
60522caf | 112 | barectf_config_check_fail eht-invalid-type.yaml |
bed7233f PP |
113 | } |
114 | ||
115 | @test 'invalid "event-header-type" property field type (not a structure) in stream object makes barectf fail' { | |
60522caf | 116 | barectf_config_check_fail eht-not-struct.yaml |
bed7233f PP |
117 | } |
118 | ||
119 | @test 'invalid "timestamp" field type (not an integer) in event header type makes barectf fail' { | |
60522caf | 120 | barectf_config_check_fail eht-timestamp-not-int.yaml |
bed7233f PP |
121 | } |
122 | ||
123 | @test 'invalid "timestamp" field type (signed) in event header type makes barectf fail' { | |
60522caf | 124 | barectf_config_check_fail eht-timestamp-wrong-signed.yaml |
bed7233f PP |
125 | } |
126 | ||
127 | @test 'invalid "timestamp" field type (not mapped to a clock) in event header type makes barectf fail' { | |
60522caf | 128 | barectf_config_check_fail eht-timestamp-wrong-pm.yaml |
bed7233f PP |
129 | } |
130 | ||
131 | @test 'invalid "id" field type (not an integer) in event header type makes barectf fail' { | |
60522caf | 132 | barectf_config_check_fail eht-id-not-int.yaml |
bed7233f PP |
133 | } |
134 | ||
135 | @test 'invalid "id" field type (signed) in event header type makes barectf fail' { | |
60522caf | 136 | barectf_config_check_fail eht-id-wrong-signed.yaml |
bed7233f PP |
137 | } |
138 | ||
139 | @test 'no event header type with multiple events in stream object makes barectf fail' { | |
60522caf | 140 | barectf_config_check_fail eht-id-no-multiple-events.yaml |
bed7233f PP |
141 | } |
142 | ||
143 | @test '"id" field type size too small for the number of stream events in event header type makes barectf fail' { | |
60522caf | 144 | barectf_config_check_fail eht-id-too-small.yaml |
bed7233f PP |
145 | } |
146 | ||
147 | @test 'wrong "event-context-type" property type in stream object makes barectf fail' { | |
60522caf | 148 | barectf_config_check_fail ect-invalid-type.yaml |
bed7233f PP |
149 | } |
150 | ||
151 | @test 'invalid "event-context-type" property field type (not a structure) in stream object makes barectf fail' { | |
60522caf | 152 | barectf_config_check_fail ect-not-struct.yaml |
bed7233f PP |
153 | } |
154 | ||
155 | @test 'no "events" property in stream object makes barectf fail' { | |
60522caf | 156 | barectf_config_check_fail events-no.yaml |
bed7233f PP |
157 | } |
158 | ||
159 | @test 'wrong "events" property type in stream object makes barectf fail' { | |
60522caf | 160 | barectf_config_check_fail events-invalid-type.yaml |
bed7233f PP |
161 | } |
162 | ||
163 | @test 'empty "events" property in stream object makes barectf fail' { | |
60522caf | 164 | barectf_config_check_fail events-empty.yaml |
bed7233f PP |
165 | } |
166 | ||
167 | @test 'invalid "events" key (invalid C identifier) in metadata object makes barectf fail' { | |
60522caf | 168 | barectf_config_check_fail events-key-invalid-identifier.yaml |
bed7233f | 169 | } |
f31f13a6 PP |
170 | |
171 | @test 'wrong "$default" property type in stream object makes barectf fail' { | |
60522caf | 172 | barectf_config_check_fail default-invalid-type.yaml |
f31f13a6 | 173 | } |