Move to kernel style SPDX license identifiers
[babeltrace.git] / tests / plugins / src.ctf.fs / query / test_query_metadata_info
1 #!/bin/bash
2 #
3 # SPDX-License-Identifier: GPL-2.0-only
4 #
5 # Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com>
6 # Copyright (C) 2019 Francis Deslauriers <francis.deslauriers@efficios.com>
7 #
8
9 SH_TAP=1
10
11 if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
12 UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh"
13 else
14 UTILSSH="$(dirname "$0")/../../../utils/utils.sh"
15 fi
16
17 # shellcheck source=../../../utils/utils.sh
18 source "$UTILSSH"
19
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"
23
24 test_query_metadata_info() {
25 local name="$1"
26 local ret=0
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\"")
32
33 temp_stdout_output_file="$(mktemp -t actual_stdout.XXXXXX)"
34 temp_stderr_output_file="$(mktemp -t actual_stderr.XXXXXX)"
35
36 bt_cli "$temp_stdout_output_file" "$temp_stderr_output_file" \
37 "${query[@]}"
38
39 bt_diff "$expected_stdout" "$temp_stdout_output_file"
40 ret_stdout=$?
41
42 bt_diff /dev/null "$temp_stderr_output_file"
43 ret_stderr=$?
44
45 if ((ret_stdout != 0 || ret_stderr != 0)); then
46 ret=1
47 fi
48
49 ok $ret "Trace '$name' \`metadata-info\` query gives the expected output"
50 rm -f "$temp_stdout_output_file" "$temp_stderr_output_file"
51 }
52
53 plan_tests 1
54 test_query_metadata_info succeed1
This page took 0.030921 seconds and 4 git commands to generate.