Add basic smoke test for MCAP converter
Grab the latest release of the "mcap" tool, which
includes a validator for MCAP files. Then
write a simple test that generates an AOS log,
converts it to MCAP, and tests that it is correct.
Change-Id: Ia2befa535405de1110810706b76f48782064da32
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/util/mcap_logger.cc b/aos/util/mcap_logger.cc
index 1cb9c32..f4056ea 100644
--- a/aos/util/mcap_logger.cc
+++ b/aos/util/mcap_logger.cc
@@ -3,11 +3,10 @@
#include "absl/strings/str_replace.h"
#include "single_include/nlohmann/json.hpp"
+DEFINE_uint64(mcap_chunk_size, 10000000,
+ "Size, in bytes, of individual MCAP chunks");
+
namespace aos {
-namespace {
-// Amount of data to allow in each chunk before creating a new chunk.
-constexpr size_t kChunkSize = 10000000;
-}
nlohmann::json JsonSchemaForFlatbuffer(const FlatbufferType &type,
JsonSchemaRecursion recursion_level) {
@@ -137,7 +136,8 @@
event_loop_->MakeRawWatcher(
channel, [this, id, channel](const Context &context, const void *) {
WriteMessage(id, channel, context, ¤t_chunk_);
- if (static_cast<uint64_t>(current_chunk_.tellp()) > kChunkSize) {
+ if (static_cast<uint64_t>(current_chunk_.tellp()) >
+ FLAGS_mcap_chunk_size) {
WriteChunk();
}
});