3 # SPDX-License-Identifier: GPL-2.0-only
5 # Copyright (C) 2020 EfficiOS Inc.
8 # This file tests corner cases related to stream names:
10 # - two streams with the same name
11 # - a stream named "metadata"
15 if [ -n "${BT_TESTS_SRCDIR:-}" ]; then
16 UTILSSH
="$BT_TESTS_SRCDIR/utils/utils.sh"
18 UTILSSH
="$(dirname "$0")/../../utils/utils.sh"
21 # shellcheck source=../../utils/utils.sh
24 # Directory containing the Python test source.
25 data_dir
="$BT_TESTS_DATADIR/plugins/sink.ctf.fs/stream-names"
28 temp_expected_stdout
=$
(mktemp
)
30 temp_output_dir
=$
(mktemp
-d)
31 trace_dir
="$temp_output_dir/trace"
35 bt_cli
"$temp_stdout" "$temp_stderr" \
36 "--plugin-path=${data_dir}" \
37 -c src.foo.TheSource \
38 -c sink.ctf.fs
-p "path=\"${temp_output_dir}\""
39 ok
"$?" "run babeltrace"
42 if [ "$BT_TESTS_OS_TYPE" = "mingw" ]; then
43 # shellcheck disable=SC2028
44 echo "Created CTF trace \`$(cygpath -m "${temp_output_dir}")\\trace\`." > "$temp_expected_stdout"
46 echo "Created CTF trace \`${trace_dir}\`." > "$temp_expected_stdout"
48 bt_diff
"$temp_expected_stdout" "$temp_stdout"
49 ok
"$?" "expected message on stdout"
52 bt_diff
"/dev/null" "$temp_stderr"
53 ok
"$?" "stderr is empty"
55 # Verify only the expected files exist.
56 files
=("$trace_dir"/*)
57 num_files
=${#files[@]}
58 is
"$num_files" "4" "expected number of files in output directory"
60 test -f "$trace_dir/metadata"
61 ok
"$?" "metadata file exists"
63 test -f "$trace_dir/metadata-0"
64 ok
"$?" "metadata-0 file exists"
66 test -f "$trace_dir/the-stream"
67 ok
"$?" "the-stream file exists"
69 test -f "$trace_dir/the-stream-0"
70 ok
"$?" "the-stream-0 file exists"
72 # Read back the output trace to make sure it's properly formed.
73 cat <<- 'END' > "$temp_expected_stdout"
78 bt_diff_cli "$temp_expected_stdout" /dev/null "$trace_dir"
79 ok "$?" "read back output trace"
83 rm -f "$temp_expected_stdout"
84 rm -f "$trace_dir/metadata"
85 rm -f "$trace_dir/metadata-0"
86 rm -f "$trace_dir/the-stream"
87 rm -f "$trace_dir/the-stream-0"
89 rmdir "$temp_output_dir"
This page took 0.032212 seconds and 4 git commands to generate.