lib: add bt_plugin_find_all()
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 20 Jul 2019 17:48:17 +0000 (13:48 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 24 Jul 2019 14:33:33 +0000 (10:33 -0400)
commit577fa92f184fd2d75fb0697e879ab563de117c2e
tree5e862a1d49bb96a8c6e051b3159f6bd802247e50
parent9b4f9b425f2efce9a6ccc25f7ae062ebc1116a7d
lib: add bt_plugin_find_all()

This patch adds the public bt_plugin_find_all() function to find all the
plugins found in directories with the standard search order.

The motivation of this patch is to use bt_plugin_find_all() in the CLI
instead of duplicating the search algorithm (see load_all_plugins() in
`babeltrace2-plugins.c`).

bt_plugin_find_all() returns a plugin set. It takes four boolean
parameters to indicate whether or not it must search in:

* The directories specified by the standard environment variable
  (`BABELTRACE_PLUGIN_PATH`).
* The system's plugin directory.
* The user's plugin directory.
* The built-in/static plugins.

All the plugins within a plugin set have unique names. When a plugin is
found in bt_plugin_find_all() and the output plugin set already has a
plugin with this name, it is discarded.

bt_plugin_find() is changed to use bt_plugin_find_all(). It also gains
the four boolean parameters to exclude a specific step of the search
algorithm.

In the `bt2` Python package:

* bt2.find_plugins() is renamed to bt2.find_plugins_in_path().

* bt2.find_plugins() wraps bt_plugin_find_all().

* Optional boolean parameters are added to bt2.find_plugin() to fully
  wrap bt_plugin_find().

In `tests/lib/plugin.c`, `BT_FALSE` is passed to all the directory
exclusion parameters except for `find_in_std_env_var` to isolate the
search within those specific directories, without the system's or user's
plugin directory having an influence on the test.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Icad1387d64d15a639da107ab1ba30e5a53136ced
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1729
Tested-by: jenkins <jenkins@lttng.org>
include/babeltrace2/plugin/plugin-const.h
src/bindings/python/bt2/bt2/native_bt_plugin.i
src/bindings/python/bt2/bt2/plugin.py
src/lib/plugin/plugin.c
src/lib/plugin/plugin.h
tests/bindings/python/bt2/test_plugin.py
tests/lib/plugin.c
tests/python-plugin-provider/test_python_plugin_provider.py
This page took 0.025555 seconds and 4 git commands to generate.