This is a solution for the issue #554.

Since we have to do a bunch of hacks to supress stdout,
it's not possible to use conveniently, for example, the
python debugger to debug your test code. By adding a
configuration option to the StreamProxy class constructor,
allow full stdout output in case the --verbose option
was passed to the run program.

Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
 run | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/run b/run
index e4ad3b1..50743fe 100755
--- a/run
+++ b/run
@@ -17,7 +17,10 @@ class StreamProxy(object):
         Keep 2 streams to write to, and eventually switch.
         """
         self.terminal = stream
-        self.log = open(filename, "a")
+        if filename is None:
+            self.log = stream
+        else:
+            self.log = open(filename, "a")
         self.stream = self.log
 
     def write(self, message):
@@ -70,10 +73,12 @@ if __name__ == '__main__':
         finally:
             os.close(out_fd)
         sys.stderr = os.fdopen(2, 'w')
-
-    # Replace stdout by our StreamProxy object, so we can supress all output
-    # but the one we specifically want.
-    sys.stdout = StreamProxy(stream=sys.stdout)
+        # Replace stdout by our StreamProxy object, so we can supress all 
output
+        # but the one we specifically want.
+        sys.stdout = StreamProxy(filename="/dev/null", stream=sys.stdout)
+    else:
+        # We have full stdout output
+        sys.stdout = StreamProxy(filename=None, stream=sys.stdout)
 
     try:
         from autotest.client import setup_modules
-- 
1.7.11.4

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to