Tests: src.ctf.lttng-live: add discarded packets inactivity test
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 2 Jun 2020 15:11:14 +0000 (11:11 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 6 Jun 2020 02:25:20 +0000 (22:25 -0400)
commitb198ef8159e337c13c0d7685e512717fd55ac1c3
treef8d8a1b8f5be9fac784fbad599e515c21e71b8e4
parent71f56e5f59aa8f94f19b4311408ad04cf9519807
Tests: src.ctf.lttng-live: add discarded packets inactivity test

Add a test to ensure that inactivity beacon sent during the
period of a `Discarded packets` message does not violate the
monotonicity guarantees of the graph.

A new indexed trace is added to the test traces. It was generated
by the following source:

    import bt2

    bt2.register_plugin(__name__, "builder")

    class SourceIter(bt2._UserMessageIterator):
        def __init__(self, config, output_port):
            ec = output_port.user_data
            sc = ec.stream_class
            tc = sc.trace_class

            trace = tc()
            stream = trace.create_stream(sc)

            pkt1 = stream.create_packet()
            pkt8 = stream.create_packet()

            self._msgs = [
                self._create_stream_beginning_message(stream),
                self._create_packet_beginning_message(pkt1, default_clock_snapshot=0),
                self._create_event_message(ec, pkt1, default_clock_snapshot=10),
                self._create_packet_end_message(pkt1, default_clock_snapshot=20),

                self._create_discarded_packets_message(stream, 7, 20, 121),

                self._create_packet_beginning_message(pkt8, default_clock_snapshot=121),
                self._create_event_message(ec, pkt8, default_clock_snapshot=133),
                self._create_packet_end_message(pkt8, default_clock_snapshot=140),
                self._create_stream_end_message(stream),
            ]

        def __next__(self):
            if len(self._msgs) > 0:
                return self._msgs.pop(0)
            else:
                raise StopIteration

    @bt2.plugin_component_class
    class Source(bt2._UserSourceComponent, message_iterator_class=SourceIter):
        def __init__(self, config, params, obj):
            tc = self._create_trace_class()
            cc = self._create_clock_class()
            sc = tc.create_stream_class(
                default_clock_class=cc,
                supports_packets=True,
                packets_have_beginning_default_clock_snapshot=True,
                packets_have_end_default_clock_snapshot=True,
                supports_discarded_packets=True,
                discarded_packets_have_default_clock_snapshots=True,
            )
            ec = sc.create_event_class(name="my-event")

            self._add_output_port("some-name", ec)

The index was generated manually.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iebb34b9cf003d94e4c0a4ee4a530f7d7957d8b0d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3613
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
tests/data/ctf-traces/packet_seq_num/7_lost_between_2_with_index/index/stream_0.idx [new file with mode: 0644]
tests/data/ctf-traces/packet_seq_num/7_lost_between_2_with_index/metadata [new file with mode: 0644]
tests/data/ctf-traces/packet_seq_num/7_lost_between_2_with_index/stream_0 [new file with mode: 0644]
tests/data/plugins/src.ctf.lttng-live/inactivity_discarded_packet.expect [new file with mode: 0644]
tests/data/plugins/src.ctf.lttng-live/inactivity_discarded_packet.json [new file with mode: 0644]
tests/plugins/src.ctf.lttng-live/test_live
This page took 0.02496 seconds and 4 git commands to generate.