Commit | Line | Data |
---|---|---|
188edac1 SM |
1 | #!/bin/bash |
2 | # | |
0235b0db | 3 | # SPDX-License-Identifier: GPL-2.0-only |
188edac1 | 4 | # |
0235b0db | 5 | # Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com> |
188edac1 | 6 | # |
188edac1 SM |
7 | |
8 | # This file tests what happens when we trim at different points in the message | |
9 | # flow. | |
10 | ||
11 | SH_TAP=1 | |
12 | ||
13 | if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then | |
14 | UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh" | |
15 | else | |
16 | UTILSSH="$(dirname "$0")/../../utils/utils.sh" | |
17 | fi | |
18 | ||
1d970e04 | 19 | # shellcheck source=../../utils/utils.sh |
188edac1 SM |
20 | source "$UTILSSH" |
21 | ||
1d970e04 | 22 | data_dir="$BT_TESTS_DATADIR/plugins/flt.utils.trimmer" |
58db335e FD |
23 | temp_stdout_expected=$(mktemp) |
24 | temp_stderr_expected="/dev/null" | |
188edac1 | 25 | |
e90ed87f | 26 | plan_tests 56 |
188edac1 SM |
27 | |
28 | function run_test | |
29 | { | |
30 | local begin_time="$1" | |
31 | local end_time="$2" | |
e90ed87f SM |
32 | # with_stream_msgs_cs and with_packet_msgs are set to "true" or "false" |
33 | # by the tests. | |
1d970e04 | 34 | local local_args=( |
02510056 | 35 | "--plugin-path" "$data_dir" |
1d970e04 MJ |
36 | "-c" "src.test-trimmer.TheSourceOfAllEvil" |
37 | "-p" "with-stream-msgs-cs=$with_stream_msgs_cs" | |
e90ed87f | 38 | "-p" "with-packet-msgs=$with_packet_msgs" |
1d970e04 MJ |
39 | "-c" "sink.text.details" |
40 | "--params=compact=true,with-metadata=false" | |
1d970e04 | 41 | ) |
188edac1 | 42 | |
065509d3 SM |
43 | if [ "$with_stream_msgs_cs" = "true" ]; then |
44 | test_name="with stream message clock snapshots" | |
45 | else | |
46 | test_name="without stream message clock snapshots" | |
47 | fi | |
48 | ||
e90ed87f SM |
49 | if [ "$with_packet_msgs" = "true" ]; then |
50 | test_name="$test_name, with packet messages" | |
51 | else | |
52 | test_name="$test_name, without packet messages" | |
53 | fi | |
54 | ||
188edac1 | 55 | if [ -n "$begin_time" ]; then |
1d970e04 | 56 | local_args+=("--begin=$begin_time") |
065509d3 | 57 | test_name="$test_name, with --begin=$begin_time" |
188edac1 | 58 | else |
065509d3 | 59 | test_name="$test_name, without --begin" |
188edac1 SM |
60 | fi |
61 | ||
62 | if [ -n "$end_time" ]; then | |
1d970e04 MJ |
63 | local_args+=("--end=$end_time") |
64 | test_name="$test_name, with --end=$end_time" | |
188edac1 | 65 | else |
188edac1 SM |
66 | test_name="$test_name, without --end" |
67 | fi | |
68 | ||
58db335e | 69 | bt_diff_cli "$temp_stdout_expected" "$temp_stderr_expected" "${local_args[@]}" |
188edac1 SM |
70 | ok $? "$test_name" |
71 | } | |
72 | ||
e90ed87f | 73 | function test_with_stream_msg_cs_with_packets { |
188edac1 | 74 | with_stream_msgs_cs="true" |
e90ed87f | 75 | with_packet_msgs="true" |
188edac1 SM |
76 | |
77 | # Baseline (without trimming) | |
58db335e | 78 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
79 | [100 10,100,000,000,000] {0 0 0} Stream beginning |
80 | [200 10,200,000,000,000] {0 0 0} Packet beginning | |
81 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
82 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
83 | [900 10,900,000,000,000] {0 0 0} Packet end | |
84 | [1000 11,000,000,000,000] {0 0 0} Stream end | |
85 | END | |
86 | run_test "" "" | |
87 | ||
88 | # Trim begin at a time before what the clock class can represent | |
58db335e | 89 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
90 | [100 10,100,000,000,000] {0 0 0} Stream beginning |
91 | [200 10,200,000,000,000] {0 0 0} Packet beginning | |
92 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
93 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
94 | [900 10,900,000,000,000] {0 0 0} Packet end | |
95 | [1000 11,000,000,000,000] {0 0 0} Stream end | |
96 | END | |
97 | run_test 50 "" | |
98 | ||
99 | # Trim begin before stream beginning | |
58db335e | 100 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
101 | [100 10,100,000,000,000] {0 0 0} Stream beginning |
102 | [200 10,200,000,000,000] {0 0 0} Packet beginning | |
103 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
104 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
105 | [900 10,900,000,000,000] {0 0 0} Packet end | |
106 | [1000 11,000,000,000,000] {0 0 0} Stream end | |
107 | END | |
108 | run_test 10050 "" | |
109 | ||
110 | # Trim begin before packet beginning | |
58db335e | 111 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
112 | [150 10,150,000,000,000] {0 0 0} Stream beginning |
113 | [200 10,200,000,000,000] {0 0 0} Packet beginning | |
114 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
115 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
116 | [900 10,900,000,000,000] {0 0 0} Packet end | |
117 | [1000 11,000,000,000,000] {0 0 0} Stream end | |
118 | END | |
119 | run_test 10150 "" | |
120 | ||
121 | # Trim begin before first event | |
58db335e | 122 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
123 | [250 10,250,000,000,000] {0 0 0} Stream beginning |
124 | [250 10,250,000,000,000] {0 0 0} Packet beginning | |
125 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
126 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
127 | [900 10,900,000,000,000] {0 0 0} Packet end | |
128 | [1000 11,000,000,000,000] {0 0 0} Stream end | |
129 | END | |
130 | run_test 10250 "" | |
131 | ||
132 | # Trim begin before second event | |
58db335e | 133 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
134 | [350 10,350,000,000,000] {0 0 0} Stream beginning |
135 | [350 10,350,000,000,000] {0 0 0} Packet beginning | |
136 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
137 | [900 10,900,000,000,000] {0 0 0} Packet end | |
138 | [1000 11,000,000,000,000] {0 0 0} Stream end | |
139 | END | |
140 | ||
141 | run_test 10350 "" | |
142 | ||
143 | # Trim begin before packet end | |
58db335e | 144 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
145 | [850 10,850,000,000,000] {0 0 0} Stream beginning |
146 | [850 10,850,000,000,000] {0 0 0} Packet beginning | |
147 | [900 10,900,000,000,000] {0 0 0} Packet end | |
148 | [1000 11,000,000,000,000] {0 0 0} Stream end | |
149 | END | |
150 | ||
151 | run_test 10850 "" | |
152 | ||
153 | # Trim begin after everything | |
58db335e | 154 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
155 | END |
156 | ||
157 | run_test 11050 "" | |
158 | ||
159 | # Trim end after stream end | |
58db335e | 160 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
161 | [100 10,100,000,000,000] {0 0 0} Stream beginning |
162 | [200 10,200,000,000,000] {0 0 0} Packet beginning | |
163 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
164 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
165 | [900 10,900,000,000,000] {0 0 0} Packet end | |
166 | [1000 11,000,000,000,000] {0 0 0} Stream end | |
167 | END | |
168 | ||
169 | run_test "" 11050 | |
170 | ||
171 | # Trim end after packet end | |
58db335e | 172 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
173 | [100 10,100,000,000,000] {0 0 0} Stream beginning |
174 | [200 10,200,000,000,000] {0 0 0} Packet beginning | |
175 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
176 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
177 | [900 10,900,000,000,000] {0 0 0} Packet end | |
178 | [950 10,950,000,000,000] {0 0 0} Stream end | |
179 | END | |
180 | ||
181 | run_test "" 10950 | |
182 | ||
183 | # Trim end after second event | |
58db335e | 184 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
185 | [100 10,100,000,000,000] {0 0 0} Stream beginning |
186 | [200 10,200,000,000,000] {0 0 0} Packet beginning | |
187 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
188 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
189 | [450 10,450,000,000,000] {0 0 0} Packet end | |
190 | [450 10,450,000,000,000] {0 0 0} Stream end | |
191 | END | |
192 | ||
193 | run_test "" 10450 | |
194 | ||
195 | # Trim end after first event | |
58db335e | 196 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
197 | [100 10,100,000,000,000] {0 0 0} Stream beginning |
198 | [200 10,200,000,000,000] {0 0 0} Packet beginning | |
199 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
200 | [350 10,350,000,000,000] {0 0 0} Packet end | |
201 | [350 10,350,000,000,000] {0 0 0} Stream end | |
202 | END | |
203 | ||
204 | run_test "" 10350 | |
205 | ||
206 | # Trim end after packet beginning | |
58db335e | 207 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
208 | [100 10,100,000,000,000] {0 0 0} Stream beginning |
209 | [200 10,200,000,000,000] {0 0 0} Packet beginning | |
210 | [250 10,250,000,000,000] {0 0 0} Packet end | |
211 | [250 10,250,000,000,000] {0 0 0} Stream end | |
212 | END | |
213 | ||
214 | run_test "" 10250 | |
215 | ||
216 | # Trim end after stream beginning | |
58db335e | 217 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
218 | [100 10,100,000,000,000] {0 0 0} Stream beginning |
219 | [150 10,150,000,000,000] {0 0 0} Stream end | |
220 | END | |
221 | ||
222 | run_test "" 10150 | |
223 | ||
224 | # Trim end before everything | |
58db335e | 225 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
226 | END |
227 | ||
228 | run_test "" 10050 | |
229 | ||
230 | # Trim end at a time before what the clock class can represent | |
58db335e | 231 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
232 | END |
233 | ||
234 | run_test "" 50 | |
235 | } | |
236 | ||
e90ed87f | 237 | function test_without_stream_msg_cs_with_packets { |
188edac1 | 238 | with_stream_msgs_cs="false" |
e90ed87f | 239 | with_packet_msgs="true" |
188edac1 SM |
240 | |
241 | # Baseline (without trimming) | |
58db335e | 242 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
243 | [Unknown] {0 0 0} Stream beginning |
244 | [200 10,200,000,000,000] {0 0 0} Packet beginning | |
245 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
246 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
247 | [900 10,900,000,000,000] {0 0 0} Packet end | |
248 | [Unknown] {0 0 0} Stream end | |
249 | END | |
250 | run_test "" "" | |
251 | ||
252 | # Trim begin at a time before what the clock class can represent | |
58db335e | 253 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
254 | [Unknown] {0 0 0} Stream beginning |
255 | [200 10,200,000,000,000] {0 0 0} Packet beginning | |
256 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
257 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
258 | [900 10,900,000,000,000] {0 0 0} Packet end | |
259 | [Unknown] {0 0 0} Stream end | |
260 | END | |
261 | run_test 50 "" | |
262 | ||
263 | # Trim begin before stream beginning | |
58db335e | 264 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
265 | [Unknown] {0 0 0} Stream beginning |
266 | [200 10,200,000,000,000] {0 0 0} Packet beginning | |
267 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
268 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
269 | [900 10,900,000,000,000] {0 0 0} Packet end | |
270 | [Unknown] {0 0 0} Stream end | |
271 | END | |
272 | run_test 10050 "" | |
273 | ||
274 | # Trim begin before packet beginning | |
58db335e | 275 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
276 | [Unknown] {0 0 0} Stream beginning |
277 | [200 10,200,000,000,000] {0 0 0} Packet beginning | |
278 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
279 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
280 | [900 10,900,000,000,000] {0 0 0} Packet end | |
281 | [Unknown] {0 0 0} Stream end | |
282 | END | |
283 | run_test 10150 "" | |
284 | ||
285 | # Trim begin before first event | |
58db335e | 286 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
287 | [250 10,250,000,000,000] {0 0 0} Stream beginning |
288 | [250 10,250,000,000,000] {0 0 0} Packet beginning | |
289 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
290 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
291 | [900 10,900,000,000,000] {0 0 0} Packet end | |
292 | [Unknown] {0 0 0} Stream end | |
293 | END | |
294 | run_test 10250 "" | |
295 | ||
296 | # Trim begin before second event | |
58db335e | 297 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
298 | [350 10,350,000,000,000] {0 0 0} Stream beginning |
299 | [350 10,350,000,000,000] {0 0 0} Packet beginning | |
300 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
301 | [900 10,900,000,000,000] {0 0 0} Packet end | |
302 | [Unknown] {0 0 0} Stream end | |
303 | END | |
304 | ||
305 | run_test 10350 "" | |
306 | ||
307 | # Trim begin before packet end | |
58db335e | 308 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
309 | [850 10,850,000,000,000] {0 0 0} Stream beginning |
310 | [850 10,850,000,000,000] {0 0 0} Packet beginning | |
311 | [900 10,900,000,000,000] {0 0 0} Packet end | |
312 | [Unknown] {0 0 0} Stream end | |
313 | END | |
314 | ||
315 | run_test 10850 "" | |
316 | ||
317 | # Trim begin after everything | |
58db335e | 318 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
319 | END |
320 | ||
321 | run_test 11050 "" | |
322 | ||
323 | # Trim end after stream end | |
58db335e | 324 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
325 | [Unknown] {0 0 0} Stream beginning |
326 | [200 10,200,000,000,000] {0 0 0} Packet beginning | |
327 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
328 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
329 | [900 10,900,000,000,000] {0 0 0} Packet end | |
330 | [Unknown] {0 0 0} Stream end | |
331 | END | |
332 | ||
333 | run_test "" 11050 | |
334 | ||
335 | # Trim end after packet end | |
58db335e | 336 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
337 | [Unknown] {0 0 0} Stream beginning |
338 | [200 10,200,000,000,000] {0 0 0} Packet beginning | |
339 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
340 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
341 | [900 10,900,000,000,000] {0 0 0} Packet end | |
342 | [Unknown] {0 0 0} Stream end | |
343 | END | |
344 | ||
345 | run_test "" 10950 | |
346 | ||
347 | # Trim end after second event | |
58db335e | 348 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
349 | [Unknown] {0 0 0} Stream beginning |
350 | [200 10,200,000,000,000] {0 0 0} Packet beginning | |
351 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
352 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
353 | [450 10,450,000,000,000] {0 0 0} Packet end | |
354 | [450 10,450,000,000,000] {0 0 0} Stream end | |
355 | END | |
356 | ||
357 | run_test "" 10450 | |
358 | ||
359 | # Trim end after first event | |
58db335e | 360 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
361 | [Unknown] {0 0 0} Stream beginning |
362 | [200 10,200,000,000,000] {0 0 0} Packet beginning | |
363 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
364 | [350 10,350,000,000,000] {0 0 0} Packet end | |
365 | [350 10,350,000,000,000] {0 0 0} Stream end | |
366 | END | |
367 | ||
368 | run_test "" 10350 | |
369 | ||
370 | # Trim end after packet beginning | |
58db335e | 371 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
372 | [Unknown] {0 0 0} Stream beginning |
373 | [200 10,200,000,000,000] {0 0 0} Packet beginning | |
374 | [250 10,250,000,000,000] {0 0 0} Packet end | |
375 | [250 10,250,000,000,000] {0 0 0} Stream end | |
376 | END | |
377 | ||
378 | run_test "" 10250 | |
379 | ||
380 | # Trim end after stream beginning | |
58db335e | 381 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
382 | [Unknown] {0 0 0} Stream beginning |
383 | [Unknown] {0 0 0} Stream end | |
384 | END | |
385 | ||
386 | run_test "" 10150 | |
387 | ||
388 | # Trim end before everything | |
58db335e | 389 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
390 | [Unknown] {0 0 0} Stream beginning |
391 | [Unknown] {0 0 0} Stream end | |
392 | END | |
393 | ||
394 | run_test "" 10050 | |
395 | ||
396 | # Trim end at a time before what the clock class can represent | |
58db335e | 397 | cat <<- 'END' > "$temp_stdout_expected" |
188edac1 SM |
398 | [Unknown] {0 0 0} Stream beginning |
399 | [Unknown] {0 0 0} Stream end | |
400 | END | |
401 | ||
402 | run_test "" 50 | |
403 | } | |
404 | ||
e90ed87f SM |
405 | function test_with_stream_msg_cs_without_packets { |
406 | with_stream_msgs_cs="true" | |
407 | with_packet_msgs="false" | |
408 | ||
409 | # Baseline (without trimming) | |
410 | cat <<- 'END' > "$temp_stdout_expected" | |
411 | [100 10,100,000,000,000] {0 0 0} Stream beginning | |
412 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
413 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
414 | [1000 11,000,000,000,000] {0 0 0} Stream end | |
415 | END | |
416 | run_test "" "" | |
417 | ||
418 | # Trim begin at a time before what the clock class can represent | |
419 | cat <<- 'END' > "$temp_stdout_expected" | |
420 | [100 10,100,000,000,000] {0 0 0} Stream beginning | |
421 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
422 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
423 | [1000 11,000,000,000,000] {0 0 0} Stream end | |
424 | END | |
425 | run_test 50 "" | |
426 | ||
427 | # Trim begin before stream beginning | |
428 | cat <<- 'END' > "$temp_stdout_expected" | |
429 | [100 10,100,000,000,000] {0 0 0} Stream beginning | |
430 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
431 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
432 | [1000 11,000,000,000,000] {0 0 0} Stream end | |
433 | END | |
434 | run_test 10050 "" | |
435 | ||
436 | # Trim begin before first event | |
437 | cat <<- 'END' > "$temp_stdout_expected" | |
438 | [250 10,250,000,000,000] {0 0 0} Stream beginning | |
439 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
440 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
441 | [1000 11,000,000,000,000] {0 0 0} Stream end | |
442 | END | |
443 | run_test 10250 "" | |
444 | ||
445 | # Trim begin before second event | |
446 | cat <<- 'END' > "$temp_stdout_expected" | |
447 | [350 10,350,000,000,000] {0 0 0} Stream beginning | |
448 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
449 | [1000 11,000,000,000,000] {0 0 0} Stream end | |
450 | END | |
451 | ||
452 | run_test 10350 "" | |
453 | ||
454 | # Trim begin before packet end | |
455 | cat <<- 'END' > "$temp_stdout_expected" | |
456 | [850 10,850,000,000,000] {0 0 0} Stream beginning | |
457 | [1000 11,000,000,000,000] {0 0 0} Stream end | |
458 | END | |
459 | ||
460 | run_test 10850 "" | |
461 | ||
462 | # Trim begin after everything | |
463 | cat <<- 'END' > "$temp_stdout_expected" | |
464 | END | |
465 | ||
466 | run_test 11050 "" | |
467 | ||
468 | # Trim end after stream end | |
469 | cat <<- 'END' > "$temp_stdout_expected" | |
470 | [100 10,100,000,000,000] {0 0 0} Stream beginning | |
471 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
472 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
473 | [1000 11,000,000,000,000] {0 0 0} Stream end | |
474 | END | |
475 | ||
476 | run_test "" 11050 | |
477 | ||
478 | # Trim end after packet end | |
479 | cat <<- 'END' > "$temp_stdout_expected" | |
480 | [100 10,100,000,000,000] {0 0 0} Stream beginning | |
481 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
482 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
483 | [950 10,950,000,000,000] {0 0 0} Stream end | |
484 | END | |
485 | ||
486 | run_test "" 10950 | |
487 | ||
488 | # Trim end after second event | |
489 | cat <<- 'END' > "$temp_stdout_expected" | |
490 | [100 10,100,000,000,000] {0 0 0} Stream beginning | |
491 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
492 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
493 | [450 10,450,000,000,000] {0 0 0} Stream end | |
494 | END | |
495 | ||
496 | run_test "" 10450 | |
497 | ||
498 | # Trim end after first event | |
499 | cat <<- 'END' > "$temp_stdout_expected" | |
500 | [100 10,100,000,000,000] {0 0 0} Stream beginning | |
501 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
502 | [350 10,350,000,000,000] {0 0 0} Stream end | |
503 | END | |
504 | ||
505 | run_test "" 10350 | |
506 | ||
507 | # Trim end after packet beginning | |
508 | cat <<- 'END' > "$temp_stdout_expected" | |
509 | [100 10,100,000,000,000] {0 0 0} Stream beginning | |
510 | [250 10,250,000,000,000] {0 0 0} Stream end | |
511 | END | |
512 | ||
513 | run_test "" 10250 | |
514 | ||
515 | # Trim end after stream beginning | |
516 | cat <<- 'END' > "$temp_stdout_expected" | |
517 | [100 10,100,000,000,000] {0 0 0} Stream beginning | |
518 | [150 10,150,000,000,000] {0 0 0} Stream end | |
519 | END | |
520 | ||
521 | run_test "" 10150 | |
522 | ||
523 | # Trim end before everything | |
524 | cat <<- 'END' > "$temp_stdout_expected" | |
525 | END | |
526 | ||
527 | run_test "" 10050 | |
528 | ||
529 | # Trim end at a time before what the clock class can represent | |
530 | cat <<- 'END' > "$temp_stdout_expected" | |
531 | END | |
532 | ||
533 | run_test "" 50 | |
534 | } | |
535 | ||
536 | function test_without_stream_msg_cs_without_packets { | |
537 | with_stream_msgs_cs="false" | |
538 | with_packet_msgs="false" | |
539 | ||
540 | # Baseline (without trimming) | |
541 | cat <<- 'END' > "$temp_stdout_expected" | |
542 | [Unknown] {0 0 0} Stream beginning | |
543 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
544 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
545 | [Unknown] {0 0 0} Stream end | |
546 | END | |
547 | run_test "" "" | |
548 | ||
549 | # Trim begin at a time before what the clock class can represent | |
550 | cat <<- 'END' > "$temp_stdout_expected" | |
551 | [Unknown] {0 0 0} Stream beginning | |
552 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
553 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
554 | [Unknown] {0 0 0} Stream end | |
555 | END | |
556 | run_test 50 "" | |
557 | ||
558 | # Trim begin before stream beginning | |
559 | cat <<- 'END' > "$temp_stdout_expected" | |
560 | [Unknown] {0 0 0} Stream beginning | |
561 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
562 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
563 | [Unknown] {0 0 0} Stream end | |
564 | END | |
565 | run_test 10050 "" | |
566 | ||
567 | # Trim begin before second event | |
568 | cat <<- 'END' > "$temp_stdout_expected" | |
569 | [350 10,350,000,000,000] {0 0 0} Stream beginning | |
570 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
571 | [Unknown] {0 0 0} Stream end | |
572 | END | |
573 | ||
574 | run_test 10350 "" | |
575 | ||
576 | # Trim begin after everything | |
577 | cat <<- 'END' > "$temp_stdout_expected" | |
578 | END | |
579 | ||
580 | run_test 11050 "" | |
581 | ||
582 | # Trim end after stream end | |
583 | cat <<- 'END' > "$temp_stdout_expected" | |
584 | [Unknown] {0 0 0} Stream beginning | |
585 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
586 | [400 10,400,000,000,000] {0 0 0} Event `event 2` (1) | |
587 | [Unknown] {0 0 0} Stream end | |
588 | END | |
589 | ||
590 | run_test "" 11050 | |
591 | ||
592 | # Trim end after first event | |
593 | cat <<- 'END' > "$temp_stdout_expected" | |
594 | [Unknown] {0 0 0} Stream beginning | |
595 | [300 10,300,000,000,000] {0 0 0} Event `event 1` (0) | |
596 | [350 10,350,000,000,000] {0 0 0} Stream end | |
597 | END | |
598 | ||
599 | run_test "" 10350 | |
600 | ||
601 | # Trim end after stream beginning | |
602 | cat <<- 'END' > "$temp_stdout_expected" | |
603 | [Unknown] {0 0 0} Stream beginning | |
604 | [Unknown] {0 0 0} Stream end | |
605 | END | |
606 | ||
607 | run_test "" 10150 | |
608 | ||
609 | # Trim end at a time before what the clock class can represent | |
610 | cat <<- 'END' > "$temp_stdout_expected" | |
611 | [Unknown] {0 0 0} Stream beginning | |
612 | [Unknown] {0 0 0} Stream end | |
613 | END | |
614 | ||
615 | run_test "" 50 | |
616 | } | |
617 | ||
618 | test_with_stream_msg_cs_with_packets | |
619 | test_without_stream_msg_cs_with_packets | |
620 | test_with_stream_msg_cs_without_packets | |
621 | test_without_stream_msg_cs_without_packets | |
188edac1 | 622 | |
58db335e FD |
623 | # Do not `rm` $temp_stderr_expected because it's set to `/dev/null` right now |
624 | # and that would print an error. | |
625 | rm -f "$temp_stdout_expected" |