From 98cfe13c2a3d5184e3c79043c817611edf49f74d Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Tue, 10 Sep 2019 17:21:34 -0400
Subject: DRTVWR-476: Improve llprocess_test.cpp diagnostic output.

If the test<1>() child process terminates with nonzero rc, also report any
stdout/stderr it might have emitted first.
---
 indra/llcommon/tests/llprocess_test.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'indra/llcommon/tests')

diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp
index 222d832084..f0eafa8201 100644
--- a/indra/llcommon/tests/llprocess_test.cpp
+++ b/indra/llcommon/tests/llprocess_test.cpp
@@ -493,14 +493,18 @@ namespace tut
         }
 //      std::cout << "child done: rv = " << rv << " (" << manager.strerror(rv) << "), why = " << why << ", rc = " << rc << '\n';
         aprchk_("apr_proc_wait(wi->child, &wi->rc, &wi->why, APR_NOWAIT)", wi.rv, APR_CHILD_DONE);
-        ensure_equals_(wi.why, APR_PROC_EXIT);
-        ensure_equals_(wi.rc, 0);
 
         // Beyond merely executing all the above successfully, verify that we
         // obtained expected output -- and that we duly got control while
         // waiting, proving the non-blocking nature of these pipes.
         try
         {
+            // Perform these ensure_equals_() within this try/catch so that if
+            // we don't get expected results, we'll dump whatever we did get
+            // to help diagnose.
+            ensure_equals_(wi.why, APR_PROC_EXIT);
+            ensure_equals_(wi.rc, 0);
+
             unsigned i = 0;
             ensure("blocking I/O on child pipe (0)", history[i].tries);
             ensure_equals_(history[i].which, "out");
-- 
cgit v1.2.3