Teach PartsMessageReader to verify out of order
We want to know when a log file doesn't meet our requirements.
PartsMessageReader is a reasonable spot since it knows a lot about log
files.
Add a test while we are here, and also make it so we get max_time back
for the newest timestamp when the log file finishes to make it easy to
read until X happens.
Change-Id: I934f0dffedf023e10596de558dedc79bdc289ff2
diff --git a/aos/events/logging/logfile_utils.cc b/aos/events/logging/logfile_utils.cc
index 6b7a598..d3ace29 100644
--- a/aos/events/logging/logfile_utils.cc
+++ b/aos/events/logging/logfile_utils.cc
@@ -441,10 +441,15 @@
message_reader_.ReadMessage();
if (message) {
newest_timestamp_ = message_reader_.newest_timestamp();
+ const monotonic_clock::time_point monotonic_sent_time(
+ chrono::nanoseconds(message->message().monotonic_sent_time()));
+ CHECK_GE(monotonic_sent_time,
+ newest_timestamp_ - max_out_of_order_duration());
return message;
}
NextLog();
}
+ newest_timestamp_ = monotonic_clock::max_time;
return std::nullopt;
}