Don't create empty parts when a node doesn't boot

Since we delay writing headers until we have data, we create empty files
for log files with no data.  This means that during normal operation, we
create empty files.  This makes it hard to tell if an empty file is
corrupted, or was empty by "design".

Opening a file is required to be cheap enough that we can instead delay
this operation until we get the first message for a log file.

Another option would be to either delete the file on destruction if
empty, or to write the header unconditionally.  I think not writing the
file keeps things simpler for now.

Change-Id: I58156372fc6b30f143690d86a8b7a18822477ac7
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/events/logging/logger_test.cc b/aos/events/logging/logger_test.cc
index 8cad486..c974511 100644
--- a/aos/events/logging/logger_test.cc
+++ b/aos/events/logging/logger_test.cc
@@ -619,28 +619,20 @@
   std::vector<std::string> MakePi1SingleDirectionLogfiles() {
     std::vector<std::string> result;
     result.emplace_back(logfile_base1_ + "_pi1_data.part0.bfbs");
-    result.emplace_back(logfile_base1_ +
-                        "_pi2_data/test/aos.examples.Pong.part0.bfbs");
+    result.emplace_back(logfile_base1_ + "_pi1_data.part1.bfbs");
     result.emplace_back(
         logfile_base1_ +
         "_pi2_data/pi2/aos/aos.message_bridge.Timestamp.part0.bfbs");
     result.emplace_back(
         absl::StrCat(logfile_base1_, "_", GetParam().sha256, ".bfbs"));
+    return result;
+  }
 
-    if (shared()) {
-      result.emplace_back(logfile_base1_ +
-                          "_timestamps/pi1/aos/remote_timestamps/pi2/"
-                          "aos.message_bridge.RemoteMessage.part0.bfbs");
-    } else {
-      result.emplace_back(logfile_base1_ +
-                          "_timestamps/pi1/aos/remote_timestamps/pi2/pi1/aos/"
-                          "aos-message_bridge-Timestamp/"
-                          "aos.message_bridge.RemoteMessage.part0.bfbs");
-      result.emplace_back(logfile_base1_ +
-                          "_timestamps/pi1/aos/remote_timestamps/pi2/test/"
-                          "aos-examples-Ping/"
-                          "aos.message_bridge.RemoteMessage.part0.bfbs");
-    }
+  std::vector<std::string> MakePi1DeadNodeLogfiles() {
+    std::vector<std::string> result;
+    result.emplace_back(logfile_base1_ + "_pi1_data.part0.bfbs");
+    result.emplace_back(
+        absl::StrCat(logfile_base1_, "_", GetParam().sha256, ".bfbs"));
     return result;
   }
 
@@ -2471,7 +2463,7 @@
 
   // Confirm that we can parse the result.  LogReader has enough internal CHECKs
   // to confirm the right thing happened.
-  ConfirmReadable(pi1_single_direction_logfiles_);
+  ConfirmReadable(MakePi1DeadNodeLogfiles());
 }
 
 constexpr std::string_view kCombinedConfigSha1(