tests: readlink 'canonicalize' is GNU specific
[babeltrace.git] / tests / cli / auto-source-discovery / test_auto_source_discovery
CommitLineData
73760435
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 the auto source disovery mechanism of the CLI.
19
20if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
21 UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh"
22else
23 UTILSSH="$(dirname "$0")/../../utils/utils.sh"
24fi
25
26# shellcheck source=../../utils/utils.sh
27SH_TAP=1 source "$UTILSSH"
28
29NUM_TESTS=2
30
31plan_tests $NUM_TESTS
32
9c5dd55a 33data_dir="${BT_TESTS_DATADIR}/cli/auto-source-discovery"
73760435
SM
34plugin_dir="${data_dir}"
35trace_dir="${data_dir}/traces"
36
37expected_file=$(mktemp expected.XXXXXX)
38actual_file=$(mktemp actual.XXXXXX)
39
40run_python_bt2 "$BT_TESTS_BT2_BIN" convert --plugin-path "${plugin_dir}" "ABCDE" "${trace_dir}" some_other_leftover | sort > "$actual_file"
41ok "${PIPESTATUS[0]}" "successful execution"
42
43cat > "$expected_file" <<END
44TestSourceABCDE: ABCDE
45TestSourceExt: ${trace_dir}/aaa1, ${trace_dir}/aaa2, ${trace_dir}/aaa3
46TestSourceExt: ${trace_dir}/bbb1, ${trace_dir}/bbb2
47TestSourceExt: ${trace_dir}/ccc1
48TestSourceExt: ${trace_dir}/ccc2
49TestSourceExt: ${trace_dir}/ccc3
50TestSourceExt: ${trace_dir}/ccc4
51TestSourceSomeDir: ${trace_dir}/some-dir
52END
53
54diff -u "$expected_file" "$actual_file"
55ok "$?" "sources are auto-discovered"
56
57rm -f "$expected_file" "$actual_file"
This page took 0.030194 seconds and 4 git commands to generate.