/tests/lib/test_graph_topo
/tests/plugins/test-utils-muxer
/tests/plugins/test-utils-muxer-complete
+/tests/plugins/test_lttng_utils_debug_info
/tests/plugins/test_bin_info_complete
/tests/plugins/test_bin_info
/tests/plugins/test_dwarf_complete
*.gcda
*.gcov
*.html
-*.stamp
\ No newline at end of file
+*.stamp
AC_CONFIG_FILES([tests/cli/intersection/test_intersection], [chmod +x tests/cli/intersection/test_intersection])
AC_CONFIG_FILES([tests/cli/test_convert_args], [chmod +x tests/cli/test_convert_args])
-AC_CONFIG_FILES([tests/cli/test_debug_info], [chmod +x tests/cli/test_debug_info])
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/lib/test_ctf_writer_complete], [chmod +x tests/lib/test_ctf_writer_complete])
AC_CONFIG_FILES([tests/lib/test_plugin_complete], [chmod +x tests/lib/test_plugin_complete])
AC_CONFIG_FILES([tests/plugins/test-utils-muxer-complete], [chmod +x tests/plugins/test-utils-muxer-complete])
+AC_CONFIG_FILES([tests/plugins/test_lttng_utils_debug_info], [chmod +x tests/plugins/test_lttng_utils_debug_info])
AC_CONFIG_FILES([tests/plugins/test_dwarf_complete], [chmod +x tests/plugins/test_dwarf_complete])
AC_CONFIG_FILES([tests/plugins/test_bin_info_complete], [chmod +x tests/plugins/test_bin_info_complete])
if !ENABLE_BUILT_IN_PLUGINS
TESTS_PLUGINS += plugins/test-utils-muxer-complete
+
+if ENABLE_DEBUG_INFO
+if ENABLE_PYTHON_BINDINGS
+TESTS_PLUGINS += plugins/test_lttng_utils_debug_info
+endif
+endif
endif
if ENABLE_DEBUG_INFO
+++ /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"
-
-DEBUG_INFO_TRACE="${BT_SRC_PATH}/tests/debug-info-data/trace/"
-
-NUM_TESTS=1
-
-plan_tests $NUM_TESTS
-
-"${BT_BIN}" --debug-info-target-prefix "${BT_SRC_PATH}" "${DEBUG_INFO_TRACE}" 2>/dev/null \
- | @GREP@ 'debug_info = { bin = "libhello_so+0x15a6", func = "bar+0xa9", src = "libhello.c:13" }' >/dev/null
-ok $? "Extract debug information"
noinst_PROGRAMS += test-utils-muxer
check_SCRIPTS += test-utils-muxer-complete
-endif
+endif # !ENABLE_BUILT_IN_PLUGINS
if ENABLE_DEBUG_INFO
test_dwarf_LDADD = \
noinst_PROGRAMS += test_dwarf test_bin_info
check_SCRIPTS += test_dwarf_complete test_bin_info_complete
-endif
+
+if !ENABLE_BUILT_IN_PLUGINS
+if ENABLE_PYTHON_BINDINGS
+check_SCRIPTS += test_lttng_utils_debug_info
+endif # !ENABLE_BUILT_IN_PLUGINS
+endif # ENABLE_PYTHON_BINDINGS
+endif # ENABLE_DEBUG_INFO
+
+EXTRA_DIST = 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}/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}/plugins/utils:${BT_BUILD_PATH}/plugins/ctf:${BT_BUILD_PATH}/plugins/lttng-utils"
+export DEBUG_INFO_DATA_DIR="${BT_SRC_PATH}/tests/debug-info-data"
+
+if [ "x${MSYSTEM}" != "x" ]; then
+ export PATH="${BT_BUILD_PATH}/lib/.libs:${PATH}"
+else
+ export LD_LIBRARY_PATH="${BT_BUILD_PATH}/lib/.libs:${LD_LIBRARY_PATH}"
+fi
+
+PYTHONPATH="${PYTHON_BUILD_DIR}:${TESTS_UTILS_PYTHON_DIR}" \
+ "@PYTHON@" "${TESTRUNNER_PY}" "${THIS_DIR}"
+exit $?
--- /dev/null
+import unittest
+import os.path
+import bt2
+import os
+
+
+class LttngUtilsDebugInfoTestCase(unittest.TestCase):
+ def test_debug_info(self):
+ debug_info_data_dir = os.environ['DEBUG_INFO_DATA_DIR']
+ trace_path = os.path.join(debug_info_data_dir, 'trace')
+ target_prefix = os.path.join(debug_info_data_dir, '..', '..')
+ src = bt2.ComponentSpec('ctf', 'fs', trace_path)
+ flt = bt2.ComponentSpec('lttng-utils', 'debug-info', {
+ 'target-prefix': target_prefix,
+ })
+ it = bt2.TraceCollectionNotificationIterator(src, flt,
+ [bt2.EventNotification])
+ notifs = list(it)
+ debug_info = notifs[2].event['debug_info']
+ self.assertEqual(debug_info['bin'], 'libhello_so+0x14d4')
+ self.assertEqual(debug_info['func'], 'foo+0xa9')
+ self.assertEqual(debug_info['src'], 'libhello.c:7')
+ debug_info = notifs[3].event['debug_info']
+ self.assertEqual(debug_info['bin'], 'libhello_so+0x15a6')
+ self.assertEqual(debug_info['func'], 'bar+0xa9')
+ self.assertEqual(debug_info['src'], 'libhello.c:13')