lib: add precondition checks that count of discarded events/packets is greater than 0
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 9 Apr 2020 20:44:07 +0000 (16:44 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 14 Apr 2020 20:03:17 +0000 (16:03 -0400)
commite5a41ca3bf74f80d8decfe22f7916be4566838ec
tree0ffb50897ec369a0668fbe4ed8995b1689a1e721
parent415d43a1b12feae338e910af6d6a1865054c2ef4
lib: add precondition checks that count of discarded events/packets is greater than 0

It does not make sense to send a discarded packet or discarded event
message with the count 0.  That would mean that there is no discarded
event or packet, so the message must simply not be sent.  If the number
of packets or events that were discarded is unknown, the count must not
be set, in which case it will stay "unavailable".

A precondition failure looks like:

    04-12 00:17:25.171 680020 680020 F LIB/MSG-DISCARDED-ITEMS bt_message_discarded_packets_set_count@discarded-items.c:317 Babeltrace 2 library precondition not satisfied; error is:
    04-12 00:17:25.171 680020 680020 F LIB/MSG-DISCARDED-ITEMS bt_message_discarded_packets_set_count@discarded-items.c:317 Discarded packet count is 0.
    04-12 00:17:25.171 680020 680020 F LIB/MSG-DISCARDED-ITEMS bt_message_discarded_packets_set_count@discarded-items.c:317 Aborting...

The equivalent checks are added to the Python bindings, as well as
tests.

Change-Id: I3b56f2635df5d918ec35e9756b0a9658e1a1668d
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3388
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
include/babeltrace2/graph/message.h
src/bindings/python/bt2/bt2/message.py
src/lib/graph/message/discarded-items.c
tests/bindings/python/bt2/test_message.py
This page took 0.026992 seconds and 4 git commands to generate.