tests: add tests for discarded events/packets creation
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 10 Apr 2020 20:05:25 +0000 (16:05 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 14 Apr 2020 20:00:23 +0000 (16:00 -0400)
commit356ada2b3523dc7f056973111399915153c6294a
tree8677f2e672c3b2c92375c4e0c6e53f9394c1ec25
parentbcc1b6cda412d8ea9ffc70dba6db12028b84a599
tests: add tests for discarded events/packets creation

Creation of these messages is a bit tested in AllMessagesTestCase, but
not everything, especially not the error cases.

To avoid code duplication as much as possible, I've added a
`run_in_message_iterator_next` helper, similar to the existing
`run_in_component_init`.  This helper takes a callback to run in the
context of a source component's message iterator's __next__method.
Individual tests also need to customize the stream class creation, to
decide if the stream class supports discarded event/packet messages,
clock snapshots on those messages, etc.  So it also receives a callback
executed in the source component's __init__ method, which must return a
stream class.  This callback takes a trace class as a parameter, which
it will need to create the stream class, and a clock class.  It is free
to use the clock class as the stream class' default_clock_class or not.

Doing this, I noticed that reading the count and clock snapshot
properties on a _DiscardedEventsMessage didn't work.  This will be fixed
in a subsequent patch, in the mean time the corresponding assertions are
commented out.

Change-Id: I5025d06e6cb5b9d1bbd4372818b391cbc7b5bfa2
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3391
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3402
tests/bindings/python/bt2/test_message.py
tests/bindings/python/bt2/utils.py
This page took 0.0242250000000001 seconds and 4 git commands to generate.