Add Python plugin provider tests
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 9 Aug 2017 22:24:53 +0000 (18:24 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 18 Aug 2017 18:46:41 +0000 (14:46 -0400)
commit4965530a641ee47a19cec394b990c4d73e1a3f22
treeed4da678e34a7c4d7da5e73c4b07c7d07e8522f8
parent13e4a3e3729d784654d6e84d42aac39fcb71a0fb
Add Python plugin provider tests

This is a simple test for Python plugins. I'm using Python to load
the Python plugin for simplicity, but the C API could load it as well.

This tests both python-plugin-provider/python-plugin-provider.c and
bindings/python/bt2/py_plugin.py.

What happens is this:

1. test.sh executes Python which executes the test
   (test_python_plugin_provider.py).
2. test_python_plugin_provider.py imports the bt2 Python package.
3. The bt2 Python package imports _native_bt.so.
4. _native_bt.so is linked with libbabeltrace.so.
5. libbabeltrace.so, on construction, loads
   libbabeltrace-python-plugin-provider.so.
5. test_python_plugin_provider.py tries to load the Python plugin
   with `bt2.find_plugins()`.
6. `bt2.find_plugins()` calls plugin_create_all_from_file(), which,
   since the path points to a Python file, makes the Python plugin
   provider try to initialize the Python interpreter (already
   initialized by Python in step 1), import the `bt2.py_plugin` module,
   and load the Python file to create a bt_plugin object.

Then the test makes sure that the returned Python plugin object has the
expected properties and component classes.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
configure.ac
tests/Makefile.am
tests/python-plugin-provider/.gitignore [new file with mode: 0644]
tests/python-plugin-provider/Makefile.am [new file with mode: 0644]
tests/python-plugin-provider/bt_plugin_test_python_plugin_provider.py [new file with mode: 0644]
tests/python-plugin-provider/test.sh.in [new file with mode: 0644]
tests/python-plugin-provider/test_python_plugin_provider.py [new file with mode: 0644]
This page took 0.024738 seconds and 4 git commands to generate.