[Piglit] [PATCH 5/5] framework: Add dummy logger that produces no output
Dylan Baker
baker.dylan.c at gmail.com
Thu Jul 3 13:56:19 PDT 2014
This adds a new logger option that produces no output. This is aimed at
headless setups or for systems like jenkins where the output data isn't
very useful.
Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
framework/log.py | 13 +++++++++++++
framework/programs/run.py | 2 +-
framework/tests/log_tests.py | 3 ++-
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/framework/log.py b/framework/log.py
index 491ab7f..84b6855 100644
--- a/framework/log.py
+++ b/framework/log.py
@@ -208,6 +208,18 @@ class VerboseLog(QuietLog):
super(VerboseLog, self).log(value)
+class DummyLog(BaseLog):
+ """ A Logger that does nothing """
+ def start(self, name):
+ pass
+
+ def log(self, status):
+ pass
+
+ def summary(self):
+ pass
+
+
class LogManager(object):
""" Creates new log objects
@@ -229,6 +241,7 @@ class LogManager(object):
LOG_MAP = {
'quiet': QuietLog,
'verbose': VerboseLog,
+ 'dummy': DummyLog,
}
def __init__(self, logger, total):
diff --git a/framework/programs/run.py b/framework/programs/run.py
index f04fdcf..7685a5a 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -88,7 +88,7 @@ def run(input_):
parser.add_argument("-l", "--log-level",
dest="log_level",
action="store",
- choices=['quiet', 'verbose'],
+ choices=['quiet', 'verbose', 'dummy'],
default='quiet',
help="Set the logger verbosity level")
parser.add_argument("test_profile",
diff --git a/framework/tests/log_tests.py b/framework/tests/log_tests.py
index a71f3ca..9703b11 100644
--- a/framework/tests/log_tests.py
+++ b/framework/tests/log_tests.py
@@ -37,7 +37,8 @@ def test_initialize():
check_initialize = lambda c, *a: c(*a)
for name, class_ in [('QuiteLog', log.QuietLog),
- ('VerboseLog', log.VerboseLog)]:
+ ('VerboseLog', log.VerboseLog),
+ ('DummyLog', log.DummyLog)]:
check_initialize.description = "{} initializes".format(name)
yield check_initialize, class_, TEST_STATE
--
2.0.0
More information about the Piglit
mailing list