56df66fab33d855f8edfcef7ce569d3bb8f1114f
3 # SPDX-License-Identifier: GPL-2.0-only
5 # Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com>
8 # Test how log level options are applied to sources auto-discovered by the
11 if [ -n "${BT_TESTS_SRCDIR:-}" ]; then
12 UTILSSH
="$BT_TESTS_SRCDIR/utils/utils.sh"
14 UTILSSH
="$(dirname "$0")/../../utils/utils.sh"
17 # shellcheck source=../../utils/utils.sh
18 SH_TAP
=1 source "$UTILSSH"
24 data_dir
="${BT_TESTS_DATADIR}/auto-source-discovery/params-log-level"
25 plugin_dir
="${data_dir}"
26 dir_a
="${data_dir}/dir-a"
27 dir_b
="${data_dir}/dir-b"
28 dir_ab
="${data_dir}/dir-ab"
30 expected_file
=$
(mktemp
-t expected.XXXXXX
)
32 print_log_level
=(--params 'what="log-level"')
33 details_sink
=("-c" "sink.text.details" "--params=with-metadata=false")
38 # Apply log level to two components from one non-option argument.
39 cat > "$expected_file" <<END
40 {Trace 0, Stream class ID 0, Stream ID 0}
42 Name: TestSourceA: ${debug}
44 Stream (ID 0, Class ID 0)
46 {Trace 1, Stream class ID 0, Stream ID 0}
48 Name: TestSourceB: ${debug}
50 Stream (ID 0, Class ID 0)
52 {Trace 0, Stream class ID 0, Stream ID 0}
55 {Trace 1, Stream class ID 0, Stream ID 0}
59 bt_diff_cli
"$expected_file" "/dev/null" \
60 --plugin-path "${plugin_dir}" convert \
61 "${dir_ab}" --log-level DEBUG
"${print_log_level[@]}" \
63 ok
"$?" "apply log level to two components from one non-option argument"
65 # Apply log level to two components from two distinct non-option arguments.
66 cat > "$expected_file" <<END
67 {Trace 0, Stream class ID 0, Stream ID 0}
69 Name: TestSourceA: ${debug}
71 Stream (ID 0, Class ID 0)
73 {Trace 1, Stream class ID 0, Stream ID 0}
75 Name: TestSourceB: ${trace}
77 Stream (ID 0, Class ID 0)
79 {Trace 0, Stream class ID 0, Stream ID 0}
82 {Trace 1, Stream class ID 0, Stream ID 0}
86 bt_diff_cli
"$expected_file" "/dev/null" \
87 --plugin-path "${plugin_dir}" convert \
88 "${dir_a}" --log-level DEBUG "${print_log_level[@]}" "${dir_b}" --log-level TRACE "${print_log_level[@]}" \
90 ok
"$?" "apply log level to two non-option arguments"
92 # Apply log level to one component coming from one non-option argument and one component coming from two non-option arguments (1).
93 cat > "$expected_file" <<END
94 {Trace 0, Stream class ID 0, Stream ID 0}
96 Name: TestSourceA: ${trace}
98 Stream (ID 0, Class ID 0)
100 {Trace 1, Stream class ID 0, Stream ID 0}
102 Name: TestSourceB: ${trace}
104 Stream (ID 0, Class ID 0)
106 {Trace 0, Stream class ID 0, Stream ID 0}
109 {Trace 1, Stream class ID 0, Stream ID 0}
113 bt_diff_cli
"$expected_file" "/dev/null" \
114 --plugin-path "${plugin_dir}" convert \
115 "${dir_a}" --log-level DEBUG "${print_log_level[@]}" "${dir_ab}" --log-level TRACE "${print_log_level[@]}" \
117 ok
"$?" "apply log level to one component coming from one non-option argument and one component coming from two non-option arguments (1)"
119 # Apply log level to one component coming from one non-option argument and one component coming from two non-option arguments (2).
120 cat > "$expected_file" <<END
121 {Trace 0, Stream class ID 0, Stream ID 0}
123 Name: TestSourceA: ${trace}
125 Stream (ID 0, Class ID 0)
127 {Trace 1, Stream class ID 0, Stream ID 0}
129 Name: TestSourceB: ${debug}
131 Stream (ID 0, Class ID 0)
133 {Trace 0, Stream class ID 0, Stream ID 0}
136 {Trace 1, Stream class ID 0, Stream ID 0}
140 bt_diff_cli
"$expected_file" "/dev/null" \
141 --plugin-path "${plugin_dir}" convert \
142 "${dir_ab}" --log-level DEBUG "${print_log_level[@]}" "${dir_a}" --log-level TRACE "${print_log_level[@]}" \
144 ok
"$?" "apply log level to one component coming from one non-option argument and one component coming from two non-option arguments (2)"
146 rm -f "$expected_file"
This page took 0.035021 seconds and 3 git commands to generate.