Add Babeltrace 2 Python bindings tests
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 4 Feb 2017 03:40:47 +0000 (22:40 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 16:57:37 +0000 (12:57 -0400)
commit9cf643d1c6524358b231b0f143103aabfa3e5773
treec72e3ee56de752aa37e9dae11a0dd2b98c2e70cc
parent81447b5ba52670c15ec17edfb8fa40d17aeb061a
Add Babeltrace 2 Python bindings tests

This patch adds a testing infrastructure for the Python bindings of
Balbetrace, as well as tests for the bt2 package.

To run those tests, you need the tappy Python project
(https://github.com/python-tap/tappy). The configure script checks that
this project is available when you specify the new
--enable-python-bindings-tests option.

A test runner script, tests/utils/python/testrunner.py, loads the test
cases from a directory passed as its first command-line argument, sets
the TAP runner, and runs the tests, exiting with 0 if everything was
successful.

The Python binding tests are in tests/bindings/python/bt2 and are only
executed if the project is configured with --enable-python-bindings.
In this directory, testall.sh is generated from testall.sh.in to
call the test runner script with the appropriate paths, and set the
appropriate PYTHONPATH and LD_LIBRARY_PATH environment variables.

You can run testall.sh directly or with TESTALL_COVERAGE=1 to check the
coverage of the bt2 package with the Python `coverage` tool. You can
also set TESTALL_COVERAGE_HTML=1 to get an HTML report, or
TESTALL_COVERAGE_REPORT=1 to get a plain text report. The .coveragerc
file in this directory is a coverage configuration file which omits
certain files and exclude certain lines. The coverage of most modules
by the the tests is in the 90%-95% range as of this patch:

    __init__.py               100%
    clock_class.py            97%
    component.py              97%
    ctf_writer.py             63%
    event.py                  97%
    event_class.py            98%
    field_types.py            100%
    fields.py                 96%
    notification.py           79%
    notification_iterator.py  91%
    packet.py                 98%
    plugin.py                 30%
    stream.py                 92%
    stream_class.py           97%
    trace.py                  99%
    values.py                 95%

It is expected that ctf_writer.py be tested by the tests of the original
`babeltrace` package which will wrap the bt2 package in a future patch.

test_values.py and test_fields.py test that value and field objects
behave like Python native objects. For this, test methods are generated
to try each possible operator between each possible object. The result
is compared with the same operator applied to native Python objects (or
if the operation raises something, the compared operation must raise the
same thing).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
22 files changed:
configure.ac
m4/check_tappy.m4 [new file with mode: 0644]
tests/Makefile.am
tests/bindings/Makefile.am [new file with mode: 0644]
tests/bindings/python/Makefile.am [new file with mode: 0644]
tests/bindings/python/bt2/.coveragerc [new file with mode: 0644]
tests/bindings/python/bt2/.gitignore [new file with mode: 0644]
tests/bindings/python/bt2/Makefile.am [new file with mode: 0644]
tests/bindings/python/bt2/test_clock_class.py [new file with mode: 0644]
tests/bindings/python/bt2/test_comp_notif_iter.py [new file with mode: 0644]
tests/bindings/python/bt2/test_ctf_writer_clock.py [new file with mode: 0644]
tests/bindings/python/bt2/test_event.py [new file with mode: 0644]
tests/bindings/python/bt2/test_event_class.py [new file with mode: 0644]
tests/bindings/python/bt2/test_field_types.py [new file with mode: 0644]
tests/bindings/python/bt2/test_fields.py [new file with mode: 0644]
tests/bindings/python/bt2/test_packet.py [new file with mode: 0644]
tests/bindings/python/bt2/test_stream.py [new file with mode: 0644]
tests/bindings/python/bt2/test_stream_class.py [new file with mode: 0644]
tests/bindings/python/bt2/test_trace.py [new file with mode: 0644]
tests/bindings/python/bt2/test_values.py [new file with mode: 0644]
tests/bindings/python/bt2/testall.sh.in [new file with mode: 0644]
tests/utils/python/testrunner.py [new file with mode: 0644]
This page took 0.026258 seconds and 4 git commands to generate.