3 # Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com>
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.
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
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.
18 # Test the auto source disovery mechanism of the CLI.
20 if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
21 UTILSSH
="$BT_TESTS_SRCDIR/utils/utils.sh"
23 UTILSSH
="$(dirname "$0")/../../utils/utils.sh"
26 # shellcheck source=../../utils/utils.sh
27 SH_TAP
=1 source "$UTILSSH"
33 data_dir
="${BT_TESTS_DATADIR}/cli/convert/auto-source-discovery-grouping"
34 plugin_dir
="${data_dir}"
35 trace_dir
="${data_dir}/traces"
37 if [ "$BT_OS_TYPE" = "mingw" ]; then
38 # Use Windows native paths for comparison because Unix
39 # paths are converted by the shell before they are passed
40 # to the native babeltrace2 binary.
41 trace_dir
=$
(cygpath
-w "$trace_dir")
47 expected_file=$(mktemp -t expected.XXXXXX)
48 stderr_expected=/dev/null
50 cat > "$expected_file" <<END
51 TestSourceABCDE: ABCDE
52 TestSourceExt: ${trace_dir}${dir_sep}aaa1, ${trace_dir}${dir_sep}aaa2, ${trace_dir}${dir_sep}aaa3
53 TestSourceExt: ${trace_dir}${dir_sep}bbb1, ${trace_dir}${dir_sep}bbb2
54 TestSourceExt: ${trace_dir}${dir_sep}ccc1
55 TestSourceExt: ${trace_dir}${dir_sep}ccc2
56 TestSourceExt: ${trace_dir}${dir_sep}ccc3
57 TestSourceExt: ${trace_dir}${dir_sep}ccc4
58 TestSourceSomeDir: ${trace_dir}${dir_sep}some-dir
61 bt_diff_cli_sorted "$expected_file" "$stderr_expected" convert --plugin-path "${plugin_dir}" "ABCDE" "${trace_dir}" some_other_non_opt
62 ok "$?" "sources are auto-discovered"
64 rm -f "$expected_file"
This page took 0.033798 seconds and 5 git commands to generate.