3 # SPDX-License-Identifier: GPL-2.0-only
5 # Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com>
6 # Copyright (C) 2019 Francis Deslauriers <francis.deslauriers@efficios.com>
11 if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
12 UTILSSH
="$BT_TESTS_SRCDIR/utils/utils.sh"
14 UTILSSH
="$(dirname "$0")/../../../utils/utils.sh"
17 # shellcheck source=../../../utils/utils.sh
20 this_dir_relative
="plugins/src.ctf.fs/query"
21 succeed_trace_dir
="$BT_CTF_TRACES_PATH/succeed"
22 expect_dir
="$BT_TESTS_DATADIR/$this_dir_relative"
24 test_query_metadata_info
() {
27 local trace_path
="$succeed_trace_dir/$name"
28 local expected_stdout
="$expect_dir/metadata-info-$name.expect"
29 local temp_stdout_output_file
30 local temp_stderr_output_file
31 local query
=("query" "src.ctf.fs" "metadata-info" "--params" "path=\"$trace_path\"")
33 temp_stdout_output_file
="$(mktemp -t actual_stdout.XXXXXX)"
34 temp_stderr_output_file
="$(mktemp -t actual_stderr.XXXXXX)"
36 bt_cli
"$temp_stdout_output_file" "$temp_stderr_output_file" \
39 bt_diff
"$expected_stdout" "$temp_stdout_output_file"
42 bt_diff
/dev
/null
"$temp_stderr_output_file"
45 if ((ret_stdout
!= 0 || ret_stderr
!= 0)); then
49 ok
$ret "Trace '$name' \`metadata-info\` query gives the expected output"
50 rm -f "$temp_stdout_output_file" "$temp_stderr_output_file"
54 test_query_metadata_info succeed1