Fix test flakiness.

In the Bazel client's file_test, when testing
multi-threaded pipe access, wait for all data to
be written into the pipe.

Pipes are not synchonization primitives in that
read(2) returns immediately, reading as much data
as it can, and won't block if it cannot read as
much as requested. (This is even tested by the
last ASSERT_EQ, trying to read 40 bytes.)

This is however also true for the second ASSERT_EQ
that attempts to read 5 bytes. The Send on the
writer_thread is racing with the Receive on the
main thread (as it should), and sometimes the main
thread wins, resulting in fewer bytes received
than previously expected.

--
PiperOrigin-RevId: 142429243
MOS_MIGRATED_REVID=142429243
diff --git a/src/test/cpp/util/file_test.cc b/src/test/cpp/util/file_test.cc
index 49c52c0..fa379f5 100644
--- a/src/test/cpp/util/file_test.cc
+++ b/src/test/cpp/util/file_test.cc
@@ -41,11 +41,12 @@
     ASSERT_TRUE(pipe.get()->Send(" world", 6));
   });
 
+  // Wait for all data to be fully written to the pipe.
+  writer_thread.join();
+
   ASSERT_EQ(3, pipe.get()->Receive(buffer, 3));
   ASSERT_EQ(5, pipe.get()->Receive(buffer + 3, 5));
   ASSERT_EQ(3, pipe.get()->Receive(buffer + 8, 40));
-  writer_thread.join();
-
   ASSERT_EQ(0, strncmp(buffer, "hello world", 11));
 }