test_try_again_many_times(): use three times `None`'s ref count
[babeltrace.git] / tests / cli / convert / test_auto_source_discovery_log_level
CommitLineData
1b2b6649
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 log level options 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
34data_dir="${BT_TESTS_DATADIR}/cli/convert/auto-source-discovery-params-log-level"
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
43print_log_level="--params print=\"log-level\""
44
45debug=2
46trace=1
47
48# Apply log level to two components from one leftover.
49cat > "$expected_file" <<END
50TestSourceA: ${debug}
51TestSourceB: ${debug}
52END
53
54bt_diff_cli_sorted "$expected_file" "$stderr_expected" \
55 convert --plugin-path "${plugin_dir}" \
56 "${dir_ab}" --log-level DEBUG ${print_log_level}
57ok "$?" "apply log level to two components from one leftover"
58
59# Apply log level to two components from two distinct leftovers.
60cat > "$expected_file" <<END
61TestSourceA: ${debug}
62TestSourceB: ${trace}
63END
64
65bt_diff_cli_sorted "$expected_file" "$stderr_expected" \
66 convert --plugin-path "${plugin_dir}" \
67 "${dir_a}" --log-level DEBUG ${print_log_level} "${dir_b}" --log-level TRACE ${print_log_level}
68ok "$?" "apply log level to two leftovers"
69
70# Apply log level to one component coming from one leftover and one component coming from two leftovers (1).
71cat > "$expected_file" <<END
72TestSourceA: ${trace}
73TestSourceB: ${trace}
74END
75
76bt_diff_cli_sorted "$expected_file" "$stderr_expected" \
77 convert --plugin-path "${plugin_dir}" \
78 "${dir_a}" --log-level DEBUG ${print_log_level} "${dir_ab}" --log-level TRACE ${print_log_level}
79ok "$?" "apply log level to one component coming from one leftover and one component coming from two leftovers (1)"
80
81# Apply log level to one component coming from one leftover and one component coming from two leftovers (2).
82cat > "$expected_file" <<END
83TestSourceA: ${trace}
84TestSourceB: ${debug}
85END
86
87bt_diff_cli_sorted "$expected_file" "$stderr_expected" \
88 convert --plugin-path "${plugin_dir}" \
89 "${dir_ab}" --log-level DEBUG ${print_log_level} "${dir_a}" --log-level TRACE ${print_log_level}
90ok "$?" "apply log level to one component coming from one leftover and one component coming from two leftovers (2)"
91
92rm -f "$expected_file"
This page took 0.025301 seconds and 4 git commands to generate.