3 # SPDX-License-Identifier: GPL-2.0-only
5 # Copyright (C) 2020 EfficiOS Inc.
8 # This file tests the assume-single-trace parameter of sink.ctf.fs.
12 if [ -n "${BT_TESTS_SRCDIR:-}" ]; then
13 UTILSSH
="$BT_TESTS_SRCDIR/utils/utils.sh"
15 UTILSSH
="$(dirname "$0")/../../utils/utils.sh"
18 # shellcheck source=../../utils/utils.sh
21 # Directory containing the Python test source.
22 data_dir
="$BT_TESTS_DATADIR/plugins/sink.ctf.fs/assume-single-trace"
25 temp_expected_stdout
=$
(mktemp
)
27 temp_output_dir
=$
(mktemp
-d)
29 trace_dir
="$temp_output_dir/the-trace"
31 if [ "$BT_TESTS_ENABLE_PYTHON_PLUGINS" != "1" ]; then
32 plan_skip_all
"This test requires the Python plugin provider"
38 bt_cli
"$temp_stdout" "$temp_stderr" \
39 "--plugin-path=${data_dir}" \
40 -c src.foo.TheSource \
41 -c sink.ctf.fs
-p "path=\"${trace_dir}\"" -p 'assume-single-trace=true'
42 ok
"$?" "run sink.ctf.fs with assume-single-trace=true"
45 if [ "$BT_TESTS_OS_TYPE" = "mingw" ]; then
46 echo "Created CTF trace \`$(cygpath -m "${trace_dir}")\`." > "$temp_expected_stdout"
48 echo "Created CTF trace \`${trace_dir}\`." > "$temp_expected_stdout"
50 bt_diff
"$temp_expected_stdout" "$temp_stdout"
51 ok
"$?" "expected message on stdout"
54 bt_diff
"/dev/null" "$temp_stderr"
55 ok
"$?" "stderr is empty"
57 # Verify only the expected files exist.
58 files
=("$trace_dir"/*)
59 num_files
=${#files[@]}
60 is
"$num_files" "2" "expected number of files in output directory"
62 test -f "$trace_dir/metadata"
63 ok
"$?" "metadata file exists"
65 test -f "$trace_dir/the-stream"
66 ok
"$?" "the-stream file exists"
68 # Read back the output trace to make sure it's properly formed.
69 echo "the-event: " > "$temp_expected_stdout"
70 bt_diff_cli
"$temp_expected_stdout" /dev
/null
"$trace_dir"
71 ok
"$?" "read back output trace"
75 rm -f "$temp_expected_stdout"
76 rm -f "$trace_dir/metadata"
77 rm -f "$trace_dir/the-stream"
79 rmdir "$temp_output_dir"
This page took 0.033422 seconds and 4 git commands to generate.