Commit | Line | Data |
---|---|---|
54d785fa PP |
1 | #!/bin/bash |
2 | # | |
3 | # Copyright (C) 2019 Philippe Proulx <pproulx@efficios.com> | |
4 | # | |
5 | # This program is free software; you can redistribute it and/or | |
6 | # modify it under the terms of the GNU General Public License | |
7 | # as published by the Free Software Foundation; only version 2 | |
8 | # of the License. | |
9 | # | |
10 | # This program is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | # GNU General Public License for more details. | |
14 | # | |
15 | # You should have received a copy of the GNU General Public License | |
16 | # along with this program; if not, write to the Free Software | |
17 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
18 | ||
19 | SH_TAP=1 | |
20 | ||
21 | if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then | |
22 | UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh" | |
23 | else | |
24 | UTILSSH="$(dirname "$0")/../../../utils/utils.sh" | |
25 | fi | |
26 | ||
27 | # shellcheck source=../../../utils/utils.sh | |
28 | source "$UTILSSH" | |
29 | ||
30 | this_dir_relative="plugins/sink.text.details/succeed" | |
31 | expect_dir="$BT_TESTS_DATADIR/$this_dir_relative" | |
32 | ||
33 | test_details() { | |
34 | local test_name="$1" | |
35 | local trace_name="$2" | |
36 | shift 2 | |
37 | local details_args=("$@") | |
38 | local trace_dir="$BT_CTF_TRACES_PATH/succeed/$trace_name" | |
39 | local expect_path="$expect_dir/$test_name.expect" | |
40 | ||
41 | bt_diff_cli "$expect_path" /dev/null \ | |
42 | "$trace_dir" -p trace-name=the-trace \ | |
43 | -c sink.text.details "${details_args[@]+${details_args[@]}}" | |
44 | ok $? "'$test_name' test has the expected output" | |
45 | } | |
46 | ||
47 | # This is used for the moment because the source is `src.ctf.fs` and | |
48 | # such a component can make its stream names contain absolute paths. | |
49 | test_details_no_stream_name() { | |
50 | local test_name="$1" | |
51 | local trace_name="$2" | |
52 | shift 2 | |
53 | local details_args=("$@") | |
54 | ||
55 | test_details "$test_name" "$trace_name" \ | |
56 | "${details_args[@]+${details_args[@]}}" -p with-stream-name=no | |
57 | } | |
58 | ||
59 | plan_tests 10 | |
60 | ||
61 | test_details_no_stream_name default wk-heartbeat-u | |
62 | test_details_no_stream_name default-compact wk-heartbeat-u -p compact=yes | |
63 | test_details_no_stream_name default-compact-without-metadata wk-heartbeat-u -p compact=yes,with-metadata=no | |
64 | test_details_no_stream_name default-compact-without-time wk-heartbeat-u -p compact=yes,with-time=no | |
65 | test_details_no_stream_name default-without-metadata wk-heartbeat-u -p with-metadata=no | |
66 | test_details_no_stream_name default-without-names wk-heartbeat-u -p with-stream-name=no,with-trace-name=no,with-stream-class-name=no | |
67 | test_details_no_stream_name default-without-time wk-heartbeat-u -p with-time=no | |
68 | test_details_no_stream_name default-without-trace-name wk-heartbeat-u -p with-trace-name=no | |
69 | test_details_no_stream_name default-without-uuid wk-heartbeat-u -p with-uuid=no | |
70 | test_details_no_stream_name no-packet-context no-packet-context |