Add LTTng-independent `src.ctf.lttng-live` tests
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 29 Jul 2019 19:53:42 +0000 (15:53 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 24 Sep 2019 19:52:26 +0000 (15:52 -0400)
commit584af91edcbb694c054835c69ff960c5350d0c0e
treeaddef607fbe2c45e13972e8b1e52493c8fe2f0ac
parent1198c63595288e43f354d8cce6db1e69a38d3a20
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>
33 files changed:
tests/Makefile.am
tests/data/ctf-traces/succeed/multi-domains/kernel/index/kernel_channel_0.idx [new file with mode: 0644]
tests/data/ctf-traces/succeed/multi-domains/kernel/index/kernel_channel_1.idx [new file with mode: 0644]
tests/data/ctf-traces/succeed/multi-domains/kernel/index/kernel_channel_2.idx [new file with mode: 0644]
tests/data/ctf-traces/succeed/multi-domains/kernel/index/kernel_channel_3.idx [new file with mode: 0644]
tests/data/ctf-traces/succeed/multi-domains/kernel/kernel_channel_0 [new file with mode: 0644]
tests/data/ctf-traces/succeed/multi-domains/kernel/kernel_channel_1 [new file with mode: 0644]
tests/data/ctf-traces/succeed/multi-domains/kernel/kernel_channel_2 [new file with mode: 0644]
tests/data/ctf-traces/succeed/multi-domains/kernel/kernel_channel_3 [new file with mode: 0644]
tests/data/ctf-traces/succeed/multi-domains/kernel/metadata [new file with mode: 0644]
tests/data/ctf-traces/succeed/multi-domains/ust/index/ust2_channel_0.idx [new file with mode: 0644]
tests/data/ctf-traces/succeed/multi-domains/ust/index/ust2_channel_1.idx [new file with mode: 0644]
tests/data/ctf-traces/succeed/multi-domains/ust/index/ust2_channel_2.idx [new file with mode: 0644]
tests/data/ctf-traces/succeed/multi-domains/ust/index/ust2_channel_3.idx [new file with mode: 0644]
tests/data/ctf-traces/succeed/multi-domains/ust/metadata [new file with mode: 0644]
tests/data/ctf-traces/succeed/multi-domains/ust/ust2_channel_0 [new file with mode: 0644]
tests/data/ctf-traces/succeed/multi-domains/ust/ust2_channel_1 [new file with mode: 0644]
tests/data/ctf-traces/succeed/multi-domains/ust/ust2_channel_2 [new file with mode: 0644]
tests/data/ctf-traces/succeed/multi-domains/ust/ust2_channel_3 [new file with mode: 0644]
tests/data/ctf-traces/succeed/trace-with-index/index/ust_channel_0.idx [new file with mode: 0644]
tests/data/ctf-traces/succeed/trace-with-index/index/ust_channel_1.idx [new file with mode: 0644]
tests/data/ctf-traces/succeed/trace-with-index/index/ust_channel_2.idx [new file with mode: 0644]
tests/data/ctf-traces/succeed/trace-with-index/index/ust_channel_3.idx [new file with mode: 0644]
tests/data/ctf-traces/succeed/trace-with-index/metadata [new file with mode: 0644]
tests/data/ctf-traces/succeed/trace-with-index/ust_channel_0 [new file with mode: 0644]
tests/data/ctf-traces/succeed/trace-with-index/ust_channel_1 [new file with mode: 0644]
tests/data/ctf-traces/succeed/trace-with-index/ust_channel_2 [new file with mode: 0644]
tests/data/ctf-traces/succeed/trace-with-index/ust_channel_3 [new file with mode: 0644]
tests/data/plugins/src.ctf.lttng-live/cli-base.expect [new file with mode: 0644]
tests/data/plugins/src.ctf.lttng-live/cli-list-sessions.expect [new file with mode: 0644]
tests/data/plugins/src.ctf.lttng-live/cli-multi-domains.expect [new file with mode: 0644]
tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py [new file with mode: 0644]
tests/plugins/src.ctf.lttng-live/test_live [new file with mode: 0755]
This page took 0.026108 seconds and 4 git commands to generate.