bt2: add missing parameter to _UserComponentType._query
[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 21
93fb46c6 22NUM_TESTS=40
e5a54f3f
JD
23
24plan_tests $NUM_TESTS
25
26tmp_out=$(mktemp)
27
93fb46c6
SM
28# Run Babeltrace with some command line arguments, verify exit status and
29# number of output events (i.e. number of output lines)
30#
31# Arguments:
32#
33# $1: expected number of events
34# $2: test description
35# remaining arguments: command-line arguments to pass to Babeltrace
36
37function expect_success()
38{
39 local expected_num_events="$1"
40 shift
41 local msg="$1"
42 shift
43
44 "${BT_BIN}" "${TRACE_PATH}" "$@" 2>/dev/null > "${tmp_out}"
45 ok $? "trimmer: ${msg}: exit status"
46 num_events=$(wc -l < "${tmp_out}")
891c35e4
MJ
47 # Use bash parameter expansion to strip spaces added by BSD 'wc' on macOs and Solaris
48 is "${num_events// /}" "${expected_num_events}" "trimmer: ${msg}: number of events (${expected_num_events})"
93fb46c6
SM
49}
50
51expect_success 18 "--begin, GMT relative timestamps" \
52 --clock-gmt --begin 17:48:17.587029529
53expect_success 9 "--end, GMT relative timestamps" \
54 --clock-gmt --end 17:48:17.588680018
55expect_success 7 "--begin and --end, GMT relative timestamps" \
56 --clock-gmt --begin 17:48:17.587029529 --end 17:48:17.588680018
57expect_success 0 "--begin, out of range, GMT relative timestamps" \
58 --clock-gmt --begin 18:48:17.587029529
59expect_success 0 "--end, out of range, GMT relative timestamps" \
60 --clock-gmt --end 16:48:17.588680018
61
62expect_success 18 "--begin, GMT absolute timestamps" \
63 --clock-gmt --begin "2012-10-29 17:48:17.587029529"
64expect_success 9 "--end, GMT absolute timestamps" \
65 --clock-gmt --end "2012-10-29 17:48:17.588680018"
66expect_success 7 "--begin and --end, GMT absolute timestamps" \
67 --clock-gmt --begin "2012-10-29 17:48:17.587029529" --end "2012-10-29 17:48:17.588680018"
68expect_success 0 "--begin, out of range, GMT absolute timestamps" \
69 --clock-gmt --begin "2012-10-29 18:48:17.587029529"
70expect_success 0 "--begin, out of range, GMT absolute timestamps" \
71 --clock-gmt --end "2012-10-29 16:48:17.588680018"
95abf2a0
MJ
72
73export TZ=EST
74
93fb46c6
SM
75expect_success 18 "--begin, EST relative timestamps" \
76 --begin "12:48:17.587029529"
77expect_success 9 "--end, EST relative timestamps" \
78 --end "12:48:17.588680018"
79expect_success 7 "--begin and --end, EST relative timestamps" \
80 --begin "12:48:17.587029529" --end "12:48:17.588680018"
81expect_success 0 "--begin, out of range, EST relative timestamps" \
82 --begin "13:48:17.587029529"
83expect_success 0 "--end, out of range, EST relative timestamps" \
84 --end "11:48:17.588680018"
85
86expect_success 18 "--begin, EST absolute timestamps" \
87 --begin "2012-10-29 12:48:17.587029529"
88expect_success 9 "--end, EST absolute timestamps" \
89 --end "12:48:17.588680018"
90expect_success 7 "--begin and --end, EST absolute timestamps" \
91 --begin "2012-10-29 12:48:17.587029529" --end "2012-10-29 12:48:17.588680018"
92expect_success 0 "--begin, out of range, EST absolute timestamps" \
93 --begin "2012-10-29 13:48:17.587029529"
94expect_success 0 "--end, out of range, EST absolute timestamps" \
95 --end "2012-10-29 11:48:17.588680018"
e5a54f3f 96
03f007c8 97rm "${tmp_out}"
This page took 0.037577 seconds and 4 git commands to generate.