3 # SPDX-License-Identifier: GPL-2.0-only
5 # Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com>
8 # Test how parameters are applied to sources auto-discovered by the convert
11 if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; 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_test_params
=("--params" 'what="test-params"')
33 details_sink
=("-c" "sink.text.details" "--params=with-metadata=false")
35 # Apply params to two components from one non-option argument.
36 cat > "$expected_file" <<END
37 {Trace 0, Stream class ID 0, Stream ID 0}
39 Name: TestSourceA: ('test-allo', 'madame')
41 Stream (ID 0, Class ID 0)
43 {Trace 1, Stream class ID 0, Stream ID 0}
45 Name: TestSourceB: ('test-allo', 'madame')
47 Stream (ID 0, Class ID 0)
49 {Trace 0, Stream class ID 0, Stream ID 0}
52 {Trace 1, Stream class ID 0, Stream ID 0}
56 bt_diff_cli
"$expected_file" "/dev/null" \
57 --plugin-path "${plugin_dir}" convert \
58 "${dir_ab}" --params 'test-allo="madame"' "${print_test_params[@]}" \
60 ok
"$?" "apply params to two components from one non-option argument"
62 # Apply params to two components from two distinct non-option arguments.
63 cat > "$expected_file" <<END
64 {Trace 0, Stream class ID 0, Stream ID 0}
66 Name: TestSourceA: ('test-allo', 'madame')
68 Stream (ID 0, Class ID 0)
70 {Trace 1, Stream class ID 0, Stream ID 0}
72 Name: TestSourceB: ('test-bonjour', 'monsieur')
74 Stream (ID 0, Class ID 0)
76 {Trace 0, Stream class ID 0, Stream ID 0}
79 {Trace 1, Stream class ID 0, Stream ID 0}
83 bt_diff_cli
"$expected_file" "/dev/null" \
84 --plugin-path "${plugin_dir}" convert \
85 "${dir_a}" --params 'test-allo="madame"' "${print_test_params[@]}" "${dir_b}" --params 'test-bonjour="monsieur"' "${print_test_params[@]}" \
87 ok
"$?" "apply params to two non-option arguments"
89 # Apply params to one component coming from one non-option argument and one component coming from two non-option arguments (1).
90 cat > "$expected_file" <<END
91 {Trace 0, Stream class ID 0, Stream ID 0}
93 Name: TestSourceA: ('test-allo', 'madame'), ('test-bonjour', 'monsieur')
95 Stream (ID 0, Class ID 0)
97 {Trace 1, Stream class ID 0, Stream ID 0}
99 Name: TestSourceB: ('test-bonjour', 'monsieur')
101 Stream (ID 0, Class ID 0)
103 {Trace 0, Stream class ID 0, Stream ID 0}
106 {Trace 1, Stream class ID 0, Stream ID 0}
110 bt_diff_cli
"$expected_file" "/dev/null" \
111 --plugin-path "${plugin_dir}" convert \
112 "${dir_a}" --params 'test-allo="madame"' "${print_test_params[@]}" "${dir_ab}" --params 'test-bonjour="monsieur"' "${print_test_params[@]}" \
114 ok
"$?" "apply params to one component coming from one non-option argument and one component coming from two non-option arguments (1)"
116 # Apply params to one component coming from one non-option argument and one component coming from two non-option arguments (2).
117 cat > "$expected_file" <<END
118 {Trace 0, Stream class ID 0, Stream ID 0}
120 Name: TestSourceA: ('test-bonjour', 'monsieur'), ('test-salut', 'les amis')
122 Stream (ID 0, Class ID 0)
124 {Trace 1, Stream class ID 0, Stream ID 0}
126 Name: TestSourceB: ('test-bonjour', 'madame'), ('test-salut', 'les amis')
128 Stream (ID 0, Class ID 0)
130 {Trace 0, Stream class ID 0, Stream ID 0}
133 {Trace 1, Stream class ID 0, Stream ID 0}
137 bt_diff_cli
"$expected_file" "/dev/null" \
138 --plugin-path "${plugin_dir}" convert \
139 "${dir_ab}" --params 'test-bonjour="madame",test-salut="les amis"' "${print_test_params[@]}" "${dir_a}" --params 'test-bonjour="monsieur"' "${print_test_params[@]}" \
141 ok
"$?" "apply params to one component coming from one non-option argument and one component coming from two non-option arguments (2)"
143 rm -f "$expected_file"
This page took 0.039964 seconds and 4 git commands to generate.