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>
* without a UUID.
*/
_mClkClsExpectation = _ClkClsExpectation::ORIG_ISNT_UNIX_EPOCH_AND_NO_UUID;
* without a UUID.
*/
_mClkClsExpectation = _ClkClsExpectation::ORIG_ISNT_UNIX_EPOCH_AND_NO_UUID;
+ _mExpectedClkCls = clkCls->shared();
break;
case _ClkClsExpectation::ORIG_ISNT_UNIX_EPOCH_AND_NO_UUID:
BT_ASSERT_DBG(!_mExpectedClkClsUuid);
break;
case _ClkClsExpectation::ORIG_ISNT_UNIX_EPOCH_AND_NO_UUID:
BT_ASSERT_DBG(!_mExpectedClkClsUuid);
+ BT_ASSERT_DBG(_mExpectedClkCls);
- if (clkCls->originIsUnixEpoch()) {
+ if (clkCls->libObjPtr() != _mExpectedClkCls->libObjPtr()) {
BT_CPPLOGE_APPEND_CAUSE_AND_THROW(
bt2::Error,
BT_CPPLOGE_APPEND_CAUSE_AND_THROW(
bt2::Error,
- "Expecting a clock class not having a Unix epoch origin, "
- "but got one having a Unix epoch origin: "
- "clock-class-addr={}, clock-class-name={}",
+ "Unexpected clock class: "
+ "expected-clock-class-addr={}, expected-clock-class-name={}, "
+ "actual-clock-class-addr={}, actual-clock-class-name={}",
+ fmt::ptr(_mExpectedClkCls->libObjPtr()), optLogStr(_mExpectedClkCls->name()),
clkClsAddr, optLogStr(clkCls->name()));
}
clkClsAddr, optLogStr(clkCls->name()));
}
- if (clkCls->uuid()) {
- BT_CPPLOGE_APPEND_CAUSE_AND_THROW(
- bt2::Error,
- "Expecting a clock class without a UUID, but got one with a UUID: "
- "clock-class-addr={}, clock-class-name={}, uuid={}",
- clkClsAddr, optLogStr(clkCls->name()), clkCls->uuid()->str());
- }
-
break;
case _ClkClsExpectation::ORIG_ISNT_UNIX_EPOCH_AND_SPEC_UUID:
BT_ASSERT_DBG(_mExpectedClkClsUuid);
break;
case _ClkClsExpectation::ORIG_ISNT_UNIX_EPOCH_AND_SPEC_UUID:
BT_ASSERT_DBG(_mExpectedClkClsUuid);
+ BT_ASSERT_DBG(!_mExpectedClkCls);
if (clkCls->originIsUnixEpoch()) {
BT_CPPLOGE_APPEND_CAUSE_AND_THROW(
if (clkCls->originIsUnixEpoch()) {
BT_CPPLOGE_APPEND_CAUSE_AND_THROW(
*
* For `ORIG_ISNT_UNIX_EPOCH_AND_SPEC_UUID`, `*_mExpectedClkClsUuid`
* is the expected specific UUID.
*
* For `ORIG_ISNT_UNIX_EPOCH_AND_SPEC_UUID`, `*_mExpectedClkClsUuid`
* is the expected specific UUID.
+ *
+ * For `ORIG_ISNT_UNIX_EPOCH_AND_NO_UUID`, `_mExpectedClkCls` is the
+ * expected clock class.
*/
_ClkClsExpectation _mClkClsExpectation = _ClkClsExpectation::ANY;
bt2s::optional<bt2c::Uuid> _mExpectedClkClsUuid;
*/
_ClkClsExpectation _mClkClsExpectation = _ClkClsExpectation::ANY;
bt2s::optional<bt2c::Uuid> _mExpectedClkClsUuid;
+ bt2::ConstClockClass::Shared _mExpectedClkCls;
};
} /* namespace bt2mux */
};
} /* namespace bt2mux */