Handle test failure better

Send the VM's console & log to logcat; ditto the output produced by
the payload.

Fix some missing \n in the payload (we wait for the \n before sending
to logcat).

Abort instead of ignoring a failure to send onPayloadReady; this
causes the test to fail fast (and produce a tombstone!) rather than
waiting until the 5 minute timeout expires.

Bug: 232403335
Test: atest MicrodroidTests

Change-Id: Ia499e527d45cb1383e5db3faab3de7b09c9a8d04
diff --git a/tests/testapk/src/native/testbinary.cpp b/tests/testapk/src/native/testbinary.cpp
index 89570c0..9493fc7 100644
--- a/tests/testapk/src/native/testbinary.cpp
+++ b/tests/testapk/src/native/testbinary.cpp
@@ -134,16 +134,18 @@
 
     auto callback = []([[maybe_unused]] void* param) {
         // Tell microdroid_manager that we're ready.
-        // Failing to notify is not a fatal error; the payload can continue.
+        // If we can't, abort in order to fail fast - the host won't proceed without
+        // receiving the onReady signal.
         ndk::SpAIBinder binder(
                 RpcClient(VMADDR_CID_HOST, IVirtualMachineService::VM_BINDER_SERVICE_PORT));
         auto virtualMachineService = IVirtualMachineService::fromBinder(binder);
         if (virtualMachineService == nullptr) {
-            std::cerr << "failed to connect VirtualMachineService";
-            return;
+            std::cerr << "failed to connect VirtualMachineService\n";
+            abort();
         }
         if (!virtualMachineService->notifyPayloadReady().isOk()) {
-            std::cerr << "failed to notify payload ready to virtualizationservice";
+            std::cerr << "failed to notify payload ready to virtualizationservice\n";
+            abort();
         }
     };
 
@@ -197,7 +199,7 @@
     if (auto res = start_test_service(); res.ok()) {
         return 0;
     } else {
-        std::cerr << "starting service failed: " << res.error();
+        std::cerr << "starting service failed: " << res.error() << "\n";
         return 1;
     }
 }