-*~
-/tests/cli/test_convert_args
-/tests/cli/test_debug_info
-/tests/cli/test_intersection
-/tests/cli/test_output_ctf_metadata
-/tests/cli/test_packet_seq_num
-/tests/cli/test_trace_copy
-/tests/cli/test_trace_read
-/tests/cli/test_trimmer
-/tests/bin/intersection/bt_python_helper.py
-/tests/bin/intersection/test_intersection
-/tests/bin/test_packet_seq_num
-/tests/bin/test_trace_read
/tests/ctf-writer/ctf_writer
-/tests/ctf-writer/test_ctf_writer
+/tests/lib/plugin
/tests/lib/test_bitfield
-/tests/lib/test_bt_ctf_field_type_validation
-/tests/lib/test_bt_objects
/tests/lib/test_bt_values
-/tests/lib/test_trace_ir_ref
-/tests/lib/test_ir_visit
-/tests/lib/test_trace_listener
-/tests/lib/test_plugin
-/tests/lib/test_plugin_complete
-/tests/lib/writer/bt_python_helper.py
-/tests/lib/writer/test_ctf_writer_empty_packet.py
-/tests/lib/writer/test_ctf_writer_no_packet_context.py
-/tests/lib/test_bt_message_iterator
-/tests/lib/test_cc_prio_map
/tests/lib/test_graph_topo
-/tests/lib/trace-ir/test_trace_ir
-/tests/lib/ctf-writer/test_ctf_writer
-/tests/plugins/flt.lttng-utils.debug-info/test_lttng_utils_debug_info
-/tests/plugins/flt.lttng-utils.debug-info/test_bin_info_i386-linux-gnu
-/tests/plugins/flt.lttng-utils.debug-info/test_bin_info_powerpc-linux-gnu
-/tests/plugins/flt.lttng-utils.debug-info/test_bin_info_powerpc64le-linux-gnu
-/tests/plugins/flt.lttng-utils.debug-info/test_bin_info_x86_64-linux-gnu
+/tests/lib/test_trace_ir_ref
/tests/plugins/flt.lttng-utils.debug-info/test_bin_info
-/tests/plugins/flt.lttng-utils.debug-info/test_dwarf_i386-linux-gnu
-/tests/plugins/flt.lttng-utils.debug-info/test_dwarf_powerpc-linux-gnu
-/tests/plugins/flt.lttng-utils.debug-info/test_dwarf_powerpc64le-linux-gnu
-/tests/plugins/flt.lttng-utils.debug-info/test_dwarf_x86_64-linux-gnu
/tests/plugins/flt.lttng-utils.debug-info/test_dwarf
-/tests/plugins/src.ctf.fs/query/test_query
-/tests/plugins/src.ctf.fs/succeed/test_succeed
-/tests/plugins/src.ctf.fs/succeed/gen-trace-*
-/tests/utils/common.sh
-/tests/utils/diff.sh
+/tests/plugins/src.ctf.fs/succeed/gen-trace-simple
+*~
*.o
*.a
*.la
tests/plugins/src.ctf.fs/Makefile
tests/plugins/src.ctf.fs/succeed/Makefile
tests/plugins/flt.lttng-utils.debug-info/Makefile
- tests/utils/common.sh
- tests/utils/diff.sh
tests/utils/Makefile
tests/utils/tap/Makefile
])
-AC_CONFIG_FILES([tests/cli/test_intersection], [chmod +x tests/cli/test_intersection])
-AC_CONFIG_FILES([tests/cli/test_convert_args], [chmod +x tests/cli/test_convert_args])
-AC_CONFIG_FILES([tests/cli/test_output_ctf_metadata], [chmod +x tests/cli/test_output_ctf_metadata])
-AC_CONFIG_FILES([tests/cli/test_packet_seq_num], [chmod +x tests/cli/test_packet_seq_num])
-AC_CONFIG_FILES([tests/cli/test_trace_copy], [chmod +x tests/cli/test_trace_copy])
-AC_CONFIG_FILES([tests/cli/test_trace_read], [chmod +x tests/cli/test_trace_read])
-AC_CONFIG_FILES([tests/cli/test_trimmer], [chmod +x tests/cli/test_trimmer])
-AC_CONFIG_FILES([tests/ctf-writer/test_ctf_writer], [chmod +x tests/ctf-writer/test_ctf_writer])
-AC_CONFIG_FILES([tests/lib/test_plugin_complete], [chmod +x tests/lib/test_plugin_complete])
-AC_CONFIG_FILES([tests/lib/trace-ir/test_trace_ir], [chmod +x tests/lib/trace-ir/test_trace_ir])
-AC_CONFIG_FILES([tests/plugins/src.ctf.fs/query/test_query], [chmod +x tests/plugins/src.ctf.fs/query/test_query])
-AC_CONFIG_FILES([tests/plugins/src.ctf.fs/succeed/test_succeed], [chmod +x tests/plugins/src.ctf.fs/succeed/test_succeed])
-AC_CONFIG_FILES([tests/plugins/flt.lttng-utils.debug-info/test_lttng_utils_debug_info], [chmod +x tests/plugins/flt.lttng-utils.debug-info/test_lttng_utils_debug_info])
-AC_CONFIG_FILES([tests/plugins/flt.lttng-utils.debug-info/test_dwarf_i386-linux-gnu], [chmod +x tests/plugins/flt.lttng-utils.debug-info/test_dwarf_i386-linux-gnu])
-AC_CONFIG_FILES([tests/plugins/flt.lttng-utils.debug-info/test_dwarf_powerpc-linux-gnu], [chmod +x tests/plugins/flt.lttng-utils.debug-info/test_dwarf_powerpc-linux-gnu])
-AC_CONFIG_FILES([tests/plugins/flt.lttng-utils.debug-info/test_dwarf_powerpc64le-linux-gnu], [chmod +x tests/plugins/flt.lttng-utils.debug-info/test_dwarf_powerpc64le-linux-gnu])
-AC_CONFIG_FILES([tests/plugins/flt.lttng-utils.debug-info/test_dwarf_x86_64-linux-gnu], [chmod +x tests/plugins/flt.lttng-utils.debug-info/test_dwarf_x86_64-linux-gnu])
-AC_CONFIG_FILES([tests/plugins/flt.lttng-utils.debug-info/test_bin_info_i386-linux-gnu], [chmod +x tests/plugins/flt.lttng-utils.debug-info/test_bin_info_i386-linux-gnu])
-AC_CONFIG_FILES([tests/plugins/flt.lttng-utils.debug-info/test_bin_info_powerpc-linux-gnu], [chmod +x tests/plugins/flt.lttng-utils.debug-info/test_bin_info_powerpc-linux-gnu])
-AC_CONFIG_FILES([tests/plugins/flt.lttng-utils.debug-info/test_bin_info_powerpc64le-linux-gnu], [chmod +x tests/plugins/flt.lttng-utils.debug-info/test_bin_info_powerpc64le-linux-gnu])
-AC_CONFIG_FILES([tests/plugins/flt.lttng-utils.debug-info/test_bin_info_x86_64-linux-gnu], [chmod +x tests/plugins/flt.lttng-utils.debug-info/test_bin_info_x86_64-linux-gnu])
-
-AS_IF([test "x$enable_python_bindings" = xyes],
- [
- AC_CONFIG_FILES([tests/bindings/python/bt2/test_python_bt2], [chmod +x tests/bindings/python/bt2/test_python_bt2])
- AC_CONFIG_FILES([tests/utils/test_python_bt2_env], [chmod +x tests/utils/test_python_bt2_env])
- ]
-)
-
-AS_IF([test "x$enable_python_plugins" = "xyes"],
- [AC_CONFIG_FILES([tests/python-plugin-provider/test_python_plugin_provider], [chmod +x tests/python-plugin-provider/test_python_plugin_provider])]
- [AC_CONFIG_FILES([tests/python-plugin-provider/test_python_plugin_provider_env], [chmod +x tests/python-plugin-provider/test_python_plugin_provider_env])]
-)
-
AC_OUTPUT
#
bindings/python/bt2/test_packet.py \
bindings/python/bt2/test_plugin.py \
bindings/python/bt2/test_port.py \
+ bindings/python/bt2/test_python_bt2 \
bindings/python/bt2/test_query_executor.py \
bindings/python/bt2/test_stream_class.py \
bindings/python/bt2/test_stream.py \
bindings/python/bt2/test_trace.py \
bindings/python/bt2/test_value.py \
bindings/python/bt2/utils.py \
+ cli/test_convert_args \
+ cli/test_intersection \
+ cli/test_output_ctf_metadata \
+ cli/test_packet_seq_num \
+ cli/test_trace_copy \
+ cli/test_trace_read \
+ cli/test_trimmer \
python-plugin-provider/bt_plugin_test_python_plugin_provider.py \
+ python-plugin-provider/test_python_plugin_provider \
python-plugin-provider/test_python_plugin_provider.py
TESTS_BINDINGS =
ctf-writer/test_ctf_writer
if !ENABLE_BUILT_IN_PLUGINS
-TESTS_LIB += lib/test_plugin_complete
-endif
-
-if ENABLE_PYTHON_BINDINGS
-TESTS_LIB += lib/trace-ir/test_trace_ir
+TESTS_LIB += lib/test_plugin
endif
TESTS_PLUGINS = \
TESTS_PYTHON_PLUGIN_PROVIDER += python-plugin-provider/test_python_plugin_provider
endif
-LOG_DRIVER_FLAGS = '--merge'
-LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/config/tap-driver.sh
+LOG_DRIVER_FLAGS = --merge --comments
+LOG_DRIVER = env AM_TAP_AWK='$(AWK)' \
+ BT_TESTS_SRCDIR='$(abs_top_srcdir)/tests' \
+ BT_TESTS_BUILDDIR='$(abs_top_builddir)/tests' \
+ BT_TESTS_AWK_BIN="$(AWK)" \
+ BT_TESTS_GREP_BIN="$(GREP)" \
+ BT_TESTS_PYTHON_BIN="$(PYTHON)" \
+ BT_TESTS_SED_BIN="$(SED)" \
+ $(SHELL) $(top_srcdir)/config/tap-driver.sh
TESTS = $(TESTS_BINDINGS) $(TESTS_CLI) $(TESTS_CTF_WRITER) $(TESTS_LIB) \
$(TESTS_PLUGINS) $(TESTS_PYTHON_PLUGIN_PROVIDER)
htmlcov
.coverage
-test_python_bt2
import os
-_TEST_PLUGIN_PLUGINS_PATH = os.environ['TEST_PLUGIN_PLUGINS_PATH']
+_TEST_PLUGIN_PLUGINS_PATH = os.environ['BT_PLUGINS_PATH']
class PluginSetTestCase(unittest.TestCase):
--- /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
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+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"
+
+run_python_bt2_test "${BT_TESTS_SRCDIR}/bindings/python/bt2"
+++ /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
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-NO_SH_TAP=1
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-check_coverage() {
- coverage run "$@"
-}
-
-export BABELTRACE_PYTHON_BT2_NO_TRACEBACK=1
-export TEST_PLUGIN_PLUGINS_PATH="${BT_BUILD_PATH}/src/plugins"
-export BABELTRACE_PLUGIN_PATH="${BT_BUILD_PATH}/src/plugins/ctf:${BT_BUILD_PATH}/src/plugins/utils:${BT_BUILD_PATH}/src/plugins/text"
-export BT_CTF_TRACES_PATH
-
-PYTHON_BUILD_DIR="${BT_BUILD_PATH}/src/bindings/python/bt2/build/build_lib"
-TESTS_UTILS_PYTHON_DIR="${BT_SRC_PATH}/tests/utils/python"
-TESTRUNNER_PY="${BT_SRC_PATH}/tests/utils/python/testrunner.py"
-THIS_DIR="${BT_SRC_PATH}/tests/bindings/python/bt2"
-
-if [ "x${MSYSTEM}" != "x" ]; then
- export PATH="${BT_BUILD_PATH}/src/lib/.libs:${PATH}"
-else
- export LD_LIBRARY_PATH="${BT_BUILD_PATH}/src/lib/.libs:${LD_LIBRARY_PATH}"
-fi
-
-if test "x${TESTALL_COVERAGE}" = "x1"; then
- EXEC=check_coverage
-else
- EXEC="@PYTHON@"
-
-fi
-
-PYTHONPATH="${PYTHON_BUILD_DIR}:${TESTS_UTILS_PYTHON_DIR}" \
- "${EXEC}" "${TESTRUNNER_PY}" "${THIS_DIR}"
-res=$?
-
-if test "x${TESTALL_COVERAGE_REPORT}" = "x1"; then
- coverage report -m
-fi
-
-if test "x${TESTALL_COVERAGE_HTML}" = "x1"; then
- coverage html
-fi
-
-exit $res
--- /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
+
+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"
+
+ # execute convert command
+ "$BT_TESTS_BT2_BIN" convert --run-args $convert_args >/dev/null 2>&1
+
+ 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
+}
+
+comment() {
+ echo "### $1 ###"
+}
+
+if [ "x${MSYSTEM:-}" != "x" ]; then
+ path_to_trace="C://path/to/trace"
+ output_path="C://output/path"
+else
+ path_to_trace="/path/to/trace"
+ output_path="/output/path"
+fi
+
+plan_tests 77
+
+test_bt_convert_run_args 'path leftover' "$path_to_trace" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftovers' "$path_to_trace ${path_to_trace}2 ${path_to_trace}3" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\", \"${path_to_trace}2\", \"${path_to_trace}3\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect ZZ:muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + named user source with --name --params' "$path_to_trace --component source.another.source --name HELLO --params salut=yes" "--component source.another.source --name HELLO --params salut=yes --component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect HELLO:muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + user source with --path --params' "$path_to_trace --component source.another.source --path some-path --params salut=yes" "--component source.another.source --params 'path=\"some-path\"' --params salut=yes --name source.another.source --component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 'source\\.another\\.source:muxer' --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'user source with --url + -o dummy' '--component MY:source.my.source --url the-url -o dummy' "--component MY:source.my.source --params 'url=\"the-url\"' --component sink.utils.dummy --name dummy --component filter.utils.muxer --name muxer --connect MY:muxer --connect muxer:dummy"
+test_bt_convert_run_args 'path leftover + --omit-home-plugin-path' "$path_to_trace --omit-home-plugin-path" "--omit-home-plugin-path --component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'unnamed user source' '--component source.salut.com' "--component source.salut.com --name source.salut.com --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 'source\.salut\.com:muxer' --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + user source named `source-ctf-fs`' "--component source-ctf-fs:source.salut.com $path_to_trace" "--component source-ctf-fs:source.salut.com --component source.ctf.fs --name source-ctf-fs-0 --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty-0 --params clock-seconds=yes --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer-0 --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --component filter.utils.trimmer --name trimmer-0 --params 'begin=\"abc\"' --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --begin' "$path_to_trace --begin=123" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --component filter.utils.trimmer --name trimmer --params 'begin=\"123\"' --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --component filter.utils.trimmer --name trimmer --params 'end=\"456\"' --params 'begin=\"123\"' --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --component filter.utils.trimmer --name trimmer --params 'begin=\"abc\"' --params 'end=\"xyz\"' --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params clock-cycles=yes --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --clock-date' "$path_to_trace --clock-date" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params clock-date=yes --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --clock-force-correlate' "$path_to_trace --clock-force-correlate" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --params assume-absolute-clock-classes=yes --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --clock-gmt' "$path_to_trace --clock-gmt" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params clock-gmt=yes --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --clock-offset' "$path_to_trace --clock-offset=15487" "--component source.ctf.fs --name source-ctf-fs --params clock-class-offset-s=15487 --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params clock-class-offset-ns=326159487 --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --clock-seconds' "$path_to_trace --clock-seconds" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params clock-seconds=yes --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --color' "$path_to_trace --color=never" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params 'color=\"never\"' --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --debug-info' "$path_to_trace --debug-info" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --component filter.lttng-utils.debug-info --name debug-info --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --component filter.lttng-utils.debug-info --name debug-info --params 'debug-info-dir=\"${output_path}\"' --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --component filter.lttng-utils.debug-info --name debug-info --params 'target-prefix=\"${output_path}\"' --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --component filter.lttng-utils.debug-info --name debug-info --params full-path=yes --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params field-trace:domain=yes,field-loglevel=yes,field-default=hide --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --fields=all' "--fields=all $path_to_trace" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params field-default=show --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --names=context,header' "--names=context,header $path_to_trace" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params name-context=yes,name-header=yes,name-default=hide --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --names=all' "--names=all $path_to_trace" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params name-default=show --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --no-delta' "$path_to_trace --no-delta" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params no-delta=yes --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + --output' "$path_to_trace --output $output_path" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params 'path=\"$output_path\"' --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
+test_bt_convert_run_args 'path leftover + -i ctf' "$path_to_trace -i ctf" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 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 source.ctf.lttng-live --name lttng-live --params 'url=\"net://some-host/host/target/session\"' --params 'session-not-found-action=\"end\"' --component sink.text.pretty --name pretty --component filter.utils.muxer --name 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 --name sink.abc.def --component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.utils.dummy --name dummy --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params clock-seconds=yes --component sink.utils.dummy --name dummy --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.ctf.fs --name sink-ctf-fs --params 'path=\"$output_path\"' --component filter.utils.muxer --name muxer --connect 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 --log-level W --name sink.mein.sink --component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component filter.utils.muxer --name muxer --connect 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 '--path without current component' "--path $path_to_trace"
+test_bt_convert_fails '--url without current component' '--url net://some-host/host/target/session'
+test_bt_convert_fails '--nane without current component' '--name chapeau'
+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"
+++ /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.
-
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-test_bt_convert_run_args() {
- local what="$1"
- local convert_args="$2"
- local expected_run_args="$3"
-
- # execute convert command
- local run_args="$("$BT_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"
-
- # execute convert command
- "$BT_BIN" convert --run-args $convert_args >/dev/null 2>&1
-
- 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
-}
-
-comment() {
- echo "### $1 ###"
-}
-
-@BABELTRACE_BUILD_WITH_MINGW_TRUE@path_to_trace="C://path/to/trace"
-@BABELTRACE_BUILD_WITH_MINGW_FALSE@path_to_trace="/path/to/trace"
-@BABELTRACE_BUILD_WITH_MINGW_TRUE@output_path="C://output/path"
-@BABELTRACE_BUILD_WITH_MINGW_FALSE@output_path="/output/path"
-
-plan_tests 77
-
-test_bt_convert_run_args 'path leftover' "$path_to_trace" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftovers' "$path_to_trace ${path_to_trace}2 ${path_to_trace}3" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\", \"${path_to_trace}2\", \"${path_to_trace}3\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect ZZ:muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + named user source with --name --params' "$path_to_trace --component source.another.source --name HELLO --params salut=yes" "--component source.another.source --name HELLO --params salut=yes --component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect HELLO:muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + user source with --path --params' "$path_to_trace --component source.another.source --path some-path --params salut=yes" "--component source.another.source --params 'path=\"some-path\"' --params salut=yes --name source.another.source --component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 'source\\.another\\.source:muxer' --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'user source with --url + -o dummy' '--component MY:source.my.source --url the-url -o dummy' "--component MY:source.my.source --params 'url=\"the-url\"' --component sink.utils.dummy --name dummy --component filter.utils.muxer --name muxer --connect MY:muxer --connect muxer:dummy"
-test_bt_convert_run_args 'path leftover + --omit-home-plugin-path' "$path_to_trace --omit-home-plugin-path" "--omit-home-plugin-path --component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'unnamed user source' '--component source.salut.com' "--component source.salut.com --name source.salut.com --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 'source\.salut\.com:muxer' --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + user source named `source-ctf-fs`' "--component source-ctf-fs:source.salut.com $path_to_trace" "--component source-ctf-fs:source.salut.com --component source.ctf.fs --name source-ctf-fs-0 --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty-0 --params clock-seconds=yes --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer-0 --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --component filter.utils.trimmer --name trimmer-0 --params 'begin=\"abc\"' --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --begin' "$path_to_trace --begin=123" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --component filter.utils.trimmer --name trimmer --params 'begin=\"123\"' --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --component filter.utils.trimmer --name trimmer --params 'end=\"456\"' --params 'begin=\"123\"' --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --component filter.utils.trimmer --name trimmer --params 'begin=\"abc\"' --params 'end=\"xyz\"' --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params clock-cycles=yes --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --clock-date' "$path_to_trace --clock-date" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params clock-date=yes --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --clock-force-correlate' "$path_to_trace --clock-force-correlate" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --params assume-absolute-clock-classes=yes --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --clock-gmt' "$path_to_trace --clock-gmt" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params clock-gmt=yes --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --clock-offset' "$path_to_trace --clock-offset=15487" "--component source.ctf.fs --name source-ctf-fs --params clock-class-offset-s=15487 --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params clock-class-offset-ns=326159487 --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --clock-seconds' "$path_to_trace --clock-seconds" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params clock-seconds=yes --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --color' "$path_to_trace --color=never" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params 'color=\"never\"' --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --debug-info' "$path_to_trace --debug-info" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --component filter.lttng-utils.debug-info --name debug-info --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --component filter.lttng-utils.debug-info --name debug-info --params 'debug-info-dir=\"${output_path}\"' --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --component filter.lttng-utils.debug-info --name debug-info --params 'target-prefix=\"${output_path}\"' --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --component filter.lttng-utils.debug-info --name debug-info --params full-path=yes --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params field-trace:domain=yes,field-loglevel=yes,field-default=hide --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --fields=all' "--fields=all $path_to_trace" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params field-default=show --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --names=context,header' "--names=context,header $path_to_trace" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params name-context=yes,name-header=yes,name-default=hide --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --names=all' "--names=all $path_to_trace" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params name-default=show --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --no-delta' "$path_to_trace --no-delta" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params no-delta=yes --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + --output' "$path_to_trace --output $output_path" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params 'path=\"$output_path\"' --component filter.utils.muxer --name muxer --connect source-ctf-fs:muxer --connect muxer:pretty"
-test_bt_convert_run_args 'path leftover + -i ctf' "$path_to_trace -i ctf" "--component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 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 source.ctf.lttng-live --name lttng-live --params 'url=\"net://some-host/host/target/session\"' --params 'session-not-found-action=\"end\"' --component sink.text.pretty --name pretty --component filter.utils.muxer --name 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 --name sink.abc.def --component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.utils.dummy --name dummy --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.text.pretty --name pretty --params clock-seconds=yes --component sink.utils.dummy --name dummy --component filter.utils.muxer --name muxer --connect 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 source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component sink.ctf.fs --name sink-ctf-fs --params 'path=\"$output_path\"' --component filter.utils.muxer --name muxer --connect 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 --log-level W --name sink.mein.sink --component source.ctf.fs --name source-ctf-fs --params 'paths=[\"$path_to_trace\"]' --component filter.utils.muxer --name muxer --connect 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 '--path without current component' "--path $path_to_trace"
-test_bt_convert_fails '--url without current component' '--url net://some-host/host/target/session'
-test_bt_convert_fails '--nane without current component' '--name chapeau'
-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"
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2015 Julien Desfossez <jdesfossez@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"
+
+NUM_TESTS=10
+
+plan_tests $NUM_TESTS
+
+test_intersect() {
+ local trace="$1"
+ local totalevents="$2"
+ local intersect="$3"
+
+ local cnt
+
+ cnt=$("${BT_TESTS_BT2_BIN}" "$trace" | wc -l)
+ test "${cnt// /}" = "$totalevents"
+ ok $? "$totalevents events in the whole trace"
+
+ cnt=$("${BT_TESTS_BT2_BIN}" --stream-intersection "$trace" 2>/dev/null| wc -l)
+ test "${cnt// /}" = "$intersect"
+ ok $? "$intersect events in packets intersecting"
+}
+
+diag "Test the stream intersection feature"
+
+diag "2 streams offsetted with 3 packets intersecting"
+test_intersect "${BT_CTF_TRACES_PATH}/intersection/3eventsintersect" 8 3
+
+diag "2 streams offsetted with 3 packets intersecting (exchanged file names)"
+test_intersect "${BT_CTF_TRACES_PATH}/intersection/3eventsintersectreverse" 8 3
+
+diag "No intersection between 2 streams"
+test_intersect "${BT_CTF_TRACES_PATH}/intersection/nointersect" 6 0
+
+diag "Only 1 stream"
+test_intersect "${BT_CTF_TRACES_PATH}/intersection/onestream" 3 3
+
+diag "No stream at all"
+test_intersect "${BT_CTF_TRACES_PATH}/intersection/nostream" 0 0
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) - 2015 Julien Desfossez <jdesfossez@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.
-
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-NUM_TESTS=10
-
-plan_tests $NUM_TESTS
-
-test_intersect() {
- trace="$1"
- totalevents="$2"
- intersect="$3"
-
- test $("${BT_BIN}" "$trace" | wc -l) = "$totalevents"
- ok $? "$totalevents events in the whole trace"
- test $("${BT_BIN}" --stream-intersection "$trace" 2>/dev/null| wc -l) = "$intersect"
- ok $? "$intersect events in packets intersecting"
-}
-
-diag "Test the stream intersection feature"
-
-diag "2 streams offsetted with 3 packets intersecting"
-test_intersect "${BT_CTF_TRACES_PATH}/intersection/3eventsintersect" 8 3
-
-diag "2 streams offsetted with 3 packets intersecting (exchanged file names)"
-test_intersect "${BT_CTF_TRACES_PATH}/intersection/3eventsintersectreverse" 8 3
-
-diag "No intersection between 2 streams"
-test_intersect "${BT_CTF_TRACES_PATH}/intersection/nointersect" 6 0
-
-diag "Only 1 stream"
-test_intersect "${BT_CTF_TRACES_PATH}/intersection/onestream" 3 3
-
-diag "No stream at all"
-test_intersect "${BT_CTF_TRACES_PATH}/intersection/nostream" 0 0
--- /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.
+
+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"
+
+NUM_TESTS=3
+
+plan_tests $NUM_TESTS
+
+tmp_metadata=$(mktemp)
+
+# Test a valid trace directory.
+"${BT_TESTS_BT2_BIN}" -o ctf-metadata "${BT_CTF_TRACES_PATH}/succeed/wk-heartbeat-u" > "$tmp_metadata"
+ok $? "Run babeltrace -o ctf-metadata with a valid trace directory, correct exit status"
+
+cmp -s "$tmp_metadata" "${BT_TESTS_DATADIR}/cli/test_output_ctf_metadata.ref"
+ok $? "Run babeltrace -o ctf-metadata with a valid trace directory, correct output"
+
+# Test an invalid trace directory.
+"${BT_TESTS_BT2_BIN}" -o ctf-metadata "${BT_CTF_TRACES_PATH}" >/dev/null 2>&1
+isnt $? 0 "Run babeltrace -o ctf-metadata with an invalid trace directory, expecting failure"
+
+rm -f "$tmp_metadata"
+++ /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.
-
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-
-NUM_TESTS=3
-
-plan_tests $NUM_TESTS
-
-tmp_metadata=$(mktemp)
-
-# Test a valid trace directory.
-"${BT_BIN}" -o ctf-metadata "${BT_CTF_TRACES_PATH}/succeed/wk-heartbeat-u" > "$tmp_metadata"
-ok $? "Run babeltrace -o ctf-metadata with a valid trace directory, correct exit status"
-
-cmp -s "$tmp_metadata" "${BT_SRC_PATH}/tests/data/cli/test_output_ctf_metadata.ref"
-ok $? "Run babeltrace -o ctf-metadata with a valid trace directory, correct output"
-
-# Test an invalid trace directory.
-"${BT_BIN}" -o ctf-metadata "${BT_CTF_TRACES_PATH}" &> /dev/null
-isnt $? 0 "Run babeltrace -o ctf-metadata with an invalid trace directory, expecting failure"
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2015 Julien Desfossez <jdesfossez@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"
+
+NUM_TESTS=10
+
+plan_tests $NUM_TESTS
+
+test_no_lost() {
+ local trace=$1
+
+ "${BT_TESTS_BT2_BIN}" "$trace" >/dev/null 2>&1
+ ok $? "Trace parses"
+ "${BT_TESTS_BT2_BIN}" "$trace" 2>&1 >/dev/null | "${BT_TESTS_GREP_BIN}" "\[warning\] Tracer lost"
+ if test $? = 0; then
+ fail 1 "Should not find any lost events"
+ else
+ ok 0 "No events lost"
+ fi
+}
+
+test_lost() {
+ local trace=$1
+ local expectedcountstr=$2
+
+ "${BT_TESTS_BT2_BIN}" "$trace" >/dev/null 2>&1
+ ok $? "Trace parses"
+
+ # Convert warnings like:
+ # WARNING: Tracer discarded 2 trace packets between ....
+ # WARNING: Tracer discarded 3 trace packets between ....
+ # into "2,3" and make sure it matches the expected result
+ "${BT_TESTS_BT2_BIN}" "$trace" 2>&1 >/dev/null | "${BT_TESTS_GREP_BIN}" "WARNING: Tracer discarded" \
+ | cut -d" " -f4 | tr "\n" "," | "${BT_TESTS_SED_BIN}" "s/.$//" | \
+ "${BT_TESTS_GREP_BIN}" "$expectedcountstr" >/dev/null
+ ok $? "Lost events string matches $expectedcountstr"
+
+}
+
+diag "Test the packet_seq_num validation"
+
+diag "No packet lost"
+test_no_lost "${BT_CTF_TRACES_PATH}/packet_seq_num/no_lost"
+
+diag "No packet lost, packet_seq_num not starting at 0"
+test_no_lost "${BT_CTF_TRACES_PATH}/packet_seq_num/no_lost_not_starting_at_0"
+
+diag "1 stream, 2 packets lost before the last packet"
+test_lost "${BT_CTF_TRACES_PATH}/packet_seq_num/2_lost_before_last" "2"
+
+diag "2 streams, packets lost in one of them"
+test_lost "${BT_CTF_TRACES_PATH}/packet_seq_num/2_streams_lost_in_1" "2"
+
+diag "2 streams, packets lost in both"
+test_lost "${BT_CTF_TRACES_PATH}/packet_seq_num/2_streams_lost_in_2" "2,3,1"
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) - 2015 Julien Desfossez <jdesfossez@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.
-
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-NUM_TESTS=10
-
-plan_tests $NUM_TESTS
-
-test_no_lost() {
- trace=$1
-
- "${BT_BIN}" "$trace" >/dev/null 2>&1
- ok $? "Trace parses"
- "${BT_BIN}" "$trace" 2>&1 >/dev/null | @GREP@ "\[warning\] Tracer lost"
- if test $? = 0; then
- fail 1 "Should not find any lost events"
- else
- ok 0 "No events lost"
- fi
-}
-
-test_lost() {
- trace=$1
- expectedcountstr=$2
-
- "${BT_BIN}" "$trace" >/dev/null 2>&1
- ok $? "Trace parses"
-
- # Convert warnings like:
- # WARNING: Tracer discarded 2 trace packets between ....
- # WARNING: Tracer discarded 3 trace packets between ....
- # into "2,3" and make sure it matches the expected result
- "${BT_BIN}" "$trace" 2>&1 >/dev/null | @GREP@ "WARNING: Tracer discarded" \
- | cut -d" " -f4 | tr "\n" "," | @SED@ "s/.$//" | \
- @GREP@ "$expectedcountstr" >/dev/null
- ok $? "Lost events string matches $expectedcountstr"
-
-}
-
-diag "Test the packet_seq_num validation"
-
-diag "No packet lost"
-test_no_lost "${BT_CTF_TRACES_PATH}/packet_seq_num/no_lost"
-
-diag "No packet lost, packet_seq_num not starting at 0"
-test_no_lost "${BT_CTF_TRACES_PATH}/packet_seq_num/no_lost_not_starting_at_0"
-
-diag "1 stream, 2 packets lost before the last packet"
-test_lost "${BT_CTF_TRACES_PATH}/packet_seq_num/2_lost_before_last" "2"
-
-diag "2 streams, packets lost in one of them"
-test_lost "${BT_CTF_TRACES_PATH}/packet_seq_num/2_streams_lost_in_1" "2"
-
-diag "2 streams, packets lost in both"
-test_lost "${BT_CTF_TRACES_PATH}/packet_seq_num/2_streams_lost_in_2" "2,3,1"
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) - 2017 Julien Desfossez <jdesfossez@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"
+
+clean_tmp() {
+ rm -rf "${out_path}" "${text_output1}" "${text_output2}"
+}
+
+SUCCESS_TRACES=(${BT_CTF_TRACES_PATH}/succeed/*)
+
+# -2 because there is an empty trace that we skip
+NUM_TESTS=$((${#SUCCESS_TRACES[@]} * 3 - 2))
+
+plan_tests $NUM_TESTS
+
+for path in "${SUCCESS_TRACES[@]}"; do
+ out_path="$(mktemp -d)"
+ text_output1="$(mktemp)"
+ text_output2="$(mktemp)"
+ trace="$(basename "${path}")"
+ sort_cmd="cat" # by default do not sort the trace
+
+ "${BT_TESTS_BT2_BIN}" --no-delta "${path}" 2>/dev/null >"${text_output1}"
+ ret=$?
+ cnt="$(wc -l < "${text_output1}")"
+ if test "$ret" == 0 && test "${cnt// /}" == 0; then
+ pass "Empty trace ${trace}, nothing to copy"
+ clean_tmp
+ continue
+ fi
+
+ # If the trace has a timestamp (starts with [), check if there are
+ # duplicate timestamps in the output.
+ # If there are, we have to sort the text output to make sure it is
+ # always the same.
+ head -1 "${text_output1}" | "${BT_TESTS_GREP_BIN}" "^\[" >/dev/null
+ if test $? = 0; then
+ uniq_ts_cnt="$("${BT_TESTS_AWK_BIN}" '{ print $1 }' < "${text_output1}" | sort | uniq | wc -l)"
+ # Extract only the timestamp columns and compare the number of
+ # unique lines with the total number of lines to see if there
+ # are duplicate timestamps.
+ if test "${cnt// /}" != "${uniq_ts_cnt// /}"; then
+ diag "Trace with non unique timestamps, sorting the output"
+ sort_cmd="sort"
+ tmp="$(mktemp)"
+ sort "${text_output1}" > "$tmp"
+ rm "${text_output1}"
+ text_output1="$tmp"
+ fi
+ fi
+
+ "${BT_TESTS_BT2_BIN}" "${path}" --component sink.ctf.fs --path "${out_path}" >/dev/null 2>&1
+ ok $? "Copy trace ${trace} with ctf-fs sink"
+
+ "${BT_TESTS_BT2_BIN}" "${out_path}" >/dev/null 2>&1
+ ok $? "Read the new trace in ${out_path}"
+
+ "${BT_TESTS_BT2_BIN}" --no-delta "${out_path}" 2>/dev/null | $sort_cmd >"${text_output2}"
+ cnt=$(diff "${text_output1}" "${text_output2}" | wc -l)
+ test "${cnt// /}" == 0
+ ok $? "Exact same content between the two traces"
+
+ clean_tmp
+done
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) - 2017 Julien Desfossez <jdesfossez@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.
-
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-clean_tmp() {
- rm -rf "${out_path}" "${text_output1}" "${text_output2}"
-}
-
-SUCCESS_TRACES=(${BT_CTF_TRACES_PATH}/succeed/*)
-
-# -2 because there is an empty trace that we skip
-NUM_TESTS=$((${#SUCCESS_TRACES[@]} * 3 - 2))
-
-plan_tests $NUM_TESTS
-
-for path in "${SUCCESS_TRACES[@]}"; do
- out_path="$(mktemp -d)"
- text_output1="$(mktemp)"
- text_output2="$(mktemp)"
- trace="$(basename "${path}")"
- sort_cmd="cat" # by default do not sort the trace
-
- "${BT_BIN}" --no-delta "${path}" 2>/dev/null >"${text_output1}"
- ret=$?
- cnt="$(wc -l < "${text_output1}")"
- if test "$ret" == 0 && test $cnt == 0; then
- pass "Empty trace ${trace}, nothing to copy"
- clean_tmp
- continue
- fi
-
- # If the trace has a timestamp (starts with [), check if there are
- # duplicate timestamps in the output.
- # If there are, we have to sort the text output to make sure it is
- # always the same.
- head -1 "${text_output1}" | @GREP@ "^\[" >/dev/null
- if test $? = 0; then
- uniq_ts_cnt="$(@AWK@ '{ print $1 }' < "${text_output1}" | sort | uniq | wc -l)"
- # Extract only the timestamp columns and compare the number of
- # unique lines with the total number of lines to see if there
- # are duplicate timestamps.
- if test $cnt != $uniq_ts_cnt; then
- diag "Trace with non unique timestamps, sorting the output"
- sort_cmd="sort"
- tmp="$(mktemp)"
- sort "${text_output1}" > "$tmp"
- rm "${text_output1}"
- text_output1="$tmp"
- fi
- fi
-
- "${BT_BIN}" "${path}" --component sink.ctf.fs --path "${out_path}" >/dev/null 2>&1
- ok $? "Copy trace ${trace} with ctf-fs sink"
-
- "${BT_BIN}" "${out_path}" >/dev/null 2>&1
- ok $? "Read the new trace in ${out_path}"
-
- "${BT_BIN}" --no-delta "${out_path}" 2>/dev/null | $sort_cmd >"${text_output2}"
- cnt=$(diff "${text_output1}" "${text_output2}" | wc -l)
- test $cnt == 0
- ok $? "Exact same content between the two traces"
-
- clean_tmp
-done
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2013 Christian Babeux <christian.babeux@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"
+
+SUCCESS_TRACES=(${BT_CTF_TRACES_PATH}/succeed/*)
+FAIL_TRACES=(${BT_CTF_TRACES_PATH}/fail/*)
+
+NUM_TESTS=$((${#SUCCESS_TRACES[@]} + ${#FAIL_TRACES[@]}))
+
+plan_tests $NUM_TESTS
+
+for path in "${SUCCESS_TRACES[@]}"; do
+ trace=$(basename "${path}")
+ "${BT_TESTS_BT2_BIN}" "${path}" > /dev/null 2>&1
+ ok $? "Run babeltrace2 with trace ${trace}"
+done
+
+for path in "${FAIL_TRACES[@]}"; do
+ trace=$(basename "${path}")
+ if "${BT_TESTS_BT2_BIN}" "${path}" > /dev/null 2>&1; then
+ fail "Run babeltrace2 with invalid trace ${trace}"
+ else
+ pass "Run babeltrace2 with invalid trace ${trace}"
+ fi
+done
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) - 2013 Christian Babeux <christian.babeux@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.
-
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-SUCCESS_TRACES=(${BT_CTF_TRACES_PATH}/succeed/*)
-FAIL_TRACES=(${BT_CTF_TRACES_PATH}/fail/*)
-
-NUM_TESTS=$((${#SUCCESS_TRACES[@]} + ${#FAIL_TRACES[@]}))
-
-plan_tests $NUM_TESTS
-
-for path in "${SUCCESS_TRACES[@]}"; do
- trace=$(basename "${path}")
- "${BT_BIN}" "${path}" > /dev/null 2>&1
- ok $? "Run babeltrace2 with trace ${trace}"
-done
-
-for path in "${FAIL_TRACES[@]}"; do
- trace=$(basename "${path}")
- "${BT_BIN}" "${path}" > /dev/null 2>&1
- if [ $? -eq 0 ]; then
- fail "Run babeltrace2 with invalid trace ${trace}"
- else
- pass "Run babeltrace2 with invalid trace ${trace}"
- fi
-done
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2017 Julien Desfossez <jdesfossez@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"
+
+TRACE_PATH="${BT_CTF_TRACES_PATH}/succeed/wk-heartbeat-u/"
+
+NUM_TESTS=40
+
+plan_tests $NUM_TESTS
+
+tmp_out=$(mktemp)
+
+# Run Babeltrace with some command line arguments, verify exit status and
+# number of output events (i.e. number of output lines)
+#
+# Arguments:
+#
+# $1: expected number of events
+# $2: test description
+# remaining arguments: command-line arguments to pass to Babeltrace
+
+function expect_success()
+{
+ local expected_num_events="$1"
+ shift
+ local msg="$1"
+ shift
+
+ "${BT_TESTS_BT2_BIN}" "${TRACE_PATH}" "$@" 2>/dev/null > "${tmp_out}"
+ ok $? "trimmer: ${msg}: exit status"
+ num_events=$(wc -l < "${tmp_out}")
+ # Use bash parameter expansion to strip spaces added by BSD 'wc' on macOs and Solaris
+ is "${num_events// /}" "${expected_num_events}" "trimmer: ${msg}: number of events (${expected_num_events})"
+}
+
+expect_success 18 "--begin, GMT relative timestamps" \
+ --clock-gmt --begin 17:48:17.587029529
+expect_success 9 "--end, GMT relative timestamps" \
+ --clock-gmt --end 17:48:17.588680018
+expect_success 7 "--begin and --end, GMT relative timestamps" \
+ --clock-gmt --begin 17:48:17.587029529 --end 17:48:17.588680018
+expect_success 0 "--begin, out of range, GMT relative timestamps" \
+ --clock-gmt --begin 18:48:17.587029529
+expect_success 0 "--end, out of range, GMT relative timestamps" \
+ --clock-gmt --end 16:48:17.588680018
+
+expect_success 18 "--begin, GMT absolute timestamps" \
+ --clock-gmt --begin "2012-10-29 17:48:17.587029529"
+expect_success 9 "--end, GMT absolute timestamps" \
+ --clock-gmt --end "2012-10-29 17:48:17.588680018"
+expect_success 7 "--begin and --end, GMT absolute timestamps" \
+ --clock-gmt --begin "2012-10-29 17:48:17.587029529" --end "2012-10-29 17:48:17.588680018"
+expect_success 0 "--begin, out of range, GMT absolute timestamps" \
+ --clock-gmt --begin "2012-10-29 18:48:17.587029529"
+expect_success 0 "--begin, out of range, GMT absolute timestamps" \
+ --clock-gmt --end "2012-10-29 16:48:17.588680018"
+
+export TZ=EST
+
+expect_success 18 "--begin, EST relative timestamps" \
+ --begin "12:48:17.587029529"
+expect_success 9 "--end, EST relative timestamps" \
+ --end "12:48:17.588680018"
+expect_success 7 "--begin and --end, EST relative timestamps" \
+ --begin "12:48:17.587029529" --end "12:48:17.588680018"
+expect_success 0 "--begin, out of range, EST relative timestamps" \
+ --begin "13:48:17.587029529"
+expect_success 0 "--end, out of range, EST relative timestamps" \
+ --end "11:48:17.588680018"
+
+expect_success 18 "--begin, EST absolute timestamps" \
+ --begin "2012-10-29 12:48:17.587029529"
+expect_success 9 "--end, EST absolute timestamps" \
+ --end "12:48:17.588680018"
+expect_success 7 "--begin and --end, EST absolute timestamps" \
+ --begin "2012-10-29 12:48:17.587029529" --end "2012-10-29 12:48:17.588680018"
+expect_success 0 "--begin, out of range, EST absolute timestamps" \
+ --begin "2012-10-29 13:48:17.587029529"
+expect_success 0 "--end, out of range, EST absolute timestamps" \
+ --end "2012-10-29 11:48:17.588680018"
+
+rm "${tmp_out}"
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) - 2017 Julien Desfossez <jdesfossez@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.
-
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-TRACE_PATH="${BT_CTF_TRACES_PATH}/succeed/wk-heartbeat-u/"
-
-NUM_TESTS=40
-
-plan_tests $NUM_TESTS
-
-tmp_out=$(mktemp)
-
-# Run Babeltrace with some command line arguments, verify exit status and
-# number of output events (i.e. number of output lines)
-#
-# Arguments:
-#
-# $1: expected number of events
-# $2: test description
-# remaining arguments: command-line arguments to pass to Babeltrace
-
-function expect_success()
-{
- local expected_num_events="$1"
- shift
- local msg="$1"
- shift
-
- "${BT_BIN}" "${TRACE_PATH}" "$@" 2>/dev/null > "${tmp_out}"
- ok $? "trimmer: ${msg}: exit status"
- num_events=$(wc -l < "${tmp_out}")
- # Use bash parameter expansion to strip spaces added by BSD 'wc' on macOs and Solaris
- is "${num_events// /}" "${expected_num_events}" "trimmer: ${msg}: number of events (${expected_num_events})"
-}
-
-expect_success 18 "--begin, GMT relative timestamps" \
- --clock-gmt --begin 17:48:17.587029529
-expect_success 9 "--end, GMT relative timestamps" \
- --clock-gmt --end 17:48:17.588680018
-expect_success 7 "--begin and --end, GMT relative timestamps" \
- --clock-gmt --begin 17:48:17.587029529 --end 17:48:17.588680018
-expect_success 0 "--begin, out of range, GMT relative timestamps" \
- --clock-gmt --begin 18:48:17.587029529
-expect_success 0 "--end, out of range, GMT relative timestamps" \
- --clock-gmt --end 16:48:17.588680018
-
-expect_success 18 "--begin, GMT absolute timestamps" \
- --clock-gmt --begin "2012-10-29 17:48:17.587029529"
-expect_success 9 "--end, GMT absolute timestamps" \
- --clock-gmt --end "2012-10-29 17:48:17.588680018"
-expect_success 7 "--begin and --end, GMT absolute timestamps" \
- --clock-gmt --begin "2012-10-29 17:48:17.587029529" --end "2012-10-29 17:48:17.588680018"
-expect_success 0 "--begin, out of range, GMT absolute timestamps" \
- --clock-gmt --begin "2012-10-29 18:48:17.587029529"
-expect_success 0 "--begin, out of range, GMT absolute timestamps" \
- --clock-gmt --end "2012-10-29 16:48:17.588680018"
-
-export TZ=EST
-
-expect_success 18 "--begin, EST relative timestamps" \
- --begin "12:48:17.587029529"
-expect_success 9 "--end, EST relative timestamps" \
- --end "12:48:17.588680018"
-expect_success 7 "--begin and --end, EST relative timestamps" \
- --begin "12:48:17.587029529" --end "12:48:17.588680018"
-expect_success 0 "--begin, out of range, EST relative timestamps" \
- --begin "13:48:17.587029529"
-expect_success 0 "--end, out of range, EST relative timestamps" \
- --end "11:48:17.588680018"
-
-expect_success 18 "--begin, EST absolute timestamps" \
- --begin "2012-10-29 12:48:17.587029529"
-expect_success 9 "--end, EST absolute timestamps" \
- --end "12:48:17.588680018"
-expect_success 7 "--begin and --end, EST absolute timestamps" \
- --begin "2012-10-29 12:48:17.587029529" --end "2012-10-29 12:48:17.588680018"
-expect_success 0 "--begin, out of range, EST absolute timestamps" \
- --begin "2012-10-29 13:48:17.587029529"
-expect_success 0 "--end, out of range, EST absolute timestamps" \
- --end "2012-10-29 11:48:17.588680018"
-
-rm "${tmp_out}"
$(top_builddir)/tests/utils/tap/libtap.la \
$(top_builddir)/tests/utils/libtestcommon.la \
$(top_builddir)/src/ctf-writer/libbabeltrace2-ctf-writer.la
+
+dist_check_SCRIPTS = test_ctf_writer
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2013 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+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"
+
+"${BT_TESTS_BUILDDIR}/ctf-writer/ctf_writer" "$BT_TESTS_BT2_BIN"
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2013 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-NO_SH_TAP=1
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-curdir="$(cd -P "$(dirname "$0")" >/dev/null && pwd)"
-
-"${curdir}/ctf_writer" "$BT_BIN"
test_graph_topo_SOURCES = test_graph_topo.c
if !ENABLE_BUILT_IN_PLUGINS
-noinst_PROGRAMS += test_plugin
-test_plugin_LDADD = $(COMMON_TEST_LDADD) \
+noinst_PROGRAMS += plugin
+plugin_LDADD = $(COMMON_TEST_LDADD) \
$(top_builddir)/src/lib/libbabeltrace2.la
-test_plugin_SOURCES = test_plugin.c
+plugin_SOURCES = plugin.c
SUBDIRS += test-plugin-plugins
endif
+
+dist_check_SCRIPTS = test_plugin
--- /dev/null
+/*
+ * 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 as published by
+ * the Free Software Foundation; under version 2 of the License.
+ *
+ * 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.
+ */
+
+#include <babeltrace2/babeltrace.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include "common/assert.h"
+#include <glib.h>
+#include "tap/tap.h"
+#include "common.h"
+
+#define NR_TESTS 38
+#define NON_EXISTING_PATH "/this/hopefully/does/not/exist/5bc75f8d-0dba-4043-a509-d7984b97e42b.so"
+
+/* Those symbols are written to by some test plugins */
+static int check_env_var(const char *name)
+{
+ const char *val = getenv(name);
+
+ if (!val) {
+ return -1;
+ }
+
+ return atoi(val);
+}
+
+static void reset_test_plugin_env_vars(void)
+{
+ g_setenv("BT_TEST_PLUGIN_INIT_CALLED", "0", 1);
+ g_setenv("BT_TEST_PLUGIN_EXIT_CALLED", "0", 1);
+}
+
+static char *get_test_plugin_path(const char *plugin_dir,
+ const char *plugin_name)
+{
+ char *ret;
+ char *plugin_file_name;
+
+ if (asprintf(&plugin_file_name, "plugin-%s." G_MODULE_SUFFIX,
+ plugin_name) == -1) {
+ abort();
+ }
+
+ ret = g_build_filename(plugin_dir, plugin_file_name, NULL);
+ free(plugin_file_name);
+
+ return ret;
+}
+
+static void test_minimal(const char *plugin_dir)
+{
+ const bt_plugin_set *plugin_set = NULL;
+ const bt_plugin *plugin;
+ char *minimal_path = get_test_plugin_path(plugin_dir, "minimal");
+ bt_plugin_status status;
+
+ BT_ASSERT(minimal_path);
+ diag("minimal plugin test below");
+
+ reset_test_plugin_env_vars();
+ status = bt_plugin_find_all_from_file(minimal_path, BT_FALSE,
+ &plugin_set);
+ ok(status == BT_PLUGIN_STATUS_OK,
+ "bt_plugin_find_all_from_file() succeeds with a valid file");
+ ok(plugin_set,
+ "bt_plugin_find_all_from_file() returns a plugin set");
+ ok(check_env_var("BT_TEST_PLUGIN_INIT_CALLED") == 1,
+ "plugin's initialization function is called during bt_plugin_find_all_from_file()");
+ ok(bt_plugin_set_get_plugin_count(plugin_set) == 1,
+ "bt_plugin_find_all_from_file() returns the expected number of plugins");
+ plugin = bt_plugin_set_borrow_plugin_by_index_const(plugin_set, 0);
+ ok(strcmp(bt_plugin_get_name(plugin), "test_minimal") == 0,
+ "bt_plugin_get_name() returns the expected name");
+ ok(strcmp(bt_plugin_get_description(plugin),
+ "Minimal Babeltrace plugin with no component classes") == 0,
+ "bt_plugin_get_description() returns the expected description");
+ ok(bt_plugin_get_version(plugin, NULL, NULL, NULL, NULL) ==
+ BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE,
+ "bt_plugin_get_version() fails when there's no version");
+ ok(strcmp(bt_plugin_get_author(plugin), "Janine Sutto") == 0,
+ "bt_plugin_get_author() returns the expected author");
+ ok(strcmp(bt_plugin_get_license(plugin), "Beerware") == 0,
+ "bt_plugin_get_license() returns the expected license");
+ ok(strcmp(bt_plugin_get_path(plugin), minimal_path) == 0,
+ "bt_plugin_get_path() returns the expected path");
+ ok(bt_plugin_get_source_component_class_count(plugin) == 0,
+ "bt_plugin_get_source_component_class_count() returns the expected value");
+ ok(bt_plugin_get_filter_component_class_count(plugin) == 0,
+ "bt_plugin_get_filter_component_class_count() returns the expected value");
+ ok(bt_plugin_get_sink_component_class_count(plugin) == 0,
+ "bt_plugin_get_sink_component_class_count() returns the expected value");
+ bt_plugin_set_put_ref(plugin_set);
+ ok(check_env_var("BT_TEST_PLUGIN_EXIT_CALLED") == 1,
+ "plugin's exit function is called when the plugin is destroyed");
+
+ free(minimal_path);
+}
+
+static void test_sfs(const char *plugin_dir)
+{
+ const bt_plugin_set *plugin_set = NULL;
+ const bt_plugin *plugin;
+ const bt_component_class_sink *sink_comp_class;
+ const bt_component_class_source *source_comp_class;
+ const bt_component_class_filter *filter_comp_class;
+ const bt_component_sink *sink_component;
+ char *sfs_path = get_test_plugin_path(plugin_dir, "sfs");
+ unsigned int major, minor, patch;
+ const char *extra;
+ bt_value *params;
+ const bt_value *results;
+ const bt_value *object;
+ const bt_value *res_params;
+ bt_graph *graph;
+ const char *object_str;
+ bt_graph_status graph_ret;
+ bt_query_executor *query_exec = bt_query_executor_create();
+ int ret;
+ bt_plugin_status status;
+
+ BT_ASSERT(query_exec);
+ BT_ASSERT(sfs_path);
+ diag("sfs plugin test below");
+
+ status = bt_plugin_find_all_from_file(sfs_path, BT_FALSE, &plugin_set);
+ BT_ASSERT(status == BT_PLUGIN_STATUS_OK && plugin_set &&
+ bt_plugin_set_get_plugin_count(plugin_set) == 1);
+ plugin = bt_plugin_set_borrow_plugin_by_index_const(plugin_set, 0);
+ ok(bt_plugin_get_version(plugin, &major, &minor, &patch, &extra) ==
+ BT_PROPERTY_AVAILABILITY_AVAILABLE,
+ "bt_plugin_get_version() succeeds when there's a version");
+ ok(major == 1,
+ "bt_plugin_get_version() returns the expected major version");
+ ok(minor == 2,
+ "bt_plugin_get_version() returns the expected minor version");
+ ok(patch == 3,
+ "bt_plugin_get_version() returns the expected patch version");
+ ok(strcmp(extra, "yes") == 0,
+ "bt_plugin_get_version() returns the expected extra version");
+ ok(bt_plugin_get_source_component_class_count(plugin) == 1,
+ "bt_plugin_get_source_component_class_count() returns the expected value");
+ ok(bt_plugin_get_filter_component_class_count(plugin) == 1,
+ "bt_plugin_get_filter_component_class_count() returns the expected value");
+ ok(bt_plugin_get_sink_component_class_count(plugin) == 1,
+ "bt_plugin_get_sink_component_class_count() returns the expected value");
+
+ source_comp_class = bt_plugin_borrow_source_component_class_by_name_const(
+ plugin, "source");
+ ok(source_comp_class,
+ "bt_plugin_borrow_source_component_class_by_name_const() finds a source component class");
+
+ sink_comp_class = bt_plugin_borrow_sink_component_class_by_name_const(
+ plugin, "sink");
+ ok(sink_comp_class,
+ "bt_plugin_borrow_sink_component_class_by_name_const() finds a sink component class");
+ ok(strcmp(bt_component_class_get_help(bt_component_class_sink_as_component_class_const(sink_comp_class)),
+ "Bacon ipsum dolor amet strip steak cupim pastrami venison shoulder.\n"
+ "Prosciutto beef ribs flank meatloaf pancetta brisket kielbasa drumstick\n"
+ "venison tenderloin cow tail. Beef short loin shoulder meatball, sirloin\n"
+ "ground round brisket salami cupim pork bresaola turkey bacon boudin.\n") == 0,
+ "bt_component_class_get_help() returns the expected help text");
+
+ filter_comp_class = bt_plugin_borrow_filter_component_class_by_name_const(
+ plugin, "filter");
+ ok(filter_comp_class,
+ "bt_plugin_borrow_filter_component_class_by_name_const() finds a filter component class");
+ params = bt_value_signed_integer_create_init(23);
+ BT_ASSERT(params);
+ ret = bt_query_executor_query(query_exec,
+ bt_component_class_filter_as_component_class_const(filter_comp_class),
+ "get-something", params, BT_LOGGING_LEVEL_NONE, &results);
+ ok(ret == 0 && results, "bt_query_executor_query() succeeds");
+ BT_ASSERT(bt_value_is_array(results) && bt_value_array_get_size(results) == 2);
+ object = bt_value_array_borrow_element_by_index_const(results, 0);
+ BT_ASSERT(object && bt_value_is_string(object));
+ object_str = bt_value_string_get(object);
+ ok(strcmp(object_str, "get-something") == 0,
+ "bt_component_class_query() receives the expected object name");
+ res_params = bt_value_array_borrow_element_by_index_const(results, 1);
+ ok(bt_value_compare(res_params, params),
+ "bt_component_class_query() receives the expected parameters");
+
+ bt_component_class_sink_get_ref(sink_comp_class);
+ diag("> putting the plugin set object here");
+ BT_PLUGIN_SET_PUT_REF_AND_RESET(plugin_set);
+ graph = bt_graph_create();
+ BT_ASSERT(graph);
+ graph_ret = bt_graph_add_sink_component(graph, sink_comp_class,
+ "the-sink", NULL, BT_LOGGING_LEVEL_NONE, &sink_component);
+ ok(graph_ret == BT_GRAPH_STATUS_OK && sink_component,
+ "bt_graph_add_sink_component() still works after the plugin object is destroyed");
+ BT_COMPONENT_SINK_PUT_REF_AND_RESET(sink_component);
+ bt_graph_put_ref(graph);
+
+ free(sfs_path);
+ bt_component_class_sink_put_ref(sink_comp_class);
+ bt_value_put_ref(results);
+ bt_value_put_ref(params);
+ bt_query_executor_put_ref(query_exec);
+}
+
+static void test_create_all_from_dir(const char *plugin_dir)
+{
+ const bt_plugin_set *plugin_set;
+ bt_plugin_status status;
+
+ diag("create from all test below");
+
+ status = bt_plugin_find_all_from_dir(NON_EXISTING_PATH, BT_FALSE,
+ BT_FALSE, &plugin_set);
+ ok(status == BT_PLUGIN_STATUS_ERROR,
+ "bt_plugin_find_all_from_dir() fails with an invalid path");
+
+ plugin_set = NULL;
+ status = bt_plugin_find_all_from_dir(plugin_dir, BT_FALSE, BT_FALSE,
+ &plugin_set);
+ ok(status == BT_PLUGIN_STATUS_OK,
+ "bt_plugin_find_all_from_dir() succeeds with a valid path");
+ ok(plugin_set,
+ "bt_plugin_find_all_from_dir() returns a plugin set with a valid path");
+
+ /* 2 or 4, if `.la` files are considered or not */
+ ok(bt_plugin_set_get_plugin_count(plugin_set) == 2 ||
+ bt_plugin_set_get_plugin_count(plugin_set) == 4,
+ "bt_plugin_find_all_from_dir() returns the expected number of plugin objects");
+
+ bt_plugin_set_put_ref(plugin_set);
+}
+
+static void test_find(const char *plugin_dir)
+{
+ int ret;
+ const bt_plugin *plugin;
+ char *plugin_path;
+ bt_plugin_status status;
+
+ ok(bt_plugin_find(NON_EXISTING_PATH, BT_FALSE, &plugin) ==
+ BT_PLUGIN_STATUS_NOT_FOUND,
+ "bt_plugin_find() returns BT_PLUGIN_STATUS_NOT_FOUND with an unknown plugin name");
+ ret = asprintf(&plugin_path, "%s" G_SEARCHPATH_SEPARATOR_S
+ G_DIR_SEPARATOR_S "ec1d09e5-696c-442e-b1c3-f9c6cf7f5958"
+ G_SEARCHPATH_SEPARATOR_S G_SEARCHPATH_SEPARATOR_S
+ G_SEARCHPATH_SEPARATOR_S "%s" G_SEARCHPATH_SEPARATOR_S
+ "8db46494-a398-466a-9649-c765ae077629"
+ G_SEARCHPATH_SEPARATOR_S,
+ NON_EXISTING_PATH, plugin_dir);
+ BT_ASSERT(ret > 0 && plugin_path);
+ g_setenv("BABELTRACE_PLUGIN_PATH", plugin_path, 1);
+ plugin = NULL;
+ status = bt_plugin_find("test_minimal", BT_FALSE, &plugin);
+ ok(status == BT_PLUGIN_STATUS_OK,
+ "bt_plugin_find() succeeds with a plugin name it can find");
+ ok(plugin, "bt_plugin_find() returns a plugin object");
+ ok(strcmp(bt_plugin_get_author(plugin), "Janine Sutto") == 0,
+ "bt_plugin_find() finds the correct plugin for a given name");
+ BT_PLUGIN_PUT_REF_AND_RESET(plugin);
+ free(plugin_path);
+}
+
+int main(int argc, char **argv)
+{
+ int ret;
+ const char *plugin_dir;
+
+ if (argc != 2) {
+ puts("Usage: test_plugin plugin_directory");
+ ret = 1;
+ goto end;
+ }
+
+ plugin_dir = argv[1];
+ plan_tests(NR_TESTS);
+ test_minimal(plugin_dir);
+ test_sfs(plugin_dir);
+ test_create_all_from_dir(plugin_dir);
+ test_find(plugin_dir);
+ ret = exit_status();
+end:
+ return ret;
+}
--- /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
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+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"
+
+"${BT_TESTS_BUILDDIR}/lib/plugin" "${BT_TESTS_BUILDDIR}/lib/test-plugin-plugins/.libs"
+++ /dev/null
-/*
- * 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 as published by
- * the Free Software Foundation; under version 2 of the License.
- *
- * 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.
- */
-
-#include <babeltrace2/babeltrace.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include "common/assert.h"
-#include <glib.h>
-#include "tap/tap.h"
-#include "common.h"
-
-#define NR_TESTS 38
-#define NON_EXISTING_PATH "/this/hopefully/does/not/exist/5bc75f8d-0dba-4043-a509-d7984b97e42b.so"
-
-/* Those symbols are written to by some test plugins */
-static int check_env_var(const char *name)
-{
- const char *val = getenv(name);
-
- if (!val) {
- return -1;
- }
-
- return atoi(val);
-}
-
-static void reset_test_plugin_env_vars(void)
-{
- g_setenv("BT_TEST_PLUGIN_INIT_CALLED", "0", 1);
- g_setenv("BT_TEST_PLUGIN_EXIT_CALLED", "0", 1);
-}
-
-static char *get_test_plugin_path(const char *plugin_dir,
- const char *plugin_name)
-{
- char *ret;
- char *plugin_file_name;
-
- if (asprintf(&plugin_file_name, "plugin-%s." G_MODULE_SUFFIX,
- plugin_name) == -1) {
- abort();
- }
-
- ret = g_build_filename(plugin_dir, plugin_file_name, NULL);
- free(plugin_file_name);
-
- return ret;
-}
-
-static void test_minimal(const char *plugin_dir)
-{
- const bt_plugin_set *plugin_set = NULL;
- const bt_plugin *plugin;
- char *minimal_path = get_test_plugin_path(plugin_dir, "minimal");
- bt_plugin_status status;
-
- BT_ASSERT(minimal_path);
- diag("minimal plugin test below");
-
- reset_test_plugin_env_vars();
- status = bt_plugin_find_all_from_file(minimal_path, BT_FALSE,
- &plugin_set);
- ok(status == BT_PLUGIN_STATUS_OK,
- "bt_plugin_find_all_from_file() succeeds with a valid file");
- ok(plugin_set,
- "bt_plugin_find_all_from_file() returns a plugin set");
- ok(check_env_var("BT_TEST_PLUGIN_INIT_CALLED") == 1,
- "plugin's initialization function is called during bt_plugin_find_all_from_file()");
- ok(bt_plugin_set_get_plugin_count(plugin_set) == 1,
- "bt_plugin_find_all_from_file() returns the expected number of plugins");
- plugin = bt_plugin_set_borrow_plugin_by_index_const(plugin_set, 0);
- ok(strcmp(bt_plugin_get_name(plugin), "test_minimal") == 0,
- "bt_plugin_get_name() returns the expected name");
- ok(strcmp(bt_plugin_get_description(plugin),
- "Minimal Babeltrace plugin with no component classes") == 0,
- "bt_plugin_get_description() returns the expected description");
- ok(bt_plugin_get_version(plugin, NULL, NULL, NULL, NULL) ==
- BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE,
- "bt_plugin_get_version() fails when there's no version");
- ok(strcmp(bt_plugin_get_author(plugin), "Janine Sutto") == 0,
- "bt_plugin_get_author() returns the expected author");
- ok(strcmp(bt_plugin_get_license(plugin), "Beerware") == 0,
- "bt_plugin_get_license() returns the expected license");
- ok(strcmp(bt_plugin_get_path(plugin), minimal_path) == 0,
- "bt_plugin_get_path() returns the expected path");
- ok(bt_plugin_get_source_component_class_count(plugin) == 0,
- "bt_plugin_get_source_component_class_count() returns the expected value");
- ok(bt_plugin_get_filter_component_class_count(plugin) == 0,
- "bt_plugin_get_filter_component_class_count() returns the expected value");
- ok(bt_plugin_get_sink_component_class_count(plugin) == 0,
- "bt_plugin_get_sink_component_class_count() returns the expected value");
- bt_plugin_set_put_ref(plugin_set);
- ok(check_env_var("BT_TEST_PLUGIN_EXIT_CALLED") == 1,
- "plugin's exit function is called when the plugin is destroyed");
-
- free(minimal_path);
-}
-
-static void test_sfs(const char *plugin_dir)
-{
- const bt_plugin_set *plugin_set = NULL;
- const bt_plugin *plugin;
- const bt_component_class_sink *sink_comp_class;
- const bt_component_class_source *source_comp_class;
- const bt_component_class_filter *filter_comp_class;
- const bt_component_sink *sink_component;
- char *sfs_path = get_test_plugin_path(plugin_dir, "sfs");
- unsigned int major, minor, patch;
- const char *extra;
- bt_value *params;
- const bt_value *results;
- const bt_value *object;
- const bt_value *res_params;
- bt_graph *graph;
- const char *object_str;
- bt_graph_status graph_ret;
- bt_query_executor *query_exec = bt_query_executor_create();
- int ret;
- bt_plugin_status status;
-
- BT_ASSERT(query_exec);
- BT_ASSERT(sfs_path);
- diag("sfs plugin test below");
-
- status = bt_plugin_find_all_from_file(sfs_path, BT_FALSE, &plugin_set);
- BT_ASSERT(status == BT_PLUGIN_STATUS_OK && plugin_set &&
- bt_plugin_set_get_plugin_count(plugin_set) == 1);
- plugin = bt_plugin_set_borrow_plugin_by_index_const(plugin_set, 0);
- ok(bt_plugin_get_version(plugin, &major, &minor, &patch, &extra) ==
- BT_PROPERTY_AVAILABILITY_AVAILABLE,
- "bt_plugin_get_version() succeeds when there's a version");
- ok(major == 1,
- "bt_plugin_get_version() returns the expected major version");
- ok(minor == 2,
- "bt_plugin_get_version() returns the expected minor version");
- ok(patch == 3,
- "bt_plugin_get_version() returns the expected patch version");
- ok(strcmp(extra, "yes") == 0,
- "bt_plugin_get_version() returns the expected extra version");
- ok(bt_plugin_get_source_component_class_count(plugin) == 1,
- "bt_plugin_get_source_component_class_count() returns the expected value");
- ok(bt_plugin_get_filter_component_class_count(plugin) == 1,
- "bt_plugin_get_filter_component_class_count() returns the expected value");
- ok(bt_plugin_get_sink_component_class_count(plugin) == 1,
- "bt_plugin_get_sink_component_class_count() returns the expected value");
-
- source_comp_class = bt_plugin_borrow_source_component_class_by_name_const(
- plugin, "source");
- ok(source_comp_class,
- "bt_plugin_borrow_source_component_class_by_name_const() finds a source component class");
-
- sink_comp_class = bt_plugin_borrow_sink_component_class_by_name_const(
- plugin, "sink");
- ok(sink_comp_class,
- "bt_plugin_borrow_sink_component_class_by_name_const() finds a sink component class");
- ok(strcmp(bt_component_class_get_help(bt_component_class_sink_as_component_class_const(sink_comp_class)),
- "Bacon ipsum dolor amet strip steak cupim pastrami venison shoulder.\n"
- "Prosciutto beef ribs flank meatloaf pancetta brisket kielbasa drumstick\n"
- "venison tenderloin cow tail. Beef short loin shoulder meatball, sirloin\n"
- "ground round brisket salami cupim pork bresaola turkey bacon boudin.\n") == 0,
- "bt_component_class_get_help() returns the expected help text");
-
- filter_comp_class = bt_plugin_borrow_filter_component_class_by_name_const(
- plugin, "filter");
- ok(filter_comp_class,
- "bt_plugin_borrow_filter_component_class_by_name_const() finds a filter component class");
- params = bt_value_signed_integer_create_init(23);
- BT_ASSERT(params);
- ret = bt_query_executor_query(query_exec,
- bt_component_class_filter_as_component_class_const(filter_comp_class),
- "get-something", params, BT_LOGGING_LEVEL_NONE, &results);
- ok(ret == 0 && results, "bt_query_executor_query() succeeds");
- BT_ASSERT(bt_value_is_array(results) && bt_value_array_get_size(results) == 2);
- object = bt_value_array_borrow_element_by_index_const(results, 0);
- BT_ASSERT(object && bt_value_is_string(object));
- object_str = bt_value_string_get(object);
- ok(strcmp(object_str, "get-something") == 0,
- "bt_component_class_query() receives the expected object name");
- res_params = bt_value_array_borrow_element_by_index_const(results, 1);
- ok(bt_value_compare(res_params, params),
- "bt_component_class_query() receives the expected parameters");
-
- bt_component_class_sink_get_ref(sink_comp_class);
- diag("> putting the plugin set object here");
- BT_PLUGIN_SET_PUT_REF_AND_RESET(plugin_set);
- graph = bt_graph_create();
- BT_ASSERT(graph);
- graph_ret = bt_graph_add_sink_component(graph, sink_comp_class,
- "the-sink", NULL, BT_LOGGING_LEVEL_NONE, &sink_component);
- ok(graph_ret == BT_GRAPH_STATUS_OK && sink_component,
- "bt_graph_add_sink_component() still works after the plugin object is destroyed");
- BT_COMPONENT_SINK_PUT_REF_AND_RESET(sink_component);
- bt_graph_put_ref(graph);
-
- free(sfs_path);
- bt_component_class_sink_put_ref(sink_comp_class);
- bt_value_put_ref(results);
- bt_value_put_ref(params);
- bt_query_executor_put_ref(query_exec);
-}
-
-static void test_create_all_from_dir(const char *plugin_dir)
-{
- const bt_plugin_set *plugin_set;
- bt_plugin_status status;
-
- diag("create from all test below");
-
- status = bt_plugin_find_all_from_dir(NON_EXISTING_PATH, BT_FALSE,
- BT_FALSE, &plugin_set);
- ok(status == BT_PLUGIN_STATUS_ERROR,
- "bt_plugin_find_all_from_dir() fails with an invalid path");
-
- plugin_set = NULL;
- status = bt_plugin_find_all_from_dir(plugin_dir, BT_FALSE, BT_FALSE,
- &plugin_set);
- ok(status == BT_PLUGIN_STATUS_OK,
- "bt_plugin_find_all_from_dir() succeeds with a valid path");
- ok(plugin_set,
- "bt_plugin_find_all_from_dir() returns a plugin set with a valid path");
-
- /* 2 or 4, if `.la` files are considered or not */
- ok(bt_plugin_set_get_plugin_count(plugin_set) == 2 ||
- bt_plugin_set_get_plugin_count(plugin_set) == 4,
- "bt_plugin_find_all_from_dir() returns the expected number of plugin objects");
-
- bt_plugin_set_put_ref(plugin_set);
-}
-
-static void test_find(const char *plugin_dir)
-{
- int ret;
- const bt_plugin *plugin;
- char *plugin_path;
- bt_plugin_status status;
-
- ok(bt_plugin_find(NON_EXISTING_PATH, BT_FALSE, &plugin) ==
- BT_PLUGIN_STATUS_NOT_FOUND,
- "bt_plugin_find() returns BT_PLUGIN_STATUS_NOT_FOUND with an unknown plugin name");
- ret = asprintf(&plugin_path, "%s" G_SEARCHPATH_SEPARATOR_S
- G_DIR_SEPARATOR_S "ec1d09e5-696c-442e-b1c3-f9c6cf7f5958"
- G_SEARCHPATH_SEPARATOR_S G_SEARCHPATH_SEPARATOR_S
- G_SEARCHPATH_SEPARATOR_S "%s" G_SEARCHPATH_SEPARATOR_S
- "8db46494-a398-466a-9649-c765ae077629"
- G_SEARCHPATH_SEPARATOR_S,
- NON_EXISTING_PATH, plugin_dir);
- BT_ASSERT(ret > 0 && plugin_path);
- g_setenv("BABELTRACE_PLUGIN_PATH", plugin_path, 1);
- plugin = NULL;
- status = bt_plugin_find("test_minimal", BT_FALSE, &plugin);
- ok(status == BT_PLUGIN_STATUS_OK,
- "bt_plugin_find() succeeds with a plugin name it can find");
- ok(plugin, "bt_plugin_find() returns a plugin object");
- ok(strcmp(bt_plugin_get_author(plugin), "Janine Sutto") == 0,
- "bt_plugin_find() finds the correct plugin for a given name");
- BT_PLUGIN_PUT_REF_AND_RESET(plugin);
- free(plugin_path);
-}
-
-int main(int argc, char **argv)
-{
- int ret;
- const char *plugin_dir;
-
- if (argc != 2) {
- puts("Usage: test_plugin plugin_directory");
- ret = 1;
- goto end;
- }
-
- plugin_dir = argv[1];
- plan_tests(NR_TESTS);
- test_minimal(plugin_dir);
- test_sfs(plugin_dir);
- test_create_all_from_dir(plugin_dir);
- test_find(plugin_dir);
- ret = exit_status();
-end:
- return ret;
-}
--- /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
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+NO_SH_TAP=1
+. "/home/mjeanson/Git/lttng/babeltrace/master/tests/utils/common.sh"
+
+curdir="$(cd -P "$(dirname "$0")" >/dev/null && pwd)"
+
+plugin_dir="${curdir}/test-plugin-plugins/.libs"
+
+"${curdir}/test_plugin" "$plugin_dir"
+++ /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
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-NO_SH_TAP=1
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-curdir="$(cd -P "$(dirname "$0")" >/dev/null && pwd)"
-
-plugin_dir="${curdir}/test-plugin-plugins/.libs"
-
-"${curdir}/test_plugin" "$plugin_dir"
--- /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
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+NO_SH_TAP=1
+. "/home/mjeanson/Git/lttng/babeltrace/master/tests/utils/common.sh"
+
+PYTHON_BUILD_DIR="${BT_BUILD_PATH}/src/bindings/python/bt2/build/build_lib"
+TESTS_UTILS_PYTHON_DIR="${BT_SRC_PATH}/tests/utils/python"
+TESTRUNNER_PY="${BT_SRC_PATH}/tests/utils/python/testrunner.py"
+THIS_DIR="${BT_SRC_PATH}/tests/lib/trace-ir"
+
+if [ "x${MSYSTEM}" != "x" ]; then
+ export PATH="${BT_BUILD_PATH}/src/lib/.libs:${PATH}"
+else
+ export LD_LIBRARY_PATH="${BT_BUILD_PATH}/src/lib/.libs:${LD_LIBRARY_PATH}"
+fi
+
+PYTHONPATH="${PYTHON_BUILD_DIR}:${TESTS_UTILS_PYTHON_DIR}" \
+ "/usr/bin/python3" "${TESTRUNNER_PY}" "${THIS_DIR}"
+exit $?
+++ /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
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-NO_SH_TAP=1
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-PYTHON_BUILD_DIR="${BT_BUILD_PATH}/src/bindings/python/bt2/build/build_lib"
-TESTS_UTILS_PYTHON_DIR="${BT_SRC_PATH}/tests/utils/python"
-TESTRUNNER_PY="${BT_SRC_PATH}/tests/utils/python/testrunner.py"
-THIS_DIR="${BT_SRC_PATH}/tests/lib/trace-ir"
-
-if [ "x${MSYSTEM}" != "x" ]; then
- export PATH="${BT_BUILD_PATH}/src/lib/.libs:${PATH}"
-else
- export LD_LIBRARY_PATH="${BT_BUILD_PATH}/src/lib/.libs:${LD_LIBRARY_PATH}"
-fi
-
-PYTHONPATH="${PYTHON_BUILD_DIR}:${TESTS_UTILS_PYTHON_DIR}" \
- "@PYTHON@" "${TESTRUNNER_PY}" "${THIS_DIR}"
-exit $?
LIBTAP=$(top_builddir)/tests/utils/tap/libtap.la
dist_check_SCRIPTS = \
+ test_bin_info_i386-linux-gnu \
+ test_bin_info_powerpc64le-linux-gnu \
+ test_bin_info_powerpc-linux-gnu \
+ test_bin_info_x86_64-linux-gnu \
+ test_dwarf_i386-linux-gnu \
+ test_dwarf_powerpc64le-linux-gnu \
+ test_dwarf_powerpc-linux-gnu \
+ test_dwarf_x86_64-linux-gnu \
+ test_lttng_utils_debug_info \
test_lttng_utils_debug_info.py
noinst_PROGRAMS =
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
+# Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+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"
+
+debug_info_data="${BT_DEBUG_INFO_PATH}/i386-linux-gnu"
+
+"${BT_TESTS_BUILDDIR}/plugins/flt.lttng-utils.debug-info/test_bin_info" \
+ --foo-addr=0x1c8d \
+ --printf-offset=0xda \
+ --printf-lineno=36 \
+ --tp-offset=0x12 \
+ --tp-lineno=35 \
+ --debug-link-crc=0xdeead493 \
+ --debug-info-dir "$debug_info_data" \
+ --build-id cdd98cdd87f7fe64c13b6daad553987eafd40cbb
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
-# Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-NO_SH_TAP=1
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-curdir="$(cd -P "$(dirname "$0")" >/dev/null && pwd)"
-
-debug_info_data="${BT_DEBUG_INFO_PATH}/i386-linux-gnu"
-
-"${curdir}/test_bin_info" \
- --foo-addr=0x1c8d \
- --printf-offset=0xda \
- --printf-lineno=36 \
- --tp-offset=0x12 \
- --tp-lineno=35 \
- --debug-link-crc=0xdeead493 \
- --debug-info-dir "$debug_info_data" \
- --build-id cdd98cdd87f7fe64c13b6daad553987eafd40cbb
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
+# Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+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"
+
+debug_info_data="${BT_DEBUG_INFO_PATH}/powerpc-linux-gnu"
+
+"${BT_TESTS_BUILDDIR}/plugins/flt.lttng-utils.debug-info/test_bin_info" \
+ --foo-addr=0x23bc \
+ --printf-offset=0x114 \
+ --printf-lineno=36 \
+ --tp-offset=0x28 \
+ --tp-lineno=35 \
+ --debug-link-crc=0xd7b98958 \
+ --debug-info-dir "$debug_info_data" \
+ --build-id cdd98cdd87f7fe64c13b6daad553987eafd40cbb
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
-# Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-NO_SH_TAP=1
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-curdir="$(cd -P "$(dirname "$0")" >/dev/null && pwd)"
-
-debug_info_data="${BT_DEBUG_INFO_PATH}/powerpc-linux-gnu"
-
-"${curdir}/test_bin_info" \
- --foo-addr=0x23bc \
- --printf-offset=0x114 \
- --printf-lineno=36 \
- --tp-offset=0x28 \
- --tp-lineno=35 \
- --debug-link-crc=0xd7b98958 \
- --debug-info-dir "$debug_info_data" \
- --build-id cdd98cdd87f7fe64c13b6daad553987eafd40cbb
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
+# Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+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"
+
+debug_info_data="${BT_DEBUG_INFO_PATH}/powerpc64le-linux-gnu"
+
+"${BT_TESTS_BUILDDIR}/plugins/flt.lttng-utils.debug-info/test_bin_info" \
+ --foo-addr=0x2e7c \
+ --printf-offset=0x190 \
+ --printf-lineno=36 \
+ --tp-offset=0x1c \
+ --tp-lineno=35 \
+ --debug-link-crc=0x9b8eb2ff \
+ --debug-info-dir "$debug_info_data" \
+ --build-id cdd98cdd87f7fe64c13b6daad553987eafd40cbb
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
-# Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-NO_SH_TAP=1
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-curdir="$(cd -P "$(dirname "$0")" >/dev/null && pwd)"
-
-debug_info_data="${BT_DEBUG_INFO_PATH}/powerpc64le-linux-gnu"
-
-"${curdir}/test_bin_info" \
- --foo-addr=0x2e7c \
- --printf-offset=0x190 \
- --printf-lineno=36 \
- --tp-offset=0x1c \
- --tp-lineno=35 \
- --debug-link-crc=0x9b8eb2ff \
- --debug-info-dir "$debug_info_data" \
- --build-id cdd98cdd87f7fe64c13b6daad553987eafd40cbb
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
+# Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+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"
+
+debug_info_data="${BT_DEBUG_INFO_PATH}/x86_64-linux-gnu"
+
+"${BT_TESTS_BUILDDIR}/plugins/flt.lttng-utils.debug-info/test_bin_info" \
+ --foo-addr=0x2277 \
+ --printf-offset=0xf0 \
+ --printf-lineno=36 \
+ --tp-offset=0x89 \
+ --tp-lineno=35 \
+ --debug-link-crc=0x289a8fdc \
+ --debug-info-dir "$debug_info_data" \
+ --build-id cdd98cdd87f7fe64c13b6daad553987eafd40cbb
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
-# Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-NO_SH_TAP=1
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-curdir="$(cd -P "$(dirname "$0")" >/dev/null && pwd)"
-
-debug_info_data="${BT_DEBUG_INFO_PATH}/x86_64-linux-gnu"
-
-"${curdir}/test_bin_info" \
- --foo-addr=0x2277 \
- --printf-offset=0xf0 \
- --printf-lineno=36 \
- --tp-offset=0x89 \
- --tp-lineno=35 \
- --debug-link-crc=0x289a8fdc \
- --debug-info-dir "$debug_info_data" \
- --build-id cdd98cdd87f7fe64c13b6daad553987eafd40cbb
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
+# Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+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"
+
+"${BT_TESTS_BUILDDIR}/plugins/flt.lttng-utils.debug-info/test_dwarf" "${BT_DEBUG_INFO_PATH}/i386-linux-gnu"
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
-# Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-NO_SH_TAP=1
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-curdir="$(cd -P "$(dirname "$0")" >/dev/null && pwd)"
-
-debug_info_data="${BT_DEBUG_INFO_PATH}/i386-linux-gnu"
-
-"${curdir}/test_dwarf" "$debug_info_data"
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
+# Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+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"
+
+"${BT_TESTS_BUILDDIR}/plugins/flt.lttng-utils.debug-info/test_dwarf" "${BT_DEBUG_INFO_PATH}/powerpc-linux-gnu"
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
-# Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-NO_SH_TAP=1
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-curdir="$(cd -P "$(dirname "$0")" >/dev/null && pwd)"
-
-debug_info_data="${BT_DEBUG_INFO_PATH}/powerpc-linux-gnu"
-
-"${curdir}/test_dwarf" "$debug_info_data"
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
+# Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+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"
+
+"${BT_TESTS_BUILDDIR}/plugins/flt.lttng-utils.debug-info/test_dwarf" "${BT_DEBUG_INFO_PATH}/powerpc64le-linux-gnu"
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
-# Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-NO_SH_TAP=1
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-curdir="$(cd -P "$(dirname "$0")" >/dev/null && pwd)"
-
-debug_info_data="${BT_DEBUG_INFO_PATH}/powerpc64le-linux-gnu"
-
-"${curdir}/test_dwarf" "$debug_info_data"
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
+# Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+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"
+
+"${BT_TESTS_BUILDDIR}/plugins/flt.lttng-utils.debug-info/test_dwarf" "${BT_DEBUG_INFO_PATH}/x86_64-linux-gnu"
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2015 - Antoine Busque <abusque@efficios.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-NO_SH_TAP=1
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-curdir="$(cd -P "$(dirname "$0")" >/dev/null && pwd)"
-
-debug_info_data="${BT_DEBUG_INFO_PATH}/x86_64-linux-gnu"
-
-"${curdir}/test_dwarf" "$debug_info_data"
--- /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
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+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"
+
+export BT_DEBUG_INFO_PATH
+
+run_python_bt2_test "${BT_TESTS_SRCDIR}/plugins/flt.lttng-utils.debug-info" "test_lttng_utils_debug_info.py"
+++ /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
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-NO_SH_TAP=1
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-PYTHON_BUILD_DIR="${BT_BUILD_PATH}/src/bindings/python/bt2/build/build_lib"
-TESTS_UTILS_PYTHON_DIR="${BT_SRC_PATH}/tests/utils/python"
-TESTRUNNER_PY="${BT_SRC_PATH}/tests/utils/python/testrunner.py"
-THIS_DIR="${BT_SRC_PATH}/tests/plugins"
-export BABELTRACE_PLUGIN_PATH="${BT_BUILD_PATH}/src/plugins/utils:${BT_BUILD_PATH}/src/plugins/ctf:${BT_BUILD_PATH}/src/plugins/lttng-utils"
-export BT_DEBUG_INFO_PATH
-
-if [ "x${MSYSTEM}" != "x" ]; then
- export PATH="${BT_BUILD_PATH}/src/lib/.libs:${PATH}"
-else
- export LD_LIBRARY_PATH="${BT_BUILD_PATH}/src/lib/.libs:${LD_LIBRARY_PATH}"
-fi
-
-PYTHONPATH="${PYTHON_BUILD_DIR}:${TESTS_UTILS_PYTHON_DIR}" \
- "@PYTHON@" "${TESTRUNNER_PY}" "${THIS_DIR}" 'test_lttng_utils_debug_info.py'
-exit $?
SUBDIRS = succeed
+
dist_check_SCRIPTS = \
+ query/test_query \
query/test_query_trace_info.py
--- /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
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+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"
+
+run_python_bt2_test "${BT_TESTS_SRCDIR}/plugins/src.ctf.fs/query"
+++ /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
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-NO_SH_TAP=1
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-TESTRUNNER_PY="$BT_SRC_PATH/tests/utils/python/testrunner.py"
-THIS_DIR="$BT_SRC_PATH/tests/plugins/src.ctf.fs/query"
-
-exec "$BT_BUILD_PATH/tests/utils/test_python_bt2_env" python3 "$TESTRUNNER_PY" "$THIS_DIR"
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2019 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
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# This test validates that a `src.ctf.fs` component successfully reads
+# specific CTF traces and creates the expected messages.
+#
+# Such CTF traces to open either exist (in `tests/ctf-traces/succeed`)
+# or are generated by this test using local trace generators.
+
+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"
+
+this_dir_relative="plugins/src.ctf.fs/succeed"
+this_dir_build="$BT_TESTS_BUILDDIR/$this_dir_relative"
+succeed_trace_dir="$BT_CTF_TRACES_PATH/succeed"
+expect_dir="$BT_TESTS_DATADIR/$this_dir_relative"
+
+test_ctf_common_details_args="-p with-trace-name=no,with-stream-name=no"
+
+test_ctf_gen_single() {
+ name="$1"
+
+ diag "Generating trace '$name'"
+ bt_diff_details_ctf_gen_single "$this_dir_build/gen-trace-$name" \
+ "$expect_dir/trace-$name.expect" \
+ "$test_ctf_common_details_args -p with-uuid=no"
+ ok $? "Generated trace '$name' gives the expected output"
+}
+
+test_ctf_single() {
+ name="$1"
+
+ bt_diff_details_ctf_single "$succeed_trace_dir/$name" \
+ "$expect_dir/trace-$name.expect" "$test_ctf_common_details_args"
+ ok $? "Trace '$name' gives the expected output"
+}
+
+plan_tests 2
+
+test_ctf_gen_single simple
+test_ctf_single smalltrace
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2019 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
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-# This test validates that a `src.ctf.fs` component successfully reads
-# specific CTF traces and creates the expected messages.
-#
-# Such CTF traces to open either exist (in `tests/ctf-traces/succeed`)
-# or are generated by this test using local trace generators.
-
-. "@abs_top_builddir@/tests/utils/diff.sh"
-
-this_dir_relative="tests/plugins/src.ctf.fs/succeed"
-this_dir_src="$BT_SRC_PATH/tests/data/plugins/src.ctf.fs/succeed"
-this_dir_build="$BT_BUILD_PATH/$this_dir_relative"
-succeed_trace_dir="$BT_CTF_TRACES_PATH/succeed"
-
-test_ctf_common_details_args="-p with-trace-name=no,with-stream-name=no"
-
-test_ctf_gen_single() {
- name="$1"
-
- diag "Generating trace '$name'"
- bt_diff_details_ctf_gen_single "$this_dir_build/gen-trace-$name" \
- "$this_dir_src/trace-$name.expect" \
- "$test_ctf_common_details_args -p with-uuid=no"
- ok $? "Generated trace '$name' gives the expected output"
-}
-
-test_ctf_single() {
- name="$1"
-
- bt_diff_details_ctf_single "$succeed_trace_dir/$name" \
- "$this_dir_src/trace-$name.expect" "$test_ctf_common_details_args"
- ok $? "Trace '$name' gives the expected output"
-}
-
-plan_tests 2
-
-test_ctf_gen_single simple
-test_ctf_single smalltrace
htmlcov
.coverage
-test_python_plugin_provider
-test_python_plugin_provider_env
--- /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
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+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"
+
+export PYTHON_PLUGIN_PROVIDER_TEST_PLUGIN_PATH="${BT_TESTS_SRCDIR}/python-plugin-provider/bt_plugin_test_python_plugin_provider.py"
+
+run_python_bt2_test \
+ "${BT_TESTS_SRCDIR}/python-plugin-provider" \
+ test_python_plugin_provider.py \
+ "${BT_TESTS_BUILDDIR}/../src/python-plugin-provider/.libs"
+++ /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
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-NO_SH_TAP=1
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-export PYTHON_PLUGIN_PROVIDER_TEST_PLUGIN_PATH="${BT_SRC_PATH}/tests/python-plugin-provider/bt_plugin_test_python_plugin_provider.py"
-
-PYTHON_BUILD_DIR="${BT_BUILD_PATH}/src/bindings/python/bt2/build/build_lib"
-TESTS_UTILS_PYTHON_DIR="${BT_SRC_PATH}/tests/utils/python"
-TESTRUNNER_PY="${BT_SRC_PATH}/tests/utils/python/testrunner.py"
-THIS_DIR="${BT_SRC_PATH}/tests/python-plugin-provider"
-
-if [ "x${MSYSTEM}" != "x" ]; then
- export PATH="${BT_BUILD_PATH}/src/lib/.libs:${BT_BUILD_PATH}/src/python-plugin-provider/.libs:${PATH}"
-else
- export LD_LIBRARY_PATH="${BT_BUILD_PATH}/src/lib/.libs:${BT_BUILD_PATH}/src/python-plugin-provider/.libs:${LD_LIBRARY_PATH}"
-fi
-
-PYTHONPATH="${PYTHON_BUILD_DIR}:${TESTS_UTILS_PYTHON_DIR}" \
- "@PYTHON@" "${TESTRUNNER_PY}" "${THIS_DIR}"
-exit $?
+++ /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
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-export PYTHON_PLUGIN_PROVIDER_TEST_PLUGIN_PATH="${BT_SRC_PATH}/tests/python-plugin-provider/bt_plugin_test_python_plugin_provider.py"
-
-PYTHON_BUILD_DIR="${BT_BUILD_PATH}/src/bindings/python/bt2/build/build_lib"
-TESTS_UTILS_PYTHON_DIR="${BT_SRC_PATH}/tests/utils/python"
-export PYTHONPATH="${PYTHON_BUILD_DIR}:${TESTS_UTILS_PYTHON_DIR}"
-
-if [ "x${MSYSTEM}" != "x" ]; then
- export PATH="${BT_BUILD_PATH}/src/lib/.libs:${BT_BUILD_PATH}/src/python-plugin-provider/.libs:${PATH}"
-else
- export LD_LIBRARY_PATH="${BT_BUILD_PATH}/src/lib/.libs:${BT_BUILD_PATH}/src/python-plugin-provider/.libs:${LD_LIBRARY_PATH}"
-fi
-
-exec "$*"
+++ /dev/null
-test_python_bt2_env
# Directories added to EXTRA_DIST will be recursively copied to the distribution.
EXTRA_DIST = python
+
+dist_check_SCRIPTS = \
+ run_python_bt2 \
+ utils.sh
+++ /dev/null
-#!/bin/sh
-
-BT_SRC_PATH="@abs_top_srcdir@"
-BT_BUILD_PATH="@abs_top_builddir@"
-
-BT_BIN="${BT_BUILD_PATH}/src/cli/babeltrace2@EXEEXT@"
-BT_CTF_TRACES_PATH="${BT_SRC_PATH}/tests/data/ctf-traces"
-BT_DEBUG_INFO_PATH="${BT_SRC_PATH}/tests/data/debug-info"
-
-if [ "x${NO_SH_TAP}" = x ]; then
- . "${BT_SRC_PATH}/tests/utils/tap/tap.sh"
-fi
+++ /dev/null
-#!/bin/sh
-
-# Copyright (C) 2019 - 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
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-# Checks the difference between:
-#
-# 1. What the CLI outputs when given the arguments "$1" (passed to
-# `xargs`, so they can include quoted arguments).
-# 2. The file with path "$2".
-#
-# Returns 0 if there's no difference, and 1 if there is, also printing
-# said difference to the standard error.
-bt_diff_cli() {
- args="$1"
- expected_file="$2"
- temp_output_file="$(mktemp)"
- temp_diff="$(mktemp)"
-
- # Run the CLI to get a detailed file. Strip any \r present due to
- # Windows (\n -> \r\n). "diff --string-trailing-cr" is not used since it
- # is not present on Solaris.
- echo "$args" | xargs "$BT_BIN" 2>/dev/null | tr -d "\r" > "$temp_output_file"
-
- # Compare output with expected output
- if ! diff "$temp_output_file" "$expected_file" 2>/dev/null >"$temp_diff"; then
- echo "ERROR: for '$args': actual and expected outputs differ:" >&2
- cat "$temp_diff" >&2
- rm -rf "$temp_output_file" "$temp_diff"
- return 1
- fi
-
- rm -f "$temp_output_file" "$temp_diff"
-}
-
-# Checks the difference between:
-#
-# 1. What the CLI outputs when given the arguments:
-#
-# "$1" -c sink.text.details $3
-#
-# 2. The file with path "$2".
-#
-# Parameter 3 is optional.
-#
-# Returns 0 if there's no difference, and 1 if there is, also printing
-# said difference to the standard error.
-bt_diff_details_ctf_single() {
- trace_dir="$1"
- expected_file="$2"
- extra_details_args=""
-
- if [ $# -ge 3 ]; then
- extra_details_args="$3"
- fi
-
- # Compare using the CLI with `sink.text.details`
- bt_diff_cli "\"$trace_dir\" -c sink.text.details $extra_details_args" "$expected_file"
-}
-
-# Calls bt_diff_details_ctf_single(), except that "$1" is the path to a
-# program which generates the CTF trace to compare to. The program "$1"
-# receives the path to a temporary, empty directory where to write the
-# CTF trace as its first argument.
-bt_diff_details_ctf_gen_single() {
- ctf_gen_prog_path="$1"
- expected_file="$2"
- extra_details_args=""
-
- if [ $# -ge 3 ]; then
- extra_details_args="$3"
- fi
-
- temp_trace_dir="$(mktemp -d)"
-
- # Run the CTF trace generator program to get a CTF trace
- if ! "$ctf_gen_prog_path" "$temp_trace_dir" 2>/dev/null; then
- echo "ERROR: \"$ctf_gen_prog_path\" \"$temp_trace_dir\" failed" >&2
- rm -rf "$temp_trace_dir"
- return 1
- fi
-
- # Compare using the CLI with `sink.text.details`
- bt_diff_details_ctf_single "$temp_trace_dir" "$expected_file" "$extra_details_args"
- ret=$?
- rm -rf "$temp_trace_dir"
- return $ret
-}
failfast = args.failfast
tests = loader.discover(start_dir, pattern)
+
+ if tests.countTestCases() < 1:
+ print("No tests matching '%s' found in '%s'" % (pattern, start_dir))
+ sys.exit(1)
+
runner = TAPTestRunner(failfast=failfast)
runner.set_stream(True)
runner.set_format('{method_name}')
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2017 Philippe Proulx <pproulx@efficios.com>
+# 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
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+# Execute a shell command in the appropriate environment to have access to the
+# bt2 Python bindings. For example, one could use it to run a specific Python
+# binding test case with:
+#
+# $ ./run_python_bt2 python3 -m unittest test_values.MapValueTestCase.test_deepcopy
+
+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"
+
+usage() {
+ echo "Usage: run_python_bt2 [PYTHON_BIN] ..."
+ echo ""
+ echo "Run a binary with the python environment set to use the 'bt2' module"
+ echo "from the build system prior to installation."
+ echo ""
+ echo "When building out of tree export the BT_TESTS_BUILDDIR variable with"
+ echo "the path to the built 'tests' directory."
+}
+
+if [ "x$*" = "x" ]; then
+ usage
+else
+ run_python_bt2 "${@}"
+fi
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2017 - Philippe Proulx <pproulx@efficios.com>
-# 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
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-# Execute a shell command in the appropriate environment to have access to the
-# bt2 Python bindings. For example, one could use it to run a specific Python
-# binding test case with:
-#
-# $ ./test_python_bt2_env python3 -m unittest test_values.MapValueTestCase.test_deepcopy
-
-NO_SH_TAP=1
-. "@abs_top_builddir@/tests/utils/common.sh"
-
-export BABELTRACE_PYTHON_BT2_NO_TRACEBACK=1
-export TEST_PLUGIN_PLUGINS_PATH="${BT_BUILD_PATH}/src/plugins"
-export BABELTRACE_PLUGIN_PATH="${BT_BUILD_PATH}/src/plugins/ctf:${BT_BUILD_PATH}/src/plugins/utils:${BT_BUILD_PATH}/src/plugins/text"
-export BT_CTF_TRACES_PATH
-
-PYTHON_BUILD_DIR="${BT_BUILD_PATH}/src/bindings/python/bt2/build/build_lib"
-TESTS_UTILS_PYTHON_DIR="${BT_SRC_PATH}/tests/utils/python"
-export PYTHONPATH="${PYTHON_BUILD_DIR}:${TESTS_UTILS_PYTHON_DIR}"
-
-if [ "x${MSYSTEM}" != "x" ]; then
- export PATH="${BT_BUILD_PATH}/src/lib/.libs:${PATH}"
-else
- export LD_LIBRARY_PATH="${BT_BUILD_PATH}/src/lib/.libs:${LD_LIBRARY_PATH}"
-fi
-
-exec "$@"
--- /dev/null
+#!/bin/bash
+
+# Copyright (c) 2019 Michael Jeanson <mjeanson@efficios.com>
+# Copyright (C) 2019 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 as published by
+# the Free Software Foundation; under version 2 of the License.
+#
+# 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.
+
+# This file is meant to be sourced at the start of shell script-based tests.
+
+
+# Error out when encountering an undefined variable
+set -u
+
+scriptdir="$(dirname "${BASH_SOURCE[0]}")"
+
+# Allow overriding the source and build directories
+if [ "x${BT_TESTS_SRCDIR:-}" = "x" ]; then
+ BT_TESTS_SRCDIR=$(realpath -s "$scriptdir/..")
+fi
+export BT_TESTS_SRCDIR
+
+if [ "x${BT_TESTS_BUILDDIR:-}" = "x" ]; then
+ BT_TESTS_BUILDDIR=$(realpath -s "$scriptdir/..")
+fi
+export BT_TESTS_BUILDDIR
+
+# By default, it will not source tap.sh. If you to tap output directly from
+# the test script, define the 'SH_TAP' variable to '1' before sourcing this
+# script.
+if [ "x${SH_TAP:-}" = x1 ]; then
+ . "${BT_TESTS_SRCDIR}/utils/tap/tap.sh"
+fi
+
+# Allow overriding the babeltrace2 executables
+if [ "x${BT_TESTS_BT2_BIN:-}" = "x" ]; then
+ BT_TESTS_BT2_BIN=$(realpath -s "$BT_TESTS_BUILDDIR/../src/cli/babeltrace2")
+fi
+export BT_TESTS_BT2_BIN
+
+if [ "x${BT_TESTS_BT2LOG_BIN:-}" = "x" ]; then
+ BT_TESTS_BT2LOG_BIN=$(realpath -s "$BT_TESTS_BUILDDIR/../src/cli/babeltrace2-log")
+fi
+export BT_TESTS_BT2LOG_BIN
+
+# TODO: Remove when bindings/python/bt2/test_plugin.py is fixed
+BT_PLUGINS_PATH="${BT_TESTS_BUILDDIR}/../src/plugins"
+
+# Allow overriding the babeltrace2 plugin path
+if [ "x${BT_TESTS_BABELTRACE_PLUGIN_PATH:-}" = "x" ]; then
+ BT_TESTS_BABELTRACE_PLUGIN_PATH="${BT_PLUGINS_PATH}/ctf:${BT_PLUGINS_PATH}/utils:${BT_PLUGINS_PATH}/text"
+fi
+
+# Allow overriding the babeltrace2 executables
+if [ "x${BT_TESTS_PYTHONPATH:-}" = "x" ]; then
+ BT_TESTS_PYTHONPATH="${BT_TESTS_BUILDDIR}/../src/bindings/python/bt2/build/build_lib"
+fi
+
+
+### External Tools ###
+if [ "x${BT_TESTS_AWK_BIN:-}" = "x" ]; then
+ BT_TESTS_AWK_BIN="awk"
+fi
+export BT_TESTS_AWK_BIN
+
+if [ "x${BT_TESTS_GREP_BIN:-}" = "x" ]; then
+ BT_TESTS_GREP_BIN="grep"
+fi
+export BT_TESTS_GREP_BIN
+
+if [ "x${BT_TESTS_PYTHON_BIN:-}" = "x" ]; then
+ BT_TESTS_PYTHON_BIN="python3"
+fi
+export BT_TESTS_PYTHON_BIN
+
+if [ "x${BT_TESTS_SED_BIN:-}" = "x" ]; then
+ BT_TESTS_SED_BIN="sed"
+fi
+export BT_TESTS_SED_BIN
+
+
+# Data files path
+BT_TESTS_DATADIR="${BT_TESTS_SRCDIR}/data"
+BT_CTF_TRACES_PATH="${BT_TESTS_DATADIR}/ctf-traces"
+BT_DEBUG_INFO_PATH="${BT_TESTS_DATADIR}/debug-info"
+
+
+### Diff Functions ###
+
+# Checks the difference between:
+#
+# 1. What the CLI outputs when given the arguments "$1" (passed to
+# `xargs`, so they can include quoted arguments).
+# 2. The file with path "$2".
+#
+# Returns 0 if there's no difference, and 1 if there is, also printing
+# said difference to the standard error.
+bt_diff_cli() {
+ local args="$1"
+ local expected_file="$2"
+ local temp_output_file
+ local temp_diff
+ local ret=0
+
+ temp_output_file="$(mktemp)"
+ temp_diff="$(mktemp)"
+
+ # Run the CLI to get a detailed file. Strip any \r present due to
+ # Windows (\n -> \r\n). "diff --string-trailing-cr" is not used since it
+ # is not present on Solaris.
+ echo "$args" | xargs "$BT_TESTS_BT2_BIN" 2>/dev/null | tr -d "\r" > "$temp_output_file"
+
+ # Compare output with expected output
+ if ! diff "$temp_output_file" "$expected_file" 2>/dev/null >"$temp_diff"; then
+ echo "ERROR: for '$args': actual and expected outputs differ:" >&2
+ cat "$temp_diff" >&2
+ ret=1
+ fi
+
+ rm -f "$temp_output_file" "$temp_diff"
+
+ return $ret
+}
+
+# Checks the difference between:
+#
+# 1. What the CLI outputs when given the arguments:
+#
+# "$1" -c sink.text.details $3
+#
+# 2. The file with path "$2".
+#
+# Parameter 3 is optional.
+#
+# Returns 0 if there's no difference, and 1 if there is, also printing
+# said difference to the standard error.
+bt_diff_details_ctf_single() {
+ local trace_dir="$1"
+ local expected_file="$2"
+ local extra_details_args="${3:-}"
+
+ # Compare using the CLI with `sink.text.details`
+ bt_diff_cli "\"$trace_dir\" -c sink.text.details $extra_details_args" "$expected_file"
+}
+
+# Calls bt_diff_details_ctf_single(), except that "$1" is the path to a
+# program which generates the CTF trace to compare to. The program "$1"
+# receives the path to a temporary, empty directory where to write the
+# CTF trace as its first argument.
+bt_diff_details_ctf_gen_single() {
+ local ctf_gen_prog_path="$1"
+ local expected_file="$2"
+ local extra_details_args="${3:-}"
+
+ local temp_trace_dir
+ local ret
+
+ temp_trace_dir="$(mktemp -d)"
+
+ # Run the CTF trace generator program to get a CTF trace
+ if ! "$ctf_gen_prog_path" "$temp_trace_dir" 2>/dev/null; then
+ echo "ERROR: \"$ctf_gen_prog_path\" \"$temp_trace_dir\" failed" >&2
+ rm -rf "$temp_trace_dir"
+ return 1
+ fi
+
+ # Compare using the CLI with `sink.text.details`
+ bt_diff_details_ctf_single "$temp_trace_dir" "$expected_file" "$extra_details_args"
+ ret=$?
+ rm -rf "$temp_trace_dir"
+ return $ret
+}
+
+
+### Functions ###
+
+check_coverage() {
+ coverage run "$@"
+}
+
+# Execute a shell command in the appropriate environment to have access to the
+# bt2 Python bindings.
+run_python_bt2() {
+ local lib_search_var
+ local lib_search_path
+
+ # Set the library search path so the python interpreter can load libbabeltrace2
+ if [ "x${MSYSTEM:-}" != "x" ]; then
+ lib_search_var="PATH"
+ lib_search_path="${BT_TESTS_BUILDDIR}/../src/lib/.libs:${PATH:-}"
+ else
+ lib_search_var="LD_LIBRARY_PATH"
+ lib_search_path="${BT_TESTS_BUILDDIR}/../src/lib/.libs:${LD_LIBRARY_PATH:-}"
+ fi
+ if [ "x${test_lib_search_path:-}" != "x" ]; then
+ lib_search_path+=":${test_lib_search_path}"
+ fi
+
+ env \
+ BABELTRACE_PYTHON_BT2_NO_TRACEBACK=1 \
+ BABELTRACE_PLUGIN_PATH="${BT_TESTS_BABELTRACE_PLUGIN_PATH}" \
+ BT_CTF_TRACES_PATH="${BT_CTF_TRACES_PATH}" \
+ BT_PLUGINS_PATH="${BT_PLUGINS_PATH}" \
+ PYTHONPATH="${BT_TESTS_PYTHONPATH}:${BT_TESTS_SRCDIR}/utils/python" \
+ "${lib_search_var}"="${lib_search_path}" \
+ "$@"
+}
+
+# Set the environment and run python tests in the directory.
+#
+# $1 : The directory containing the python test scripts
+# $2 : The pattern to match python test script names (optional)
+# $3 : Additionnal library search path (optional)
+run_python_bt2_test() {
+ local test_dir="$1"
+ local test_pattern="${2:-}" # optional
+ local test_lib_search_path="${3:-}" # optional
+
+ local ret
+ local test_runner_args=()
+
+ test_runner_args+=("$test_dir")
+ if [ "x${test_pattern}" != "x" ]; then
+ test_runner_args+=("${test_pattern}")
+ fi
+
+ if test "x${BT_TESTS_COVERAGE:-}" = "x1"; then
+ python_exec="check_coverage"
+ else
+ python_exec="${BT_TESTS_PYTHON_BIN}"
+ fi
+
+ run_python_bt2 \
+ "${python_exec}" \
+ "${BT_TESTS_SRCDIR}/utils/python/testrunner.py" \
+ "${test_runner_args[@]}"
+ ret=$?
+
+ if test "x${BT_TESTS_COVERAGE_REPORT:-}" = "x1"; then
+ coverage report -m
+ fi
+
+ if test "x${BT_TESTS_COVERAGE_HTML:-}" = "x1"; then
+ coverage html
+ fi
+
+ return $ret
+}