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>
Mon, 21 Aug 2017 21:02:22 +0000 (17:02 -0400)
commita26f524a62622830e1f01e9e3ccc34ef3d93f8cf
tree65b894a3ed0f64e388b49a135ba8aa91317bf3e6
parent532649275130f62785ea4a2f5c04a9a0b25617a8
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.025115 seconds and 4 git commands to generate.