3 # Copyright (C) 2019 EfficiOS Inc.
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; only version 2
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 # This test validates that a `src.ctf.fs` component handles gracefully invalid
20 # CTF traces and produces the expected error message.
24 if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
25 UTILSSH
="$BT_TESTS_SRCDIR/utils/utils.sh"
27 UTILSSH
="$(dirname "$0")/../../../utils/utils.sh"
30 # shellcheck source=../../../utils/utils.sh
33 fail_trace_dir
="$BT_CTF_TRACES_PATH/fail"
35 stdout_file
=$
(mktemp
-t test_ctf_fail_stdout.XXXXXX
)
36 stderr_file
=$
(mktemp
-t test_ctf_fail_stderr.XXXXXX
)
40 local expected_error_msg
="$2"
42 bt_cli
"${stdout_file}" "${stderr_file}" \
43 "${fail_trace_dir}/${name}"
44 isnt $?
0 "Trace ${name}: babeltrace exits with an error"
46 grep --silent "${expected_error_msg}" "${stderr_file}"
47 ok $?
"Trace ${name}: babeltrace produces the expected error message"
53 test_fail
"invalid-packet-size/trace" "Failed to index CTF stream file '.*channel0_3'"
55 rm -f "${stdout_file}" "${stderr_file}"