Abort nicely when Rust panics

Change-Id: I1711de2a6ad572c9ae44dd55989a0669da949b1e
Signed-off-by: Brian Silverman <bsilver16384@gmail.com>
diff --git a/aos/events/event_loop_runtime_test.cc b/aos/events/event_loop_runtime_test.cc
index 47e56b8..8557e55 100644
--- a/aos/events/event_loop_runtime_test.cc
+++ b/aos/events/event_loop_runtime_test.cc
@@ -68,4 +68,24 @@
   MakeAndTestApplication(254, &make_typed_test_application);
 }
 
+TEST(EventLoopRustDeathTest, PanicImmediately) {
+  const aos::FlatbufferDetachedBuffer<aos::Configuration> config =
+      aos::configuration::ReadConfig(
+          aos::testing::ArtifactPath("aos/events/pingpong_config.json"));
+  SimulatedEventLoopFactory factory{&config.message()};
+  const auto rust_event_loop = factory.MakeEventLoop("pong");
+  EXPECT_DEATH(make_panic_application(rust_event_loop.get()),
+               "Test Rust panic.*Rust panic, aborting");
+}
+
+TEST(EventLoopRustDeathTest, PanicOnRun) {
+  const aos::FlatbufferDetachedBuffer<aos::Configuration> config =
+      aos::configuration::ReadConfig(
+          aos::testing::ArtifactPath("aos/events/pingpong_config.json"));
+  SimulatedEventLoopFactory factory{&config.message()};
+  const auto rust_event_loop = factory.MakeEventLoop("pong");
+  auto application = make_panic_on_run_application(rust_event_loop.get());
+  EXPECT_DEATH(factory.Run(), "Test Rust panic.*Rust panic, aborting");
+}
+
 }  // namespace aos::events::testing