[tracker] functional-tests: Show stderr output when a subprocess fails



commit c8737630f484291fbb602fba11dd1daa72e5c80c
Author: Sam Thursfield <sam afuera me uk>
Date:   Mon Jul 2 18:26:25 2018 +0200

    functional-tests: Show stderr output when a subprocess fails
    
    Previously it was necessary to set TRACKER_TESTS_VERBOSE in the
    environment in order to see this output, but there's pretty much
    never a situation where you don't want to see stderr when an error
    occurs.

 tests/functional-tests/common/utils/helpers.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/tests/functional-tests/common/utils/helpers.py b/tests/functional-tests/common/utils/helpers.py
index 63605e55c..b4c02b331 100644
--- a/tests/functional-tests/common/utils/helpers.py
+++ b/tests/functional-tests/common/utils/helpers.py
@@ -87,7 +87,7 @@ class Helper:
 
         if not options.is_verbose ():
             FNULL = open ('/dev/null', 'w')
-            kws = { 'stdout': FNULL, 'stderr': FNULL }
+            kws = { 'stdout': FNULL, 'stderr': subprocess.PIPE }
 
         command = [path] + flags
         log ("Starting %s" % ' '.join(command))
@@ -120,7 +120,8 @@ class Helper:
             return True    # continue
         else:
             self.process_watch_timeout = 0
-            raise Exception("%s exited with status: %i" % (self.PROCESS_NAME, status))
+            error = self.process.stderr.read()
+            raise RuntimeError("%s exited with status: %i\n%s" % (self.PROCESS_NAME, status, error))
 
     def _timeout_on_idle_cb (self):
         log ("[%s] Timeout waiting... asumming idle." % self.PROCESS_NAME)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]