@@ -69,6 +69,10 @@ class PatchtestParser(object):
action='store_true',
help='Enable debug output')
+ parser.add_argument('--quiet', '-q',
+ action='store_true',
+ help='Only output error messages')
+
parser.add_argument('--log-results',
action='store_true',
help='Enable logging to a file matching the target patch name with ".testresult" appended')
@@ -170,7 +170,7 @@ class Metadata(Base):
return tinfoil
os.chdir(builddir)
tinfoil = bb.tinfoil.Tinfoil()
- tinfoil.prepare(config_only=config_only)
+ tinfoil.prepare(config_only=config_only, quiet=2 if PatchtestParser.quiet else 0)
except bb.tinfoil.TinfoilUIException as te:
if tinfoil:
tinfoil.shutdown()
@@ -139,7 +139,7 @@ def _runner(resultklass, prefix=None):
# if there are no test cases, just quit
if not ntc:
return 2
- runner = unittest.TextTestRunner(resultclass=resultklass, verbosity=0)
+ runner = unittest.TextTestRunner(stream=open(os.devnull, 'w') if PatchtestParser.quiet else None, resultclass=resultklass, verbosity=0)
try:
result = runner.run(suite)
@@ -243,6 +243,8 @@ if __name__ == '__main__':
# set debugging level
if PatchtestParser.debug:
logger.setLevel(logging.DEBUG)
+ if PatchtestParser.quiet:
+ logger.setLevel(logging.ERROR)
# if topdir not define, default it to testdir
if not PatchtestParser.topdir: