Typo: informations -> information
[babeltrace.git] / tests / cli / test_trimmer.in
CommitLineData
e5a54f3f
JD
1#!/bin/bash
2#
3# Copyright (C) - 2017 Julien Desfossez <jdesfossez@efficios.com>
4#
5# This program is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License, version 2 only, as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful, but WITHOUT
10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12# more details.
13#
14# You should have received a copy of the GNU General Public License along with
15# this program; if not, write to the Free Software Foundation, Inc., 51
16# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
3389bd41 18. "@abs_top_builddir@/tests/utils/common.sh"
e5a54f3f 19
03f007c8 20TRACE_PATH="${BT_CTF_TRACES}/succeed/wk-heartbeat-u/"
e5a54f3f
JD
21
22NUM_TESTS=10
23
24plan_tests $NUM_TESTS
25
26tmp_out=$(mktemp)
27
03f007c8
MJ
28"${BT_BIN}" --clock-gmt --begin 17:48:17.587029529 --end 17:48:17.588680018 \
29 "${TRACE_PATH}" >/dev/null 2>&1
e5a54f3f
JD
30ok $? "Read the trace with the trimmer enabled"
31
03f007c8
MJ
32"${BT_BIN}" --clock-gmt --begin 17:48:17.587029529 "${TRACE_PATH}" \
33 2>/dev/null >"${tmp_out}"
e5a54f3f 34ok $? "Running with --begin"
03f007c8 35cnt=$(wc -l < "${tmp_out}")
0ae93e87 36test $cnt == 18
e5a54f3f
JD
37ok $? "Expected number of events after trimming begin and end"
38
03f007c8
MJ
39"${BT_BIN}" --clock-gmt --end 17:48:17.588680018 "${TRACE_PATH}" \
40 2>/dev/null >"${tmp_out}"
e5a54f3f 41ok $? "Running with --end"
03f007c8 42cnt=$(wc -l < "${tmp_out}")
0ae93e87 43test $cnt == 9
e5a54f3f
JD
44ok $? "Expected number of events after trimming end"
45
03f007c8
MJ
46"${BT_BIN}" --clock-gmt --begin 17:48:17.587029529 --end 17:48:17.588680018 \
47 "${TRACE_PATH}" 2>/dev/null >"${tmp_out}"
e5a54f3f 48ok $? "Running with --begin and --end"
03f007c8 49cnt=$(wc -l < "${tmp_out}")
0ae93e87 50test $cnt == 7
e5a54f3f
JD
51ok $? "Expected number of events after trimming begin and end"
52
03f007c8
MJ
53"${BT_BIN}" --clock-gmt --begin 18:48:17.587029529 "${TRACE_PATH}" \
54 2>/dev/null >"${tmp_out}"
e5a54f3f 55ok $? "Running with --begin out of range"
03f007c8 56cnt=$(wc -l < "${tmp_out}")
0ae93e87 57test $cnt == 0
e5a54f3f
JD
58ok $? "No event output when begin is after the end of the trace"
59
03f007c8
MJ
60"${BT_BIN}" --clock-gmt --end 16:48:17.588680018 "${TRACE_PATH}" \
61 2>/dev/null >"${tmp_out}"
62cnt=$(wc -l < "${tmp_out}")
0ae93e87 63test $cnt == 0
e5a54f3f
JD
64ok $? "No event output when end is before the beginning of the trace"
65
03f007c8 66rm "${tmp_out}"
This page took 0.040204 seconds and 4 git commands to generate.