bindings/python/bt2/test_trace.py \
bindings/python/bt2/test_value.py \
bindings/python/bt2/utils.py \
- cli/auto-source-discovery/test_auto_source_discovery \
- cli/test_convert_args \
+ cli/convert/test_auto_source_discovery_grouping \
+ cli/convert/test_convert_args \
cli/test_intersection \
cli/test_output_ctf_metadata \
cli/test_packet_seq_num \
argpar/test_argpar
TESTS_CLI = \
+ cli/convert/test_convert_args \
cli/test_trace_read \
cli/test_packet_seq_num \
- cli/test_convert_args \
cli/test_intersection \
cli/test_trace_copy \
cli/test_trimmer
if ENABLE_PYTHON_PLUGINS
if ENABLE_PYTHON_BINDINGS
-TESTS_CLI += cli/auto-source-discovery/test_auto_source_discovery
+TESTS_CLI += cli/convert/test_auto_source_discovery_grouping
TESTS_PLUGINS += plugins/flt.utils.trimmer/test_trimming
endif
endif
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com>
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License, version 2 only, as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-# Test the auto source disovery mechanism of the CLI.
-
-if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
- UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh"
-else
- UTILSSH="$(dirname "$0")/../../utils/utils.sh"
-fi
-
-# shellcheck source=../../utils/utils.sh
-SH_TAP=1 source "$UTILSSH"
-
-NUM_TESTS=1
-
-plan_tests $NUM_TESTS
-
-data_dir="${BT_TESTS_DATADIR}/cli/auto-source-discovery"
-plugin_dir="${data_dir}"
-trace_dir="${data_dir}/traces"
-
-if [ "$BT_OS_TYPE" = "mingw" ]; then
- # Use Windows native paths for comparison because Unix
- # paths are converted by the shell before they are passed
- # to the native babeltrace2 binary.
- trace_dir=$(cygpath -w "$trace_dir")
- dir_sep='\'
-else
- dir_sep='/'
-fi
-
-expected_file=$(mktemp -t expected.XXXXXX)
-stderr_expected=/dev/null
-
-cat > "$expected_file" <<END
-TestSourceABCDE: ABCDE
-TestSourceExt: ${trace_dir}${dir_sep}aaa1, ${trace_dir}${dir_sep}aaa2, ${trace_dir}${dir_sep}aaa3
-TestSourceExt: ${trace_dir}${dir_sep}bbb1, ${trace_dir}${dir_sep}bbb2
-TestSourceExt: ${trace_dir}${dir_sep}ccc1
-TestSourceExt: ${trace_dir}${dir_sep}ccc2
-TestSourceExt: ${trace_dir}${dir_sep}ccc3
-TestSourceExt: ${trace_dir}${dir_sep}ccc4
-TestSourceSomeDir: ${trace_dir}${dir_sep}some-dir
-END
-
-bt_diff_cli_sorted "$expected_file" "$stderr_expected" convert --plugin-path "${plugin_dir}" "ABCDE" "${trace_dir}" some_other_leftover
-ok "$?" "sources are auto-discovered"
-
-rm -f "$expected_file"
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2019 Simon Marchi <simon.marchi@efficios.com>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License, version 2 only, as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# Test the auto source disovery mechanism of the CLI.
+
+if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
+ UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh"
+else
+ UTILSSH="$(dirname "$0")/../../utils/utils.sh"
+fi
+
+# shellcheck source=../../utils/utils.sh
+SH_TAP=1 source "$UTILSSH"
+
+NUM_TESTS=1
+
+plan_tests $NUM_TESTS
+
+data_dir="${BT_TESTS_DATADIR}/cli/convert/auto-source-discovery-grouping"
+plugin_dir="${data_dir}"
+trace_dir="${data_dir}/traces"
+
+if [ "$BT_OS_TYPE" = "mingw" ]; then
+ # Use Windows native paths for comparison because Unix
+ # paths are converted by the shell before they are passed
+ # to the native babeltrace2 binary.
+ trace_dir=$(cygpath -w "$trace_dir")
+ dir_sep='\'
+else
+ dir_sep='/'
+fi
+
+expected_file=$(mktemp -t expected.XXXXXX)
+stderr_expected=/dev/null
+
+cat > "$expected_file" <<END
+TestSourceABCDE: ABCDE
+TestSourceExt: ${trace_dir}${dir_sep}aaa1, ${trace_dir}${dir_sep}aaa2, ${trace_dir}${dir_sep}aaa3
+TestSourceExt: ${trace_dir}${dir_sep}bbb1, ${trace_dir}${dir_sep}bbb2
+TestSourceExt: ${trace_dir}${dir_sep}ccc1
+TestSourceExt: ${trace_dir}${dir_sep}ccc2
+TestSourceExt: ${trace_dir}${dir_sep}ccc3
+TestSourceExt: ${trace_dir}${dir_sep}ccc4
+TestSourceSomeDir: ${trace_dir}${dir_sep}some-dir
+END
+
+bt_diff_cli_sorted "$expected_file" "$stderr_expected" convert --plugin-path "${plugin_dir}" "ABCDE" "${trace_dir}" some_other_leftover
+ok "$?" "sources are auto-discovered"
+
+rm -f "$expected_file"
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2017 Philippe Proulx <pproulx@efficios.com>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License, version 2 only, as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+SH_TAP=1
+
+if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
+ UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh"
+else
+ UTILSSH="$(dirname "$0")/../utils/utils.sh"
+fi
+
+# shellcheck source=../utils/utils.sh
+source "$UTILSSH"
+
+test_head_comment=0
+tmp_stderr=$(mktemp)
+
+test_bt_convert_run_args() {
+ local what="$1"
+ local convert_args="$2"
+ local expected_run_args="$3"
+
+ # execute convert command
+ local run_args="$("$BT_TESTS_BT2_BIN" convert --run-args $convert_args)"
+
+ # check result
+ if [ "$test_head_comment" = 1 ]; then
+ comment "convert args: $convert_args"
+ fi
+
+ if [ "$run_args" = "$expected_run_args" ]; then
+ pass "ARGS: $what"
+ else
+ fail "ARGS: $what"
+ diag "ARGS: $convert_args"
+ diag "EXPECTED: $expected_run_args"
+ diag "GOT: $run_args"
+ fi
+}
+
+test_bt_convert_fails() {
+ local what="$1"
+ local convert_args="$2"
+ local expected_error_str="${3:-}"
+
+ # execute convert command
+ "$BT_TESTS_BT2_BIN" convert --run-args $convert_args >/dev/null 2>"${tmp_stderr}"
+
+ local status=$?
+
+ # check result
+ if [ "$test_head_comment" = 1 ]; then
+ comment "convert args: $convert_args"
+ fi
+
+ if [ "$status" = 0 ]; then
+ fail "SUCCEEDS (should fail): $what"
+ diag "ARGS: $convert_args"
+ else
+ pass "FAILS: $what"
+ fi
+
+ if [ -n "${expected_error_str}" ]; then
+ grep --quiet "$expected_error_str" "$tmp_stderr"
+ status=$?
+ ok "$status" "FAILS: $what, error message"
+ if [ "$status" -ne 0 ]; then
+ diag "Expected error string '${expected_error_str}' not found in stderr:"
+ diag "$(cat ${tmp_stderr})"
+ fi
+ fi
+}
+
+comment() {
+ echo "### $1 ###"
+}
+
+path_to_trace="${BT_CTF_TRACES_PATH}/succeed/succeed1"
+path_to_trace2="${BT_CTF_TRACES_PATH}/succeed/succeed2"
+output_path="/output/path"
+
+if [ "$BT_OS_TYPE" = "mingw" ]; then
+ # Use Windows native paths for comparison because Unix
+ # paths are converted by the shell before they are passed
+ # to the native babeltrace2 binary.
+ path_to_trace=$(cygpath -m "$path_to_trace")
+ path_to_trace2=$(cygpath -m "$path_to_trace2")
+ output_path=$(cygpath -m "$output_path")
+fi
+
+plan_tests 75
+
+test_bt_convert_run_args 'path leftover' "$path_to_trace" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftovers' "$path_to_trace $path_to_trace2" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\", \"${path_to_trace2}\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + named user source with --params' "$path_to_trace --component ZZ:source.another.source --params salut=yes" "--component ZZ:source.another.source --params salut=yes --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect ZZ:muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --omit-home-plugin-path' "$path_to_trace --omit-home-plugin-path" "--omit-home-plugin-path --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --omit-system-plugin-path' "$path_to_trace --omit-system-plugin-path" "--omit-system-plugin-path --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --plugin-path' "--plugin-path=PATH1:PATH2 $path_to_trace" "--plugin-path PATH1:PATH2 --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'unnamed user source' '--component source.salut.com' "--component source.salut.com:source.salut.com --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect 'source\.salut\.com:muxer' --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + user source named `auto-disc-source-ctf-fs`' "--component auto-disc-source-ctf-fs:source.salut.com $path_to_trace" "--component auto-disc-source-ctf-fs:source.salut.com --component auto-disc-source-ctf-fs-0:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect auto-disc-source-ctf-fs-0:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + user sink named `pretty`' "--component pretty:sink.my.sink $path_to_trace" "--component pretty:sink.my.sink --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --clock-seconds + user sink named `pretty`' "--clock-seconds --component pretty:sink.my.sink $path_to_trace" "--component pretty:sink.my.sink --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty-0:sink.text.pretty --params clock-seconds=yes --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty --connect muxer:pretty-0"
+test_bt_convert_run_args 'path leftover + user filter named `muxer`' "--component muxer:filter.salut.com $path_to_trace" "--component muxer:filter.salut.com --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer-0:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer-0 --connect muxer-0:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --begin + user filter named `trimmer`' "$path_to_trace --component trimmer:filter.salut.com --begin=abc" "--component trimmer:filter.salut.com --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --component trimmer-0:filter.utils.trimmer --params 'begin=\"abc\"' --connect auto-disc-source-ctf-fs:muxer --connect muxer:trimmer-0 --connect trimmer-0:trimmer --connect trimmer:pretty"
+test_bt_convert_run_args 'path leftover + --plugin-path' "$path_to_trace --plugin-path a:b:c" "--plugin-path a:b:c --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --omit-home-plugin-path --omit-system-plugin-path' "$path_to_trace --omit-home-plugin-path --omit-system-plugin-path" "--omit-home-plugin-path --omit-system-plugin-path --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --begin' "$path_to_trace --begin=123" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --component trimmer:filter.utils.trimmer --params 'begin=\"123\"' --connect auto-disc-source-ctf-fs:muxer --connect muxer:trimmer --connect trimmer:pretty"
+test_bt_convert_run_args 'path leftover + --begin --end' "$path_to_trace --end=456 --begin 123" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --component trimmer:filter.utils.trimmer --params 'end=\"456\"' --params 'begin=\"123\"' --connect auto-disc-source-ctf-fs:muxer --connect muxer:trimmer --connect trimmer:pretty"
+test_bt_convert_run_args 'path leftover + --timerange' "$path_to_trace --timerange=[abc,xyz]" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --component trimmer:filter.utils.trimmer --params 'begin=\"abc\"' --params 'end=\"xyz\"' --connect auto-disc-source-ctf-fs:muxer --connect muxer:trimmer --connect trimmer:pretty"
+test_bt_convert_run_args 'path leftover + --clock-cycles' "$path_to_trace --clock-cycles" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params clock-cycles=yes --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --clock-date' "$path_to_trace --clock-date" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params clock-date=yes --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --clock-force-correlate' "$path_to_trace --clock-force-correlate" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --params assume-absolute-clock-classes=yes --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --clock-gmt' "$path_to_trace --clock-gmt" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params clock-gmt=yes --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --clock-offset' "$path_to_trace --clock-offset=15487" "--component auto-disc-source-ctf-fs:source.ctf.fs --params clock-class-offset-s=15487 --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --clock-offset-ns' "$path_to_trace --clock-offset-ns=326159487" "--component auto-disc-source-ctf-fs:source.ctf.fs --params clock-class-offset-ns=326159487 --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --clock-seconds' "$path_to_trace --clock-seconds" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params clock-seconds=yes --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --color' "$path_to_trace --color=never" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params 'color=\"never\"' --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --debug-info' "$path_to_trace --debug-info" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --component debug-info:filter.lttng-utils.debug-info --connect auto-disc-source-ctf-fs:muxer --connect muxer:debug-info --connect debug-info:pretty"
+test_bt_convert_run_args 'path leftover + --debug-info-dir' "$path_to_trace --debug-info-dir=${output_path}" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --component debug-info:filter.lttng-utils.debug-info --params 'debug-info-dir=\"${output_path}\"' --connect auto-disc-source-ctf-fs:muxer --connect muxer:debug-info --connect debug-info:pretty"
+test_bt_convert_run_args 'path leftover + --debug-info-target-prefix' "$path_to_trace --debug-info-target-prefix=${output_path}" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --component debug-info:filter.lttng-utils.debug-info --params 'target-prefix=\"${output_path}\"' --connect auto-disc-source-ctf-fs:muxer --connect muxer:debug-info --connect debug-info:pretty"
+test_bt_convert_run_args 'path leftover + --debug-info-full-path' "$path_to_trace --debug-info-full-path" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --component debug-info:filter.lttng-utils.debug-info --params full-path=yes --connect auto-disc-source-ctf-fs:muxer --connect muxer:debug-info --connect debug-info:pretty"
+test_bt_convert_run_args 'path leftover + --fields=trace:domain,loglevel' "--fields=trace:domain,loglevel $path_to_trace" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params field-trace:domain=yes,field-loglevel=yes,field-default=hide --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --fields=all' "--fields=all $path_to_trace" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params field-default=show --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --names=context,header' "--names=context,header $path_to_trace" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params name-context=yes,name-header=yes,name-default=hide --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --names=all' "--names=all $path_to_trace" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params name-default=show --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --no-delta' "$path_to_trace --no-delta" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params no-delta=yes --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --output' "$path_to_trace --output $output_path" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params 'path=\"$output_path\"' --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + -i ctf' "$path_to_trace -i ctf" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'URL leftover + -i lttng-live' 'net://some-host/host/target/session -i lttng-live' "--component lttng-live:source.ctf.lttng-live --params 'url=\"net://some-host/host/target/session\"' --params 'session-not-found-action=\"end\"' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect lttng-live:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + user sink + -o text' "$path_to_trace --component=sink.abc.def -o text" "--component sink.abc.def:sink.abc.def --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect 'muxer:sink\.abc\.def' --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + -o dummy' "$path_to_trace -o dummy" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component dummy:sink.utils.dummy --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:dummy"
+test_bt_convert_run_args 'path leftover + -o dummy + --clock-seconds' "$path_to_trace -o dummy --clock-seconds" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params clock-seconds=yes --component dummy:sink.utils.dummy --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty --connect muxer:dummy"
+test_bt_convert_run_args 'path leftover + -o ctf + --output' "$path_to_trace -o ctf --output $output_path" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component sink-ctf-fs:sink.ctf.fs --params 'path=\"$output_path\"' --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:sink-ctf-fs"
+test_bt_convert_run_args 'path leftover + user sink with log level' "$path_to_trace -c sink.mein.sink -lW" "--component sink.mein.sink:sink.mein.sink --log-level W --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect 'muxer:sink\.mein\.sink'"
+
+test_bt_convert_fails 'bad --component format (plugin only)' '--component salut'
+test_bt_convert_fails 'bad --component format (name and plugin only)' '--component name:salut'
+test_bt_convert_fails 'bad --component format (name only)' '--component name:'
+test_bt_convert_fails 'bad --component format (extra dot found)' '--component name:source.plugin.comp.cls'
+test_bt_convert_fails 'duplicate component name' '--component hello:sink.a.b --component hello:source.c.d'
+test_bt_convert_fails 'unknown option' '--component hello:sink.a.b --salut'
+test_bt_convert_fails '--params without current component' '--params lol=23'
+test_bt_convert_fails 'duplicate --begin' '--begin abc --clock-seconds --begin cde'
+test_bt_convert_fails 'duplicate --end' '--begin abc --end xyz --clock-seconds --end cde'
+test_bt_convert_fails '--begin and --timerange' '--begin abc --clock-seconds --timerange abc,def'
+test_bt_convert_fails '--end and --timerange' '--end abc --clock-seconds --timerange abc,def'
+test_bt_convert_fails 'bad --timerange format (1)' '--timerange abc'
+test_bt_convert_fails 'bad --timerange format (2)' '--timerange abc,'
+test_bt_convert_fails 'bad --timerange format (3)' '--timerange ,cde'
+test_bt_convert_fails 'bad --fields format' '--fields salut'
+test_bt_convert_fails 'bad --names format' '--names salut'
+test_bt_convert_fails 'unknown -i' '-i lol'
+test_bt_convert_fails 'duplicate -i' '-i lttng-live --clock-seconds --input-format=ctf'
+test_bt_convert_fails 'unknown -o' '-o lol'
+test_bt_convert_fails 'duplicate -o' '-o dummy --clock-seconds --output-format=text'
+test_bt_convert_fails '--run-args and --run-args-0' "$path_to_trace --run-args --run-args-0"
+test_bt_convert_fails '-o ctf-metadata without path' '-o ctf-metadata'
+test_bt_convert_fails '-i lttng-live and implicit source.ctf.fs' '-i lttng-live net://some-host/host/target/session --clock-offset=23'
+test_bt_convert_fails 'implicit source.ctf.fs without path' '--clock-offset=23'
+test_bt_convert_fails 'implicit source.ctf.lttng-live without URL' '-i lttng-live'
+test_bt_convert_fails 'no source' '-o text'
+test_bt_convert_fails '-o ctf without --output' 'my-trace -o ctf'
+test_bt_convert_fails '-o ctf + --output with implicit sink.text.pretty' "my-trace -o ctf --output $output_path --no-delta"
+test_bt_convert_fails '--stream-intersection' "$path_to_trace --stream-intersection"
+test_bt_convert_fails '--params after leftover' "--component src.ctf.fs $path_to_trace --params=a=2" 'No current component (--component option) of which to set parameters'
+test_bt_convert_fails '--log-level after leftover' "--component src.ctf.fs $path_to_trace --log-level=W" 'No current component (--component option) to assign a log level to'
+
+rm -f "${tmp_stderr}"
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2017 Philippe Proulx <pproulx@efficios.com>
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License, version 2 only, as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-SH_TAP=1
-
-if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
- UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh"
-else
- UTILSSH="$(dirname "$0")/../utils/utils.sh"
-fi
-
-# shellcheck source=../utils/utils.sh
-source "$UTILSSH"
-
-test_head_comment=0
-tmp_stderr=$(mktemp)
-
-test_bt_convert_run_args() {
- local what="$1"
- local convert_args="$2"
- local expected_run_args="$3"
-
- # execute convert command
- local run_args="$("$BT_TESTS_BT2_BIN" convert --run-args $convert_args)"
-
- # check result
- if [ "$test_head_comment" = 1 ]; then
- comment "convert args: $convert_args"
- fi
-
- if [ "$run_args" = "$expected_run_args" ]; then
- pass "ARGS: $what"
- else
- fail "ARGS: $what"
- diag "ARGS: $convert_args"
- diag "EXPECTED: $expected_run_args"
- diag "GOT: $run_args"
- fi
-}
-
-test_bt_convert_fails() {
- local what="$1"
- local convert_args="$2"
- local expected_error_str="${3:-}"
-
- # execute convert command
- "$BT_TESTS_BT2_BIN" convert --run-args $convert_args >/dev/null 2>"${tmp_stderr}"
-
- local status=$?
-
- # check result
- if [ "$test_head_comment" = 1 ]; then
- comment "convert args: $convert_args"
- fi
-
- if [ "$status" = 0 ]; then
- fail "SUCCEEDS (should fail): $what"
- diag "ARGS: $convert_args"
- else
- pass "FAILS: $what"
- fi
-
- if [ -n "${expected_error_str}" ]; then
- grep --quiet "$expected_error_str" "$tmp_stderr"
- status=$?
- ok "$status" "FAILS: $what, error message"
- if [ "$status" -ne 0 ]; then
- diag "Expected error string '${expected_error_str}' not found in stderr:"
- diag "$(cat ${tmp_stderr})"
- fi
- fi
-}
-
-comment() {
- echo "### $1 ###"
-}
-
-path_to_trace="${BT_CTF_TRACES_PATH}/succeed/succeed1"
-path_to_trace2="${BT_CTF_TRACES_PATH}/succeed/succeed2"
-output_path="/output/path"
-
-if [ "$BT_OS_TYPE" = "mingw" ]; then
- # Use Windows native paths for comparison because Unix
- # paths are converted by the shell before they are passed
- # to the native babeltrace2 binary.
- path_to_trace=$(cygpath -m "$path_to_trace")
- path_to_trace2=$(cygpath -m "$path_to_trace2")
- output_path=$(cygpath -m "$output_path")
-fi
-
-plan_tests 75
-
-test_bt_convert_run_args 'path leftover' "$path_to_trace" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftovers' "$path_to_trace $path_to_trace2" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\", \"${path_to_trace2}\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + named user source with --params' "$path_to_trace --component ZZ:source.another.source --params salut=yes" "--component ZZ:source.another.source --params salut=yes --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect ZZ:muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --omit-home-plugin-path' "$path_to_trace --omit-home-plugin-path" "--omit-home-plugin-path --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --omit-system-plugin-path' "$path_to_trace --omit-system-plugin-path" "--omit-system-plugin-path --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --plugin-path' "--plugin-path=PATH1:PATH2 $path_to_trace" "--plugin-path PATH1:PATH2 --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'unnamed user source' '--component source.salut.com' "--component source.salut.com:source.salut.com --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect 'source\.salut\.com:muxer' --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + user source named `auto-disc-source-ctf-fs`' "--component auto-disc-source-ctf-fs:source.salut.com $path_to_trace" "--component auto-disc-source-ctf-fs:source.salut.com --component auto-disc-source-ctf-fs-0:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect auto-disc-source-ctf-fs-0:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + user sink named `pretty`' "--component pretty:sink.my.sink $path_to_trace" "--component pretty:sink.my.sink --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --clock-seconds + user sink named `pretty`' "--clock-seconds --component pretty:sink.my.sink $path_to_trace" "--component pretty:sink.my.sink --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty-0:sink.text.pretty --params clock-seconds=yes --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty --connect muxer:pretty-0"
-test_bt_convert_run_args 'path leftover + user filter named `muxer`' "--component muxer:filter.salut.com $path_to_trace" "--component muxer:filter.salut.com --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer-0:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer-0 --connect muxer-0:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --begin + user filter named `trimmer`' "$path_to_trace --component trimmer:filter.salut.com --begin=abc" "--component trimmer:filter.salut.com --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --component trimmer-0:filter.utils.trimmer --params 'begin=\"abc\"' --connect auto-disc-source-ctf-fs:muxer --connect muxer:trimmer-0 --connect trimmer-0:trimmer --connect trimmer:pretty"
-test_bt_convert_run_args 'path leftover + --plugin-path' "$path_to_trace --plugin-path a:b:c" "--plugin-path a:b:c --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --omit-home-plugin-path --omit-system-plugin-path' "$path_to_trace --omit-home-plugin-path --omit-system-plugin-path" "--omit-home-plugin-path --omit-system-plugin-path --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --begin' "$path_to_trace --begin=123" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --component trimmer:filter.utils.trimmer --params 'begin=\"123\"' --connect auto-disc-source-ctf-fs:muxer --connect muxer:trimmer --connect trimmer:pretty"
-test_bt_convert_run_args 'path leftover + --begin --end' "$path_to_trace --end=456 --begin 123" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --component trimmer:filter.utils.trimmer --params 'end=\"456\"' --params 'begin=\"123\"' --connect auto-disc-source-ctf-fs:muxer --connect muxer:trimmer --connect trimmer:pretty"
-test_bt_convert_run_args 'path leftover + --timerange' "$path_to_trace --timerange=[abc,xyz]" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --component trimmer:filter.utils.trimmer --params 'begin=\"abc\"' --params 'end=\"xyz\"' --connect auto-disc-source-ctf-fs:muxer --connect muxer:trimmer --connect trimmer:pretty"
-test_bt_convert_run_args 'path leftover + --clock-cycles' "$path_to_trace --clock-cycles" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params clock-cycles=yes --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --clock-date' "$path_to_trace --clock-date" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params clock-date=yes --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --clock-force-correlate' "$path_to_trace --clock-force-correlate" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --params assume-absolute-clock-classes=yes --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --clock-gmt' "$path_to_trace --clock-gmt" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params clock-gmt=yes --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --clock-offset' "$path_to_trace --clock-offset=15487" "--component auto-disc-source-ctf-fs:source.ctf.fs --params clock-class-offset-s=15487 --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --clock-offset-ns' "$path_to_trace --clock-offset-ns=326159487" "--component auto-disc-source-ctf-fs:source.ctf.fs --params clock-class-offset-ns=326159487 --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --clock-seconds' "$path_to_trace --clock-seconds" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params clock-seconds=yes --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --color' "$path_to_trace --color=never" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params 'color=\"never\"' --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --debug-info' "$path_to_trace --debug-info" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --component debug-info:filter.lttng-utils.debug-info --connect auto-disc-source-ctf-fs:muxer --connect muxer:debug-info --connect debug-info:pretty"
-test_bt_convert_run_args 'path leftover + --debug-info-dir' "$path_to_trace --debug-info-dir=${output_path}" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --component debug-info:filter.lttng-utils.debug-info --params 'debug-info-dir=\"${output_path}\"' --connect auto-disc-source-ctf-fs:muxer --connect muxer:debug-info --connect debug-info:pretty"
-test_bt_convert_run_args 'path leftover + --debug-info-target-prefix' "$path_to_trace --debug-info-target-prefix=${output_path}" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --component debug-info:filter.lttng-utils.debug-info --params 'target-prefix=\"${output_path}\"' --connect auto-disc-source-ctf-fs:muxer --connect muxer:debug-info --connect debug-info:pretty"
-test_bt_convert_run_args 'path leftover + --debug-info-full-path' "$path_to_trace --debug-info-full-path" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --component debug-info:filter.lttng-utils.debug-info --params full-path=yes --connect auto-disc-source-ctf-fs:muxer --connect muxer:debug-info --connect debug-info:pretty"
-test_bt_convert_run_args 'path leftover + --fields=trace:domain,loglevel' "--fields=trace:domain,loglevel $path_to_trace" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params field-trace:domain=yes,field-loglevel=yes,field-default=hide --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --fields=all' "--fields=all $path_to_trace" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params field-default=show --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --names=context,header' "--names=context,header $path_to_trace" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params name-context=yes,name-header=yes,name-default=hide --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --names=all' "--names=all $path_to_trace" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params name-default=show --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --no-delta' "$path_to_trace --no-delta" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params no-delta=yes --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --output' "$path_to_trace --output $output_path" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params 'path=\"$output_path\"' --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + -i ctf' "$path_to_trace -i ctf" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'URL leftover + -i lttng-live' 'net://some-host/host/target/session -i lttng-live' "--component lttng-live:source.ctf.lttng-live --params 'url=\"net://some-host/host/target/session\"' --params 'session-not-found-action=\"end\"' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect lttng-live:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + user sink + -o text' "$path_to_trace --component=sink.abc.def -o text" "--component sink.abc.def:sink.abc.def --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect 'muxer:sink\.abc\.def' --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + -o dummy' "$path_to_trace -o dummy" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component dummy:sink.utils.dummy --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:dummy"
-test_bt_convert_run_args 'path leftover + -o dummy + --clock-seconds' "$path_to_trace -o dummy --clock-seconds" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component pretty:sink.text.pretty --params clock-seconds=yes --component dummy:sink.utils.dummy --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:pretty --connect muxer:dummy"
-test_bt_convert_run_args 'path leftover + -o ctf + --output' "$path_to_trace -o ctf --output $output_path" "--component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component sink-ctf-fs:sink.ctf.fs --params 'path=\"$output_path\"' --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect muxer:sink-ctf-fs"
-test_bt_convert_run_args 'path leftover + user sink with log level' "$path_to_trace -c sink.mein.sink -lW" "--component sink.mein.sink:sink.mein.sink --log-level W --component auto-disc-source-ctf-fs:source.ctf.fs --params 'inputs=[\"$path_to_trace\"]' --component muxer:filter.utils.muxer --connect auto-disc-source-ctf-fs:muxer --connect 'muxer:sink\.mein\.sink'"
-
-test_bt_convert_fails 'bad --component format (plugin only)' '--component salut'
-test_bt_convert_fails 'bad --component format (name and plugin only)' '--component name:salut'
-test_bt_convert_fails 'bad --component format (name only)' '--component name:'
-test_bt_convert_fails 'bad --component format (extra dot found)' '--component name:source.plugin.comp.cls'
-test_bt_convert_fails 'duplicate component name' '--component hello:sink.a.b --component hello:source.c.d'
-test_bt_convert_fails 'unknown option' '--component hello:sink.a.b --salut'
-test_bt_convert_fails '--params without current component' '--params lol=23'
-test_bt_convert_fails 'duplicate --begin' '--begin abc --clock-seconds --begin cde'
-test_bt_convert_fails 'duplicate --end' '--begin abc --end xyz --clock-seconds --end cde'
-test_bt_convert_fails '--begin and --timerange' '--begin abc --clock-seconds --timerange abc,def'
-test_bt_convert_fails '--end and --timerange' '--end abc --clock-seconds --timerange abc,def'
-test_bt_convert_fails 'bad --timerange format (1)' '--timerange abc'
-test_bt_convert_fails 'bad --timerange format (2)' '--timerange abc,'
-test_bt_convert_fails 'bad --timerange format (3)' '--timerange ,cde'
-test_bt_convert_fails 'bad --fields format' '--fields salut'
-test_bt_convert_fails 'bad --names format' '--names salut'
-test_bt_convert_fails 'unknown -i' '-i lol'
-test_bt_convert_fails 'duplicate -i' '-i lttng-live --clock-seconds --input-format=ctf'
-test_bt_convert_fails 'unknown -o' '-o lol'
-test_bt_convert_fails 'duplicate -o' '-o dummy --clock-seconds --output-format=text'
-test_bt_convert_fails '--run-args and --run-args-0' "$path_to_trace --run-args --run-args-0"
-test_bt_convert_fails '-o ctf-metadata without path' '-o ctf-metadata'
-test_bt_convert_fails '-i lttng-live and implicit source.ctf.fs' '-i lttng-live net://some-host/host/target/session --clock-offset=23'
-test_bt_convert_fails 'implicit source.ctf.fs without path' '--clock-offset=23'
-test_bt_convert_fails 'implicit source.ctf.lttng-live without URL' '-i lttng-live'
-test_bt_convert_fails 'no source' '-o text'
-test_bt_convert_fails '-o ctf without --output' 'my-trace -o ctf'
-test_bt_convert_fails '-o ctf + --output with implicit sink.text.pretty' "my-trace -o ctf --output $output_path --no-delta"
-test_bt_convert_fails '--stream-intersection' "$path_to_trace --stream-intersection"
-test_bt_convert_fails '--params after leftover' "--component src.ctf.fs $path_to_trace --params=a=2" 'No current component (--component option) of which to set parameters'
-test_bt_convert_fails '--log-level after leftover' "--component src.ctf.fs $path_to_trace --log-level=W" 'No current component (--component option) to assign a log level to'
-
-rm -f "${tmp_stderr}"
+++ /dev/null
-import bt2
-import os
-
-
-class TestIter(bt2._UserMessageIterator):
- pass
-
-
-class Base:
- @classmethod
- def _print_params(cls, params):
- inputs = sorted([str(x) for x in params['inputs']])
- print('{}: {}'.format(cls.__name__, ', '.join(inputs)))
-
-
-@bt2.plugin_component_class
-class TestSourceExt(Base, bt2._UserSourceComponent, message_iterator_class=TestIter):
- """
- Recognize files whose name start with 'aaa', 'bbb' or 'ccc'.
-
- 'aaa' files are grouped together, 'bbb' files are grouped together, 'ccc'
- files are not grouped.
- """
-
- def __init__(self, params):
- self._print_params(params)
-
- @staticmethod
- def _user_query(priv_query_exec, obj, params):
- if obj == 'babeltrace.support-info':
- if params['type'] == 'file':
- name = os.path.basename(str(params['input']))
-
- if name.startswith('aaa'):
- return {'weight': 1, 'group': 'aaa'}
- elif name.startswith('bbb'):
- return {'weight': 0.5, 'group': 'bbb'}
- elif name.startswith('ccc'):
- # Try two different ways of returning "no group", and two
- # different ways of returning 1 (an int and a float).
- if name[3] == '1':
- return {'weight': 1, 'group': None}
- elif name[3] == '2':
- return {'weight': 1.0, 'group': None}
- elif name[3] == '3':
- return 1
- else:
- return 1.0
- else:
- return 0
- else:
- raise bt2.UnknownObject
-
-
-@bt2.plugin_component_class
-class TestSourceSomeDir(
- Base, bt2._UserSourceComponent, message_iterator_class=TestIter
-):
- """Recognizes directories named "some-dir". The file "aaa10" in the
- directory "some-dir" won't be found by TestSourceExt, because we won't
- recurse in "some-dir"."""
-
- def __init__(self, params):
- self._print_params(params)
-
- @staticmethod
- def _user_query(priv_query_exec, obj, params):
- if obj == 'babeltrace.support-info':
- if params['type'] == 'directory':
- name = os.path.basename(str(params['input']))
- return 1 if name == 'some-dir' else 0
- else:
- return 0
- else:
- raise bt2.UnknownObject
-
-
-@bt2.plugin_component_class
-class TestSourceABCDE(Base, bt2._UserSourceComponent, message_iterator_class=TestIter):
- """A source that recognizes the arbitrary string input "ABCDE"."""
-
- def __init__(self, params):
- self._print_params(params)
-
- @staticmethod
- def _user_query(priv_query_exec, obj, params):
- if obj == 'babeltrace.support-info':
- return (
- 1.0
- if params['type'] == 'string' and params['input'] == 'ABCDE'
- else 0.0
- )
- else:
- raise bt2.UnknownObject
-
-
-class TestSourceNoQuery(bt2._UserSourceComponent, message_iterator_class=TestIter):
- """A source that does not implement _query at all."""
-
-
-bt2.register_plugin(module_name=__name__, name="test")
--- /dev/null
+import bt2
+import os
+
+
+class TestIter(bt2._UserMessageIterator):
+ pass
+
+
+class Base:
+ @classmethod
+ def _print_params(cls, params):
+ inputs = sorted([str(x) for x in params['inputs']])
+ print('{}: {}'.format(cls.__name__, ', '.join(inputs)))
+
+
+@bt2.plugin_component_class
+class TestSourceExt(Base, bt2._UserSourceComponent, message_iterator_class=TestIter):
+ """
+ Recognize files whose name start with 'aaa', 'bbb' or 'ccc'.
+
+ 'aaa' files are grouped together, 'bbb' files are grouped together, 'ccc'
+ files are not grouped.
+ """
+
+ def __init__(self, params):
+ self._print_params(params)
+
+ @staticmethod
+ def _user_query(priv_query_exec, obj, params):
+ if obj == 'babeltrace.support-info':
+ if params['type'] == 'file':
+ name = os.path.basename(str(params['input']))
+
+ if name.startswith('aaa'):
+ return {'weight': 1, 'group': 'aaa'}
+ elif name.startswith('bbb'):
+ return {'weight': 0.5, 'group': 'bbb'}
+ elif name.startswith('ccc'):
+ # Try two different ways of returning "no group", and two
+ # different ways of returning 1 (an int and a float).
+ if name[3] == '1':
+ return {'weight': 1, 'group': None}
+ elif name[3] == '2':
+ return {'weight': 1.0, 'group': None}
+ elif name[3] == '3':
+ return 1
+ else:
+ return 1.0
+ else:
+ return 0
+ else:
+ raise bt2.UnknownObject
+
+
+@bt2.plugin_component_class
+class TestSourceSomeDir(
+ Base, bt2._UserSourceComponent, message_iterator_class=TestIter
+):
+ """Recognizes directories named "some-dir". The file "aaa10" in the
+ directory "some-dir" won't be found by TestSourceExt, because we won't
+ recurse in "some-dir"."""
+
+ def __init__(self, params):
+ self._print_params(params)
+
+ @staticmethod
+ def _user_query(priv_query_exec, obj, params):
+ if obj == 'babeltrace.support-info':
+ if params['type'] == 'directory':
+ name = os.path.basename(str(params['input']))
+ return 1 if name == 'some-dir' else 0
+ else:
+ return 0
+ else:
+ raise bt2.UnknownObject
+
+
+@bt2.plugin_component_class
+class TestSourceABCDE(Base, bt2._UserSourceComponent, message_iterator_class=TestIter):
+ """A source that recognizes the arbitrary string input "ABCDE"."""
+
+ def __init__(self, params):
+ self._print_params(params)
+
+ @staticmethod
+ def _user_query(priv_query_exec, obj, params):
+ if obj == 'babeltrace.support-info':
+ return (
+ 1.0
+ if params['type'] == 'string' and params['input'] == 'ABCDE'
+ else 0.0
+ )
+ else:
+ raise bt2.UnknownObject
+
+
+class TestSourceNoQuery(bt2._UserSourceComponent, message_iterator_class=TestIter):
+ """A source that does not implement _query at all."""
+
+
+bt2.register_plugin(module_name=__name__, name="test")