[Piglit] [PATCH] framework: Never redirect sys.stderr to /dev/null.
Jose Fonseca
jfonseca at vmware.com
Mon Dec 7 06:48:07 PST 2015
Awful idea, as it prevents easy debugging/diagnosis of framework issues.
If the test is verbose, then the child process' stderr should be
redirected, and not Python's process.
---
framework/test/base.py | 4 +---
framework/tests/profile_tests.py | 3 ---
framework/tests/run_parser_tests.py | 10 ----------
3 files changed, 1 insertion(+), 16 deletions(-)
diff --git a/framework/test/base.py b/framework/test/base.py
index 6cff2d3..378f185 100644
--- a/framework/test/base.py
+++ b/framework/test/base.py
@@ -185,9 +185,7 @@ class Test(object):
# using it to log exceptions
except:
exc_type, exc_value, exc_traceback = sys.exc_info()
- if sys.platform == 'linux2':
- stderr = open("/dev/stderr", "wt")
- traceback.print_exc(file=stderr)
+ traceback.print_exc(file=sys.stderr)
self.result.result = 'fail'
self.result.exception = "{}{}".format(exc_type, exc_value)
self.result.traceback = "".join(
diff --git a/framework/tests/profile_tests.py b/framework/tests/profile_tests.py
index 3a7d68b..010dbc3 100644
--- a/framework/tests/profile_tests.py
+++ b/framework/tests/profile_tests.py
@@ -31,9 +31,6 @@ from framework.tests import utils
from framework import grouptools, dmesg, profile, exceptions, options
from framework.test import GleanTest
-# Don't print sys.stderr to the console
-sys.stderr = sys.stdout
-
@utils.no_error
def test_initialize_testprofile():
diff --git a/framework/tests/run_parser_tests.py b/framework/tests/run_parser_tests.py
index 5f0b21b..677adfc 100644
--- a/framework/tests/run_parser_tests.py
+++ b/framework/tests/run_parser_tests.py
@@ -156,11 +156,6 @@ class TestBackend(_Helpers):
self._unset_config()
self._move_piglit_conf()
- # This has sideffects, it shouldn't effect anything in this module, but
- # it may cause later problems. But without this we get ugly error spew
- # from this test.
- sys.stderr = open(os.devnull, 'w')
-
with utils.tempdir() as tdir:
with open(os.path.join(tdir, 'piglit.conf'), 'w') as f:
f.write('[core]\nbackend=foobar')
@@ -249,11 +244,6 @@ class TestPlatform(_Helpers):
self._unset_config()
self._move_piglit_conf()
- # This has sideffects, it shouldn't effect anything in this module, but
- # it may cause later problems. But without this we get ugly error spew
- # from this test.
- sys.stderr = open(os.devnull, 'w')
-
with utils.tempdir() as tdir:
with open(os.path.join(tdir, 'piglit.conf'), 'w') as f:
f.write('[core]\nplatform=foobar')
--
2.5.0
More information about the Piglit
mailing list