.clang-tidy: enable cppcoreguidelines-avoid-const-or-ref-data-members Enable: https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/avoid-const-or-ref-data-members.html Set the `AllowMissingMoveFunctionsWhenCopyIsDeleted`, so it's less verbose when you just want to delete everything. Set `AllowSoleDefaultDtor`, because we have legitimate cases (when defining virtual base classes) where we only define a default destructor. Perhaps there's a pitfall I don't see when allowing this? Change-Id: I4a8d20c0be628ac807db4c6b52548e3b7d7ee286 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/12090 Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Add clang-tidy config file Copied from: https://git.lttng.org/?p=lttng-tools.git;a=blob;f=.clang-tidy;h=75f559c5d961041df8e37280ef27cb0cac8cdd96;hb=20c4b46aee1a984bc558b483826c1078f24d35e9 And adapted for Babeltrace: - Define `BT_ASSERT` and `BT_ASSERT_DBG` as assertion macros. - Remove `HeaderFilterRegex`. We might want to use this setting, but I'm not sure what its value would be for Babeltrace. - Fix a . -> , typo Change-Id: I73f1776bc4b7cb1bdc0d5728f9a46b17157088c8 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/12078 Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
flt.utils.muxer: use clock correlation validator Change the clock correlation validation code in `flt.utils.muxer` to use the clock correlation validation library. Change-Id: I5452f530de5fb035f66da5fc6f63bba48711e503 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/11991 Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com> Tested-by: jenkins <jenkins@lttng.org>
flt.utils.muxer: don't reset clock expectation when seeking beginning When seeking the beginning, there is no reason to reset the clock expectations. The clocks seen after a seek beginning should be compatible with those seen before. Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Change-Id: I2ea587ea7b7f62ae509632836ae4364292903001 Reviewed-on: https://review.lttng.org/c/babeltrace/+/12148 Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com> Tested-by: jenkins <jenkins@lttng.org>
cpp-common/bt2c: add `format_as()` functions for `Uuid` and `UuidView` Change-Id: I6530144e78d6aa10dedb320b90a4c208aa572e9d Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/12138 Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com> Tested-by: jenkins <jenkins@lttng.org>
tests/plugins/flt.utils.muxer: add test for clock (in)compatibility cases Add a test for the various clock class incompatibility cases checked by the `MsgIter::_makeSureClkClsIsExpected` method in the `flt.utils.muxer` component class. The scenarios are equivalent to the triggers in `tests/lib/conds/conds-trigger.cpp`, used to test the preconditions in the library. Since the scenarios are equivalent, it would probably be possible to share some code with that file, but I haven't tried it. In essence, for each scenario, the test creates a graph where a muxer component receives two messages with incompatible clock configurations. The test expects that an exception is thrown, and checks whether the root cause contains an expected string. Change-Id: I8bd98fa52719ab2cedb7cbb09310a560b437eb28 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/12005 Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com> Tested-by: jenkins <jenkins@lttng.org>
plugins/common/muxing: compare "origin is Unix epoch" property of clock classes If two clock classes only differ by their "origin is Unix epoch" property, they will compare equal as far as `compare_clock_classes` is concerned. Add a comparison for that. Change-Id: Iecac8fd4aa3064b221291264f4fc6758e32a0943 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/12067 Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com> Tested-by: jenkins <jenkins@lttng.org>
plugins/common/muxing: compare stream class clock classes When comparing two streams and all else is equal about the stream and their classes, compare the clock classes attached to the stream classes. My use case for this is that I'm writing a test where two source components send a stream beginning message to a muxer components. The only difference between the two is the clock classes associated to the stream classes. Some stream classes have an associated clock class, some don't. In other cases, the stream classes differ only by some properties of their clock classes. I want to be sure that the messages will come out of the muxer's priority heap in a stable order. Change-Id: I113704dac4ff952573c3dd96acd33b295425a863 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/12054 Tested-by: jenkins <jenkins@lttng.org> Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
plugins/common/muxing: split `compare_clock_snapshots_and_clock_classes()` A subsequent commit will want to re-use the code to compare two clock classes. Split `compare_clock_snapshots_and_clock_classes()` in two, to make the comparing clock classes part independent from the comparing clock snapshots part. Change-Id: I7888d7d3d1339ccb6c27054919349745cb7875eb Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/12053 Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com> Tested-by: jenkins <jenkins@lttng.org>
sink.utils.counter: remove unnecessary check in counter_consume() Given the lifecycle of a component, I'm pretty sure this condition can never be true. For counter_consume() to be called, counter_graph_is_configured() must execute successfully. If counter_graph_is_configured() executes successfully, `counter->msg_iter` is necessarily set. Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Change-Id: Ibd3cbcfdeefa8d79143e39c6fb846ca5eeebd249 Reviewed-on: https://review.lttng.org/c/babeltrace/+/12010 Tested-by: jenkins <jenkins@lttng.org> Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
sink.utils.dummy: remove unnecessary check in dummy_consume() Given the lifecycle of a component, I'm pretty sure this condition can never be true. For dummy_consume() to be called, dummy_graph_is_configured() must execute successfully. If dummy_graph_is_configured() executes successfully, `dummy->msg_iter` is necessarily set. Change-Id: I5c11c6b76c8cb267f0185c1a35bc2f5e70826509 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/12009 Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com> Tested-by: jenkins <jenkins@lttng.org>
sink.utils.counter: append error cause when call to bt_message_iterator_next()` fails Same as the previous patch, but for the counter component. Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Change-Id: I95f27091512aebc9d01c7b05d98955fdfdcab5da Reviewed-on: https://review.lttng.org/c/babeltrace/+/12008 Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com> Tested-by: jenkins <jenkins@lttng.org>
sink.utils.dummy: append error cause when call to bt_message_iterator_next()` fails I'm looking at some error stacks for a graph involving a dummy component, and I noticed that it did not produce an error cause when failing to consume. I think it would be nice if it did, to avoid having a gap in the error stack. Change-Id: I1b7af3218f9937a21d3dee7406a2b03e122671c6 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/12007 Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com> Tested-by: jenkins <jenkins@lttng.org>
cpp-common/bt2: use universal reference for `Graph::addComponent()` initialization data I noticed it was not possible to pass data to `Graph::addComponent` using a temporary object: graph->addComponent(*srcCompCls, "source-1", TestSourceData {}); My understanding of it is that the compiler does not consider the overload with the `InitDataT&` parameter for this, because the temporary object can't bind to the lvalue reference. Change these methods to take forwarding references instead. Change-Id: Icc80239812c325b777ed83e8634302a0c9d72f14 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/12049 Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com> Tested-by: jenkins <jenkins@lttng.org>
Fix: flt.utils.muxer: reject two different clock classes with unknown origin and no UUID When getting a message with a clock class whose origin is unknown and that has no UUID, the expectation of a `flt.utils.muxer` component should be that all subsequent messages with an associated clock class will have the exact same clock class instance. Currently, it accepts any other clock class instance that has an unknown origin and no UUID. This is a change that is equivalent to what was done in commit 29e191fceb61 ("Fix: lib: strengthen clock expectation check for no Unix epoch / no UUID case") in the library iterator code. When first seeing a clock class with unknown origin and no UUID, make the muxer message iterator save the clock class instance, holding a strong reference, and ensure that all clock classes seen after are the same instance. Change-Id: I676471cc0c3b88a83cd0b452dee8d6b1ed549e4d Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/12044 Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com> Tested-by: jenkins <jenkins@lttng.org>
cpp-common/bt2c: add `CStringView::startsWith` Change-Id: I4a39561085850c06adc1f6e36466fba9a2e6dfa0 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/12011 Tested-by: jenkins <jenkins@lttng.org> Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
cpp-common/bt2: add C++ bindings around `bt_error *` Add C++ bindings to access the error on the current thread. - Take the current thread error with takeCurrentThreadError(), returning a `UniqueConstError`. - Move the current thread error back with moveErrorToCurrentThread(). - Access the error cause by iterating or subscripting `UniqueConstError`, which yields objects of type `ConstErrorCause` (a borrowed object type). - Access the common error cause information using methods of `ConstErrorCause`, including the error cause actor type. - Obtain a more specific error cause object with `ConstErrorCause::as*()`. Change-Id: Ie18e22ef8901bc9c8d7c85432d515ca763b484c2 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/12006 Tested-by: jenkins <jenkins@lttng.org> Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
lib/graph/iterator.c: fix indentation (spaces -> tabs) Change-Id: Ic6b408ef73e54e59161dca18fe19a45285d39c22 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/12123 Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com> Tested-by: jenkins <jenkins@lttng.org>
lib/graph/iterator: use clock correlation validator util Make `graph/iterator.{c,h}` use the clock correlation validator convenience library. - Replace the fields of `struct bt_message_iterator` that track the clock expectation state with a single `struct bt_clock_correlation_validator` field, only present if babeltrace is built in dev mode. - Initialize `bt_message_iterator::correlation_validator` in create_self_component_input_port_message_iterator. Finalize it in `bt_message_iterator_destroy`. - Replace the bulk of `assert_post_dev_clock_classes_are_compatible_one` with one call to `bt_clock_correlation_validator_validate_message`. If the latter returns an error, trigger an assertion failure based on the return error type and associated information. The modifications in the Makefiles (adding `dummy.cpp`) are to force linking with the C++ compiler driver. This is necessary, since the `libbabeltrace2.so` library now requires some symbols from the C++ standard library (e.g. `libstdc++.so`). The `dummy.cpp` does not actually need to exist. This trick is described in the automake doc [1]. [1] https://www.gnu.org/software/automake/manual/automake.html#Libtool-Convenience-Libraries Change-Id: I46a3a553d5e18eb6860d65d928ef33d941e9e951 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-on: https://review.lttng.org/c/babeltrace/+/11990 Tested-by: jenkins <jenkins@lttng.org> Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>