3756
|
|
Add setup.cfg with sensible flake8 configuration
This is a sensible config which allows to run "flake8 ." without having too many useless warnings.
Note that the `per-file-ignores` config requires flake8 >= 3.7.
Ignore:
- E501, line too long, because we don't really care about that (black decides how it's formatted anyway). - W503, line break before bbinary operator, because we don't really care about that (black decides how it's formatted anyway).
__init__.py contains some expectedly unused imports, so it seems cleaner to disable that warning for the whole file, rather than putting a "noqa" comment on each line. Of course, we risk having a really unused import in that file, but it doesn't contain much, so the risk is low.
Finally, exclude the Python tap directory, as it's not our code.
Change-Id: Iebdf274b91907fb31d4ebfa6ae4c8157de46467c Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/2083 Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
|
Simon Marchi |
4 years ago
|
|
|
3755
|
|
|
Simon Marchi |
4 years ago
|
|
|
3754
|
|
|
Jonathan Rajotte |
4 years ago
|
|
|
3753
|
|
|
Simon Marchi |
4 years ago
|
|
|
3752
|
|
|
Simon Marchi |
4 years ago
|
|
|
3751
|
|
bt2: make it work for Python 3.4
The import system from Python 3.4 has some significant differences compared to the one from Python 3.5 and later. Notably, support for circular references (which we use) was added in the later versions.
For example, trace.py and stream.py both import each other. Trace objects need Stream objects when listing streams in a trace, and Stream objects need Trace objects when getting the containing trace of a stream.
To make it work on Python 3.4, I think we need to break any circular import chain that happen when "import bt2" is done. It is fine to import things later, once all the modules have been initialized.
To achieve this, I changed some
from bt2 import foo as bt2_foo
to
def _get_bt2_foo(): from bt2 import foo as bt2_foo return bt2_foo
The users of bt2_foo in that file now need to use _get_bt2_foo() instead of bt2_foo. it is important that _get_bt2_foo doesn't get called during the import of the module, otherwise, we come back to the initial problem. So in some cases, I have wrapped some calls to _get_bt2_foo in properties, as was already done to break circular dependencies between classes.
This is not enough though, as there is another behavior difference between 3.4 and 3.5+, which I believe is also a consequence of the circular import changes [1]. It is also related to the fact that we delete submodule attributes from the bt2 module in our __init__.py.
With 3.5, it is still possible to do:
from bt2 import value
after we've deleted the `value` attribute from bt2. With Python 3.4, it doesn't work. I believe it is related to [1] in that Python 3.5+, when processing a "from" import, searches in sys.modules if a simple getattr on the module failed.
This is problematic for us, since we need the 'from bt2 import "foo"' lines to work after the bt2 attributes have been deleted (to support the changes described above). The solution I've found is to not delete the bt2 submodule attributes when using Python 3.4.
We delete those attributes simply to clean up the bt2 namespace and to avoid exposing the internal organisation of the code. I think it's an acceptable trade-off to not do it when using Python 3.4, if it means that it will actually work.
[1] https://bugs.python.org/issue17636
Change-Id: Ia6810972492a058f60c21e6f22afd43962f4f7a2 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/2082 Tested-by: jenkins <jenkins@lttng.org>
|
Simon Marchi |
4 years ago
|
|
|
3750
|
|
|
Philippe Proulx |
4 years ago
|
|
|
3749
|
|
|
Philippe Proulx |
4 years ago
|
|
|
3748
|
|
|
Philippe Proulx |
4 years ago
|
|
|
3747
|
|
|
Philippe Proulx |
4 years ago
|
|
|
3746
|
|
sink.text.details: don't write `:` after `Packet beginning` without ctx
This patch fixes packet beginning lines which look like:
... Stream (ID 0, Class ID 0)
{Trace 0, Stream class ID 0, Stream ID 0} Packet beginning:
{Trace 0, Stream class ID 0, Stream ID 0} ...
so that they become:
... Stream (ID 0, Class ID 0)
{Trace 0, Stream class ID 0, Stream ID 0} Packet beginning
{Trace 0, Stream class ID 0, Stream ID 0} ...
In other words, the `:` character following `Packet beginning` is useless as there's no (packet context) data following.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com> Change-Id: I4c75bc487c10fa2a4b39708d09d4089887ceabbd Reviewed-on: https://review.lttng.org/c/babeltrace/+/2074 Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com> Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
|
Philippe Proulx |
4 years ago
|
|
|
3745
|
|
|
Philippe Proulx |
4 years ago
|
|
|
3744
|
|
|
Jonathan Rajotte |
4 years ago
|
|
|
3743
|
|
Add LTTng-independent `src.ctf.lttng-live` tests
This patch adds tests for `src.ctf.lttng-live`. It serves as a foundation for future `src.ctf.lttng-live` tests.
Because `src.ctf.lttng-live` needs a running LTTng relay daemon to connect to and because we don't want the Babeltrace tests to depend on LTTng, the new `lttng_live_server.py` script mimics an LTTng relay daemon. The script expects exact commands from an LTTng live viewer and replies with the expected responses. It is mainly a scoped down lttgn-relayd.
The faux server script accepts multiple arguments:
positional arguments: SESSION (for each session) A session configuration. There is no space after comma. Format is: 'NAME,ID,HOSTNAME,FREQ,CLIENTS,TRACEPATH[,TRACEPATH]....'
optional arguments: --log-level {info,warning} (default: warning) The loglevel to be used for the server.
--port-filename PORT_FILENAME (required) The final port file. This file is present when the server is ready to receive connection. This is used to as a synchronization point for the shell test script.
--max-query-data-response-size MAX_QUERY_DATA_RESPONSE_SIZE (optional) The maximum size of control data response in bytes. This is used to force the client to perform multiple requests for the same packet.
The faux server bind to port 0 and get assigned a free port. This prevent unforeseen interaction with the outside world
In the test script, `tests/plugins/src.ctf.lttng-live/test_live`, the execution goes as follow:
1. It runs the faux server, passing two temporary file names, and making it a background job.
2. It waits for the second temporary file to contain anything.
3. It reads the port number from the second temporary file.
4. It runs:
$ babeltrace2 -i lttng-live net://localhost:PORT/[valid path]
where `PORT` is the faux server's port number.
5. It compares the output of 4. to an expected file generated from a template.
6. It removes the temporary files.
The faux server exits itself.
The current tests are: - test_list_sessions List 2 sessions including one with traces for multiple domains. - test_base Attach to the live server and read a standard ust trace with no discarded events. - test_multi_domains Attach and consume a multi-domain trace with discarded events. - test_rate_limited Attach and consume data from a multi packets ust session with no discarded events. Enforce a server side limit on the stream data requests size. - test_compare_to_ctf_fs Attach and consume a multi-domain trace with discarded events and compare it to the same trace read by src.ctf.fs.
Missing tests mostly concerns multiple traces under a same session (per-pid) on listing and reading.
This test only runs if you have a Python interpreter (`HAVE_PYTHON` Automake definition).
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> Change-Id: I2919de3cdfa06eda6f4fcf118689571c13358246 Reviewed-on: https://review.lttng.org/c/babeltrace/+/1915 CI-Build: Francis Deslauriers <francis.deslauriers@efficios.com> Tested-by: jenkins <jenkins@lttng.org> Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
|
Philippe Proulx |
4 years ago
|
|
|
3742
|
|
|
Francis Deslauriers |
4 years ago
|
|
|
3741
|
|
|
Simon Marchi |
4 years ago
|
|
|
3740
|
|
|
Philippe Proulx |
4 years ago
|
|
|
3739
|
|
|
Francis Deslauriers |
4 years ago
|
|
|
3738
|
|
|
Francis Deslauriers |
4 years ago
|
|
|
3737
|
|
|
Francis Deslauriers |
4 years ago
|
|
|