3 # Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com>
4 # Copyright (C) 2019 Francis Deslauriers <francis.deslauriers@efficios.com>
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; only version 2
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
23 UTILSSH
="$BT_TESTS_SRCDIR/utils/utils.sh"
25 UTILSSH
="$(dirname "$0")/../../../utils/utils.sh"
28 # shellcheck source=../../../utils/utils.sh
31 this_dir_relative
="plugins/src.ctf.fs/query"
32 this_dir_build
="$BT_TESTS_BUILDDIR/$this_dir_relative"
33 succeed_trace_dir
="$BT_CTF_TRACES_PATH/succeed"
34 expect_dir
="$BT_TESTS_DATADIR/$this_dir_relative"
36 test_query_metadata_info
() {
39 local trace_path
="$succeed_trace_dir/$name"
40 local expected_stdout
="$expect_dir/metadata-info-$name.expect"
41 local temp_stdout_output_file
="$(mktemp -t actual_stdout.XXXXXX)"
42 local temp_stderr_output_file
="$(mktemp -t actual_stderr.XXXXXX)"
43 local query
=("query" "src.ctf.fs" "metadata-info" "--params" "path=\"$trace_path\"")
45 bt_cli
"$temp_stdout_output_file" "$temp_stderr_output_file" \
48 bt_diff
"$expected_stdout" "$temp_stdout_output_file"
51 bt_diff
/dev
/null
"$temp_stderr_output_file"
54 if ((ret_stdout
!= 0 || ret_stderr
!= 0)); then
58 ok
$ret "Trace '$name' \`metadata-info\` query gives the expected output"
59 rm -f "$temp_stdout_output_file" "$temp_stderr_output_file"
63 test_query_metadata_info succeed1