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 [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; 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_OS_TYPE" = "mingw" ]; then
43 echo "Created CTF trace \`$(cygpath -m ${temp_output_dir})\\trace\`." > "$temp_expected_stdout"
45 echo "Created CTF trace \`${trace_dir}\`." > "$temp_expected_stdout"
47 bt_diff
"$temp_expected_stdout" "$temp_stdout"
48 ok
"$?" "expected message on stdout"
51 bt_diff
"/dev/null" "$temp_stderr"
52 ok
"$?" "stderr is empty"
54 # Verify only the expected files exist.
55 files
=("$trace_dir"/*)
56 num_files
=${#files[@]}
57 is
"$num_files" "4" "expected number of files in output directory"
59 test -f "$trace_dir/metadata"
60 ok
"$?" "metadata file exists"
62 test -f "$trace_dir/metadata-0"
63 ok
"$?" "metadata-0 file exists"
65 test -f "$trace_dir/the-stream"
66 ok
"$?" "the-stream file exists"
68 test -f "$trace_dir/the-stream-0"
69 ok
"$?" "the-stream-0 file exists"
71 # Read back the output trace to make sure it's properly formed.
72 cat <<- 'END' > "$temp_expected_stdout"
77 bt_diff_cli "$temp_expected_stdout" /dev/null "$trace_dir"
78 ok "$?" "read back output trace"
82 rm -f "$temp_expected_stdout"
83 rm -f "$trace_dir/metadata"
84 rm -f "$trace_dir/metadata-0"
85 rm -f "$trace_dir/the-stream"
86 rm -f "$trace_dir/the-stream-0"
88 rmdir "$temp_output_dir"
This page took 0.032727 seconds and 4 git commands to generate.