tests: fix shellcheck warnings in plugins/src.ctf.fs/succeed/test_succeed
[babeltrace.git] / tests / plugins / src.ctf.fs / query / test_query_metadata_info
CommitLineData
b34bfe00
FD
1#!/bin/bash
2#
3# Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com>
4# Copyright (C) 2019 Francis Deslauriers <francis.deslauriers@efficios.com>
5#
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
9# of the License.
10#
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.
15#
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.
19
20SH_TAP=1
21
22if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
23 UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh"
24else
25 UTILSSH="$(dirname "$0")/../../../utils/utils.sh"
26fi
27
28# shellcheck source=../../../utils/utils.sh
29source "$UTILSSH"
30
31this_dir_relative="plugins/src.ctf.fs/query"
32this_dir_build="$BT_TESTS_BUILDDIR/$this_dir_relative"
33succeed_trace_dir="$BT_CTF_TRACES_PATH/succeed"
34expect_dir="$BT_TESTS_DATADIR/$this_dir_relative"
35
36test_query_metadata_info() {
37 local name="$1"
38 local ret=0
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\"")
44
45 bt_cli "$temp_stdout_output_file" "$temp_stderr_output_file" \
46 "${query[@]}"
47
48 bt_diff "$expected_stdout" "$temp_stdout_output_file"
49 ret_stdout=$?
50
51 bt_diff /dev/null "$temp_stderr_output_file"
52 ret_stderr=$?
53
54 if ((ret_stdout != 0 || ret_stderr != 0)); then
55 ret=1
56 fi
57
58 ok $ret "Trace '$name' \`metadata-info\` query gives the expected output"
59 rm -f "$temp_stdout_output_file" "$temp_stderr_output_file"
60}
61
62plan_tests 1
63test_query_metadata_info succeed1
This page took 0.035493 seconds and 4 git commands to generate.