summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/lttng/babeltrace2/external-python-tests.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/lttng/babeltrace2/external-python-tests.patch')
-rw-r--r--meta/recipes-kernel/lttng/babeltrace2/external-python-tests.patch126
1 files changed, 126 insertions, 0 deletions
diff --git a/meta/recipes-kernel/lttng/babeltrace2/external-python-tests.patch b/meta/recipes-kernel/lttng/babeltrace2/external-python-tests.patch
new file mode 100644
index 0000000000..960b33d959
--- /dev/null
+++ b/meta/recipes-kernel/lttng/babeltrace2/external-python-tests.patch
@@ -0,0 +1,126 @@
1From d2f528aa09a9001e63710470f6b700d122494961 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Thu, 14 Aug 2025 12:27:16 -0400
4Subject: [PATCH babeltrace] bindings/python: Allow tests to be run externally
5
6Upstream doesn't officially support running their tests externally. The python
7bindings need some tweaks to work in this configuration.
8
9The patch was created by Michael Jeanson <mjeanson@efficios.com> and is under
10discussion with upstream to see if there is a way to support OE's ue case.
11
12Upstream-Status: Inappropriate [oe specific]
13
14Change-Id: I89555a3fbd821baa7088acc154e81665102286b8
15---
16 .../python/bt2/test_component_descriptor.py | 2 +-
17 tests/bindings/python/bt2/test_graph.py | 2 +-
18 tests/bindings/python/bt2/test_plugin.py | 10 +-
19 .../python/bt2/test_query_executor.py | 2 +-
20 tests/utils/utils.sh | 2 +-
21 6 files changed, 117 insertions(+), 9 deletions(-)
22 create mode 100644 tests/0001-wip-tests-yocto.patch
23
24diff --git a/tests/bindings/python/bt2/test_component_descriptor.py b/tests/bindings/python/bt2/test_component_descriptor.py
25index dcad514eb..49a3c054d 100644
26--- a/tests/bindings/python/bt2/test_component_descriptor.py
27+++ b/tests/bindings/python/bt2/test_component_descriptor.py
28@@ -19,7 +19,7 @@ class ComponentDescriptorTestCase(unittest.TestCase):
29 self._comp_descr = bt2.ComponentDescriptor(_DummySink, {"zoom": -23}, self._obj)
30
31 def _get_comp_cls_from_plugin(self):
32- plugin = bt2.find_plugin("text", find_in_user_dir=False, find_in_sys_dir=False)
33+ plugin = bt2.find_plugin("text", find_in_user_dir=False, find_in_sys_dir=True)
34 assert plugin is not None
35 cc = plugin.source_component_classes["dmesg"]
36 assert cc is not None
37diff --git a/tests/bindings/python/bt2/test_graph.py b/tests/bindings/python/bt2/test_graph.py
38index 9661667a9..7fe247bd9 100644
39--- a/tests/bindings/python/bt2/test_graph.py
40+++ b/tests/bindings/python/bt2/test_graph.py
41@@ -113,7 +113,7 @@ class GraphTestCase(unittest.TestCase):
42 del comp_obj
43
44 def test_add_component_obj_non_python_comp_cls(self):
45- plugin = bt2.find_plugin("text", find_in_user_dir=False, find_in_sys_dir=False)
46+ plugin = bt2.find_plugin("text", find_in_user_dir=False, find_in_sys_dir=True)
47 assert plugin is not None
48 cc = plugin.source_component_classes["dmesg"]
49 assert cc is not None
50diff --git a/tests/bindings/python/bt2/test_plugin.py b/tests/bindings/python/bt2/test_plugin.py
51index 0d7a9e775..39451f93a 100644
52--- a/tests/bindings/python/bt2/test_plugin.py
53+++ b/tests/bindings/python/bt2/test_plugin.py
54@@ -41,7 +41,7 @@ class FindPluginsTestCase(unittest.TestCase):
55 )
56
57 def test_find_none_existing_dir(self):
58- plugins = bt2.find_plugins_in_path(_TEST_PLUGIN_PLUGINS_PATH, recurse=False)
59+ plugins = bt2.find_plugins_in_path(os.environ["BT_TESTS_BUILDDIR"], recurse=False)
60 self.assertIsNone(plugins)
61
62 def test_find_dir(self):
63@@ -53,7 +53,7 @@ class FindPluginsTestCase(unittest.TestCase):
64 os.environ["BT_TESTS_OS_TYPE"], "so"
65 )
66 plugin_name = "babeltrace-plugin-utils.{}".format(extension)
67- path = os.path.join(_TEST_PLUGIN_PLUGINS_PATH, "utils", ".libs", plugin_name)
68+ path = os.path.join(_TEST_PLUGIN_PLUGINS_PATH, plugin_name)
69 pset = bt2.find_plugins_in_path(path)
70 self.assertTrue(len(pset) == 1)
71
72@@ -66,14 +66,14 @@ class FindPluginTestCase(unittest.TestCase):
73 self.assertIsNone(plugin)
74
75 def test_find_existing(self):
76- plugin = bt2.find_plugin("ctf", find_in_user_dir=False, find_in_sys_dir=False)
77+ plugin = bt2.find_plugin("ctf", find_in_user_dir=False, find_in_sys_dir=True)
78 self.assertIsNotNone(plugin)
79
80
81 class PluginTestCase(unittest.TestCase):
82 def setUp(self):
83 self._plugin = bt2.find_plugin(
84- "ctf", find_in_user_dir=False, find_in_sys_dir=False
85+ "ctf", find_in_user_dir=False, find_in_sys_dir=True
86 )
87
88 def tearDown(self):
89@@ -125,7 +125,7 @@ class PluginTestCase(unittest.TestCase):
90 self.assertEqual(plugins["lttng-live"].name, "lttng-live")
91
92 def test_filter_comp_classes_len(self):
93- plugin = bt2.find_plugin("utils", find_in_user_dir=False, find_in_sys_dir=False)
94+ plugin = bt2.find_plugin("utils", find_in_user_dir=False, find_in_sys_dir=True)
95 self.assertEqual(len(plugin.filter_component_classes), 2)
96
97 def test_sink_comp_classes_len(self):
98diff --git a/tests/bindings/python/bt2/test_query_executor.py b/tests/bindings/python/bt2/test_query_executor.py
99index 099457197..9bbfd417a 100644
100--- a/tests/bindings/python/bt2/test_query_executor.py
101+++ b/tests/bindings/python/bt2/test_query_executor.py
102@@ -129,7 +129,7 @@ class QueryExecutorTestCase(unittest.TestCase):
103 del query_method_obj
104
105 def test_query_with_method_obj_non_python_comp_cls(self):
106- plugin = bt2.find_plugin("text", find_in_user_dir=False, find_in_sys_dir=False)
107+ plugin = bt2.find_plugin("text", find_in_user_dir=False, find_in_sys_dir=True)
108 assert plugin is not None
109 cc = plugin.source_component_classes["dmesg"]
110 assert cc is not None
111diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh
112index 28db595d1..05b87f64e 100644
113--- a/tests/utils/utils.sh
114+++ b/tests/utils/utils.sh
115@@ -143,7 +143,7 @@ export BT_TESTS_BT2_BIN
116 # bt_run_in_py_env() to use it.
117 #
118 # TODO: Remove when `tests/bindings/python/bt2/test_plugin.py` is fixed.
119-_bt_tests_plugins_path=$BT_TESTS_BUILDDIR/../src/plugins
120+_bt_tests_plugins_path=/usr/lib/babeltrace2/plugins
121
122 # Colon-separated list of project plugin paths, if not set
123 _bt_tests_set_var_def BT_TESTS_BABELTRACE_PLUGIN_PATH \
124--
1252.47.2
126