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/generate_test_log.cc b/aos/util/generate_test_log.cc
new file mode 100644
index 0000000..7338af8
--- /dev/null
+++ b/aos/util/generate_test_log.cc
@@ -0,0 +1,38 @@
+#include "aos/configuration.h"
+#include "aos/events/logging/log_writer.h"
+#include "aos/init.h"
+#include "aos/json_to_flatbuffer.h"
+#include "gflags/gflags.h"
+#include "aos/testing/path.h"
+#include "aos/events/ping_lib.h"
+#include "aos/events/pong_lib.h"
+
+DEFINE_string(output_folder, "", "Name of folder to write the generated logfile to.");
+
+int main(int argc, char **argv) {
+ aos::InitGoogle(&argc, &argv);
+
+ const aos::FlatbufferDetachedBuffer<aos::Configuration> config =
+ aos::configuration::ReadConfig(
+ aos::testing::ArtifactPath("aos/events/pingpong_config.json"));
+
+ aos::SimulatedEventLoopFactory event_loop_factory(&config.message());
+
+ // Event loop and app for Ping
+ std::unique_ptr<aos::EventLoop> ping_event_loop =
+ event_loop_factory.MakeEventLoop("ping");
+ aos::Ping ping(ping_event_loop.get());
+
+ // Event loop and app for Pong
+ std::unique_ptr<aos::EventLoop> pong_event_loop =
+ event_loop_factory.MakeEventLoop("pong");
+ aos::Pong pong(pong_event_loop.get());
+
+ std::unique_ptr<aos::EventLoop> log_writer_event_loop =
+ event_loop_factory.MakeEventLoop("log_writer");
+ aos::logger::Logger writer(log_writer_event_loop.get());
+ writer.StartLoggingOnRun(FLAGS_output_folder);
+
+ event_loop_factory.RunFor(std::chrono::seconds(10));
+ return 0;
+}