Commit | Line | Data |
---|---|---|
73760435 SM |
1 | #!/bin/bash |
2 | # | |
0235b0db | 3 | # SPDX-License-Identifier: GPL-2.0-only |
73760435 | 4 | # |
0235b0db | 5 | # Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com> |
73760435 | 6 | # |
73760435 SM |
7 | |
8 | # Test the auto source disovery mechanism of the CLI. | |
9 | ||
75e396f6 | 10 | if [ -n "${BT_TESTS_SRCDIR:-}" ]; then |
73760435 SM |
11 | UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh" |
12 | else | |
13 | UTILSSH="$(dirname "$0")/../../utils/utils.sh" | |
14 | fi | |
15 | ||
16 | # shellcheck source=../../utils/utils.sh | |
17 | SH_TAP=1 source "$UTILSSH" | |
18 | ||
97010665 | 19 | NUM_TESTS=3 |
73760435 SM |
20 | |
21 | plan_tests $NUM_TESTS | |
22 | ||
a83410cd | 23 | data_dir="${BT_TESTS_DATADIR}/auto-source-discovery/grouping" |
73760435 SM |
24 | plugin_dir="${data_dir}" |
25 | trace_dir="${data_dir}/traces" | |
26 | ||
a83410cd | 27 | stdout_expected_file="${BT_TESTS_DATADIR}/cli/convert/auto-source-discovery-grouping.expect" |
97010665 SM |
28 | stdout_actual_file=$(mktemp -t stdout-actual.XXXXXX) |
29 | stderr_actual_file=$(mktemp -t actual-stderr.XXXXXX) | |
73760435 | 30 | |
97010665 | 31 | bt_cli "$stdout_actual_file" "$stderr_actual_file" \ |
02510056 | 32 | --plugin-path "${plugin_dir}" convert "ABCDE" "${trace_dir}" some_other_non_opt \ |
216b7cc7 | 33 | -c sink.text.details --params='with-metadata=false' |
97010665 SM |
34 | ok "$?" "CLI runs successfully" |
35 | ||
36 | # Check components and their inputs. | |
37 | bt_diff "$stdout_expected_file" "$stdout_actual_file" | |
38 | ok "$?" "expected components are instantiated with expected inputs" | |
39 | ||
40 | # Check that expected warning is printed. | |
4656d91f | 41 | # shellcheck disable=SC2016 |
97010665 SM |
42 | grep -q 'No trace was found based on input `some_other_non_opt`' "$stderr_actual_file" |
43 | ok "$?" "warning is printed" | |
44 | ||
45 | rm -f "$stdout_actual_file" | |
46 | rm -f "$stderr_actual_file" |