tests: make auto-source-discovery-grouping test use sink.text.details
[babeltrace.git] / tests / cli / convert / test_auto_source_discovery_params
CommitLineData
1ead9076
SM
1#!/bin/bash
2#
3# Copyright (C) 2019 Simon Marchi <simon.marchi@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
18# Test how parameters are applied to sources auto-discovered by the convert
19# command.
20
21if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
22 UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh"
23else
24 UTILSSH="$(dirname "$0")/../../utils/utils.sh"
25fi
26
27# shellcheck source=../../utils/utils.sh
28SH_TAP=1 source "$UTILSSH"
29
30NUM_TESTS=4
31
32plan_tests $NUM_TESTS
33
1b2b6649 34data_dir="${BT_TESTS_DATADIR}/cli/convert/auto-source-discovery-params-log-level"
1ead9076
SM
35plugin_dir="${data_dir}"
36dir_a="${data_dir}/dir-a"
37dir_b="${data_dir}/dir-b"
38dir_ab="${data_dir}/dir-ab"
39
40expected_file=$(mktemp -t expected.XXXXXX)
41stderr_expected=/dev/null
42
1b2b6649
SM
43print_test_params="--params print=\"test-params\""
44
24594611 45# Apply params to two components from one non-option argument.
1ead9076
SM
46cat > "$expected_file" <<END
47TestSourceA: ('test-allo', 'madame')
48TestSourceB: ('test-allo', 'madame')
49END
50
51bt_diff_cli_sorted "$expected_file" "$stderr_expected" \
52 convert --plugin-path "${plugin_dir}" \
1b2b6649 53 "${dir_ab}" --params 'test-allo="madame"' ${print_test_params}
24594611 54ok "$?" "apply params to two components from one non-option argument"
1ead9076 55
24594611 56# Apply params to two components from two distinct non-option arguments.
1ead9076
SM
57cat > "$expected_file" <<END
58TestSourceA: ('test-allo', 'madame')
59TestSourceB: ('test-bonjour', 'monsieur')
60END
61
62bt_diff_cli_sorted "$expected_file" "$stderr_expected" \
63 convert --plugin-path "${plugin_dir}" \
1b2b6649 64 "${dir_a}" --params 'test-allo="madame"' ${print_test_params} "${dir_b}" --params 'test-bonjour="monsieur"' ${print_test_params}
24594611 65ok "$?" "apply params to two non-option arguments"
1ead9076 66
24594611 67# Apply params to one component coming from one non-option argument and one component coming from two non-option arguments (1).
1ead9076
SM
68cat > "$expected_file" <<END
69TestSourceA: ('test-allo', 'madame'), ('test-bonjour', 'monsieur')
70TestSourceB: ('test-bonjour', 'monsieur')
71END
72
73bt_diff_cli_sorted "$expected_file" "$stderr_expected" \
74 convert --plugin-path "${plugin_dir}" \
1b2b6649 75 "${dir_a}" --params 'test-allo="madame"' ${print_test_params} "${dir_ab}" --params 'test-bonjour="monsieur"' ${print_test_params}
24594611 76ok "$?" "apply params to one component coming from one non-option argument and one component coming from two non-option arguments (1)"
1ead9076 77
24594611 78# Apply params to one component coming from one non-option argument and one component coming from two non-option arguments (2).
1ead9076
SM
79cat > "$expected_file" <<END
80TestSourceA: ('test-bonjour', 'monsieur'), ('test-salut', 'les amis')
81TestSourceB: ('test-bonjour', 'madame'), ('test-salut', 'les amis')
82END
83
84bt_diff_cli_sorted "$expected_file" "$stderr_expected" \
85 convert --plugin-path "${plugin_dir}" \
1b2b6649 86 "${dir_ab}" --params 'test-bonjour="madame",test-salut="les amis"' ${print_test_params} "${dir_a}" --params 'test-bonjour="monsieur"' ${print_test_params}
24594611 87ok "$?" "apply params to one component coming from one non-option argument and one component coming from two non-option arguments (2)"
1ead9076
SM
88
89rm -f "$expected_file"
This page took 0.025886 seconds and 4 git commands to generate.