Skip to content

Commit ee7cf4a

Browse files
vladimirolteankuba-moo
authored andcommitted
ingest_mdir: introduce --noninteractive option
This is useful for capturing the process' stdout to a pipe, and e.g. emailing it. Before: �[1mynl �[1m Full series �[32mOKAY �[0m Generated files up to date; no warnings/errors; no diff in generated; �[1mmaintainers �[1m Full series �[32mOKAY �[0m No new files, skip �[1mfixes_present �[1m Full series �[32mOKAY �[0m Fixes tag present in non-next series After: ynl Full series OKAY Generated files up to date; no warnings/errors; no diff in generated; maintainers Full series OKAY No new files, skip fixes_present Full series OKAY Fixes tag present in non-next series Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
1 parent b4025ac commit ee7cf4a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

ingest_mdir.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from core import Tester
2828

2929
CONSOLE_WIDTH = None
30+
NONINTERACTIVE = False
3031
BOLD = '\033[1m'
3132
RED = '\033[31m'
3233
GREEN = '\033[32m'
@@ -55,6 +56,8 @@
5556
help='disable test, can be specified multiple times')
5657
parser.add_argument('-t', '--test', nargs='+',
5758
help='run only specified tests. Note: full test name is needed, e.g. "patch/pylint" or "series/ynl" not just "pylint" or "ynl"')
59+
parser.add_argument('--noninteractive', action='store_true',
60+
help='Avoid printing terminal control characters to output which is not a terminal')
5861
parser.add_argument('--dbg-print-run', help='print results of previous run')
5962

6063

@@ -99,7 +102,9 @@ def __print_summary_result(offset, files, full_path):
99102
print(RED + "FAIL " + RESET + f"({retcode})", end='')
100103
failed = True
101104

102-
if failed or (desc and len(desc) + offset > get_console_width()):
105+
wrap_on_width = not NONINTERACTIVE and \
106+
(desc and len(desc) + offset > get_console_width())
107+
if failed or wrap_on_width:
103108
print("\n", end=" ")
104109
if desc:
105110
print("", desc, end='')
@@ -271,6 +276,16 @@ def main():
271276

272277
args = parser.parse_args()
273278

279+
global NONINTERACTIVE
280+
if args.noninteractive:
281+
NONINTERACTIVE = True
282+
global BOLD, RED, GREEN, YELLOW, RESET
283+
BOLD = ''
284+
RED = ''
285+
GREEN = ''
286+
YELLOW = ''
287+
RESET = ''
288+
274289
args.tree = os.path.abspath(args.tree)
275290

276291
if args.test:

0 commit comments

Comments
 (0)