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"
33 if [ "$BT_TESTS_ENABLE_PYTHON_PLUGINS" != "1" ]; then
34 plan_skip_all
"This test requires the Python plugin provider"
40 bt_cli
"$temp_stdout" "$temp_stderr" \
41 "--plugin-path=${data_dir}" \
42 -c src.foo.TheSource \
43 -c sink.ctf.fs
-p "path=\"${temp_output_dir}\""
44 ok
"$?" "run babeltrace"
47 if [ "$BT_TESTS_OS_TYPE" = "mingw" ]; then
48 # shellcheck disable=SC2028
49 echo "Created CTF trace \`$(cygpath -m "${temp_output_dir}")\\trace\`." > "$temp_expected_stdout"
51 echo "Created CTF trace \`${trace_dir}\`." > "$temp_expected_stdout"
53 bt_diff
"$temp_expected_stdout" "$temp_stdout"
54 ok
"$?" "expected message on stdout"
57 bt_diff
"/dev/null" "$temp_stderr"
58 ok
"$?" "stderr is empty"
60 # Verify only the expected files exist.
61 files
=("$trace_dir"/*)
62 num_files
=${#files[@]}
63 is
"$num_files" "4" "expected number of files in output directory"
65 test -f "$trace_dir/metadata"
66 ok
"$?" "metadata file exists"
68 test -f "$trace_dir/metadata-0"
69 ok
"$?" "metadata-0 file exists"
71 test -f "$trace_dir/the-stream"
72 ok
"$?" "the-stream file exists"
74 test -f "$trace_dir/the-stream-0"
75 ok
"$?" "the-stream-0 file exists"
77 # Read back the output trace to make sure it's properly formed.
78 cat <<- 'END' > "$temp_expected_stdout"
83 bt_diff_cli "$temp_expected_stdout" /dev/null "$trace_dir"
84 ok "$?" "read back output trace"
88 rm -f "$temp_expected_stdout"
89 rm -f "$trace_dir/metadata"
90 rm -f "$trace_dir/metadata-0"
91 rm -f "$trace_dir/the-stream"
92 rm -f "$trace_dir/the-stream-0"
94 rmdir "$temp_output_dir"
This page took 0.039777 seconds and 4 git commands to generate.