Commit | Line | Data |
---|---|---|
54d785fa PP |
1 | #!/bin/bash |
2 | # | |
0235b0db | 3 | # SPDX-License-Identifier: GPL-2.0-only |
54d785fa | 4 | # |
0235b0db | 5 | # Copyright (C) 2019 Philippe Proulx <pproulx@efficios.com> |
54d785fa | 6 | # |
54d785fa PP |
7 | |
8 | SH_TAP=1 | |
9 | ||
75e396f6 | 10 | if [ -n "${BT_TESTS_SRCDIR:-}" ]; then |
54d785fa PP |
11 | UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh" |
12 | else | |
13 | UTILSSH="$(dirname "$0")/../../../utils/utils.sh" | |
14 | fi | |
15 | ||
16 | # shellcheck source=../../../utils/utils.sh | |
17 | source "$UTILSSH" | |
18 | ||
19 | this_dir_relative="plugins/sink.text.details/succeed" | |
20 | expect_dir="$BT_TESTS_DATADIR/$this_dir_relative" | |
21 | ||
22 | test_details() { | |
23 | local test_name="$1" | |
24 | local trace_name="$2" | |
25 | shift 2 | |
26 | local details_args=("$@") | |
27 | local trace_dir="$BT_CTF_TRACES_PATH/succeed/$trace_name" | |
28 | local expect_path="$expect_dir/$test_name.expect" | |
29 | ||
30 | bt_diff_cli "$expect_path" /dev/null \ | |
31 | "$trace_dir" -p trace-name=the-trace \ | |
32 | -c sink.text.details "${details_args[@]+${details_args[@]}}" | |
33 | ok $? "'$test_name' test has the expected output" | |
34 | } | |
35 | ||
36 | # This is used for the moment because the source is `src.ctf.fs` and | |
37 | # such a component can make its stream names contain absolute paths. | |
38 | test_details_no_stream_name() { | |
39 | local test_name="$1" | |
40 | local trace_name="$2" | |
41 | shift 2 | |
42 | local details_args=("$@") | |
43 | ||
44 | test_details "$test_name" "$trace_name" \ | |
45 | "${details_args[@]+${details_args[@]}}" -p with-stream-name=no | |
46 | } | |
47 | ||
cc413248 | 48 | plan_tests 12 |
54d785fa PP |
49 | |
50 | test_details_no_stream_name default wk-heartbeat-u | |
51 | test_details_no_stream_name default-compact wk-heartbeat-u -p compact=yes | |
52 | test_details_no_stream_name default-compact-without-metadata wk-heartbeat-u -p compact=yes,with-metadata=no | |
53 | test_details_no_stream_name default-compact-without-time wk-heartbeat-u -p compact=yes,with-time=no | |
cc413248 PP |
54 | test_details_no_stream_name default-without-data wk-heartbeat-u -p with-data=no |
55 | test_details_no_stream_name default-without-data-without-metadata wk-heartbeat-u -p with-data=no,with-metadata=no | |
54d785fa PP |
56 | test_details_no_stream_name default-without-metadata wk-heartbeat-u -p with-metadata=no |
57 | 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 | |
58 | test_details_no_stream_name default-without-time wk-heartbeat-u -p with-time=no | |
59 | test_details_no_stream_name default-without-trace-name wk-heartbeat-u -p with-trace-name=no | |
60 | test_details_no_stream_name default-without-uuid wk-heartbeat-u -p with-uuid=no | |
61 | test_details_no_stream_name no-packet-context no-packet-context |