From b4610fcb6e4e90b28648679d593a3f8605b861a6 Mon Sep 17 00:00:00 2001 From: o9000 Date: Fri, 29 Dec 2017 14:45:47 +0100 Subject: [PATCH] CI script: remove ANSI color codes --- test/regression.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/regression.py b/test/regression.py index 231306c..7ed5769 100755 --- a/test/regression.py +++ b/test/regression.py @@ -10,6 +10,7 @@ sys.setdefaultencoding('utf8') import argparse import datetime import os +import re import signal import subprocess import time @@ -39,6 +40,10 @@ def print_err(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) +def clear_ansi_codes(s): + return re.sub(r"\x1B\[[0-9;]*[a-zA-Z]", "", s) + + def run(cmd, output=False): return subprocess.Popen(cmd, stdin=devnull, @@ -188,6 +193,7 @@ def test(tint2path, config, use_asan): mem, mem_detail = get_mem_usage(tint2.pid) stop(tint2) out, _ = tint2.communicate() + out = clear_ansi_codes(out) exitcode = tint2.returncode if exitcode != 0 and exitcode != 23: print("tint2 crashed with exit code {0}!".format(exitcode)) @@ -241,6 +247,7 @@ def run_unit_tests(tint2path, use_asan): continue tint2.stop() out, _ = tint2.communicate() + out = clear_ansi_codes(out) exitcode = tint2.returncode if exitcode != 0 and exitcode != 23: print("tint2 crashed with exit code {0}!".format(exitcode))