Fix: tests: conditionally skip Python bindings test that requires Python plugins...
authorSimon Marchi <simon.marchi@efficios.com>
Sun, 7 Jun 2020 22:54:29 +0000 (18:54 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 1 Nov 2023 20:17:40 +0000 (16:17 -0400)
As exposed by bug 1272 [1], there are some tests in
test_trace_collection_message_iterator.py that depend on Python plugins
being enabled.  Running the tests with `--enable-python-bindings` and
`--disable-python-plugins` therefore leads to these tests failing.

Fix it by skipping them if the support for Python plugins is not
enabled.

[1] https://bugs.lttng.org/issues/1272

Change-Id: I4881a3b0a336b9078715837cb7f8f423bbc2b982
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3621
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
CI-Build: Michael Jeanson <mjeanson@efficios.com>

configure.ac
tests/bindings/python/bt2/test_trace_collection_message_iterator.py
tests/plugins/sink.ctf.fs/test-assume-single-trace.sh
tests/plugins/sink.ctf.fs/test-stream-names.sh
tests/utils/env.sh.in

index c4162d996d64b810ae184bb4c5c93d9fe1e3972b..716c9f4da5fd3154a1bf518b9597a7ee1c9a8ef8 100644 (file)
@@ -514,6 +514,9 @@ AE_IF_FEATURE_ENABLED([built-in-python-plugin-support],
   [AC_DEFINE([BT_BUILT_IN_PYTHON_PLUGIN_SUPPORT], [1], [Define to 1 to register plug-in attributes in static executable sections])]
 )
 
+AE_IF_FEATURE_ENABLED([python-plugins], [ENABLE_PYTHON_PLUGINS=1], [ENABLE_PYTHON_PLUGINS=0])
+AC_SUBST([ENABLE_PYTHON_PLUGINS])
+
 AE_IF_FEATURE_ENABLED([debug-info], [ENABLE_DEBUG_INFO_VAL=1], [ENABLE_DEBUG_INFO_VAL=0])
 AC_SUBST([ENABLE_DEBUG_INFO_VAL])
 
index 84b19cf9583ab63c4936eca39441e9b005f4baef..53d838fc7a99a4783837094c9861208cd7de4d77 100644 (file)
@@ -29,6 +29,7 @@ _AUTO_SOURCE_DISCOVERY_PARAMS_LOG_LEVEL_PATH = os.path.join(
 _METADATA_SYNTAX_ERROR_TRACE_PATH = os.path.join(
     _BT_CTF_TRACES_PATH, "fail", "metadata-syntax-error"
 )
+_BT_ENABLE_PYTHON_PLUGINS = os.environ["BT_TESTS_ENABLE_PYTHON_PLUGINS"] == "1"
 
 
 class _SomeSource(
@@ -407,6 +408,10 @@ class _TestAutoDiscoverSourceComponentSpecs(unittest.TestCase):
         os.environ["BABELTRACE_PLUGIN_PATH"] = self._saved_babeltrace_plugin_path
 
 
+@unittest.skipUnless(
+    _BT_ENABLE_PYTHON_PLUGINS,
+    "Support for Python plugins is disabled",
+)
 class TestAutoDiscoverSourceComponentSpecsGrouping(
     _TestAutoDiscoverSourceComponentSpecs
 ):
@@ -432,6 +437,10 @@ class TestAutoDiscoverSourceComponentSpecsGrouping(
         self.assertEqual(msgs[7].stream.name, "TestSourceSomeDir: some-dir")
 
 
+@unittest.skipUnless(
+    _BT_ENABLE_PYTHON_PLUGINS,
+    "Support for Python plugins is disabled",
+)
 class TestAutoDiscoverSourceComponentSpecsParamsObjLogLevel(
     _TestAutoDiscoverSourceComponentSpecs
 ):
index 69dfb3626c366d4a552d11f71223708b43cef654..37f52707e13a59b896d95942e9515eccbd2a3b89 100755 (executable)
@@ -28,6 +28,11 @@ temp_output_dir=$(mktemp -d)
 
 trace_dir="$temp_output_dir/the-trace"
 
+if [ "$BT_TESTS_ENABLE_PYTHON_PLUGINS" != "1" ]; then
+       plan_skip_all "This test requires the Python plugin provider"
+       exit
+fi
+
 plan_tests 7
 
 bt_cli "$temp_stdout" "$temp_stderr" \
index e5993c7d0e6898657ce97a29c88a34bb422b9f02..e6843769cfaad4d22b4c05075c2b5db8fe9f075c 100755 (executable)
@@ -30,6 +30,11 @@ temp_stderr=$(mktemp)
 temp_output_dir=$(mktemp -d)
 trace_dir="$temp_output_dir/trace"
 
+if [ "$BT_TESTS_ENABLE_PYTHON_PLUGINS" != "1" ]; then
+       plan_skip_all "This test requires the Python plugin provider"
+       exit
+fi
+
 plan_tests 9
 
 bt_cli "$temp_stdout" "$temp_stderr" \
index ab5b47e783714804a7ed747e165cddd328c88cc3..03d4440cf43ac54cb129959bc912d7f115bb9445 100644 (file)
@@ -53,3 +53,9 @@ if [ -z "${BT_TESTS_ENABLE_ASAN:-}" ]; then
        BT_TESTS_ENABLE_ASAN="@ENABLE_ASAN@"
 fi
 export BT_TESTS_ENABLE_ASAN
+
+# Define to 1 to enable tests that depend on the Python plugins support
+if [ -z "${BT_TESTS_ENABLE_PYTHON_PLUGINS:-}" ]; then
+       BT_TESTS_ENABLE_PYTHON_PLUGINS="@ENABLE_PYTHON_PLUGINS@"
+fi
+export BT_TESTS_ENABLE_PYTHON_PLUGINS
This page took 0.027405 seconds and 4 git commands to generate.