CI script: remove ANSI color codes
This commit is contained in:
parent
eb0e6765f9
commit
b4610fcb6e
1 changed files with 7 additions and 0 deletions
|
@ -10,6 +10,7 @@ sys.setdefaultencoding('utf8')
|
||||||
import argparse
|
import argparse
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import signal
|
import signal
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
@ -39,6 +40,10 @@ def print_err(*args, **kwargs):
|
||||||
print(*args, file=sys.stderr, **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):
|
def run(cmd, output=False):
|
||||||
return subprocess.Popen(cmd,
|
return subprocess.Popen(cmd,
|
||||||
stdin=devnull,
|
stdin=devnull,
|
||||||
|
@ -188,6 +193,7 @@ def test(tint2path, config, use_asan):
|
||||||
mem, mem_detail = get_mem_usage(tint2.pid)
|
mem, mem_detail = get_mem_usage(tint2.pid)
|
||||||
stop(tint2)
|
stop(tint2)
|
||||||
out, _ = tint2.communicate()
|
out, _ = tint2.communicate()
|
||||||
|
out = clear_ansi_codes(out)
|
||||||
exitcode = tint2.returncode
|
exitcode = tint2.returncode
|
||||||
if exitcode != 0 and exitcode != 23:
|
if exitcode != 0 and exitcode != 23:
|
||||||
print("tint2 crashed with exit code {0}!".format(exitcode))
|
print("tint2 crashed with exit code {0}!".format(exitcode))
|
||||||
|
@ -241,6 +247,7 @@ def run_unit_tests(tint2path, use_asan):
|
||||||
continue
|
continue
|
||||||
tint2.stop()
|
tint2.stop()
|
||||||
out, _ = tint2.communicate()
|
out, _ = tint2.communicate()
|
||||||
|
out = clear_ansi_codes(out)
|
||||||
exitcode = tint2.returncode
|
exitcode = tint2.returncode
|
||||||
if exitcode != 0 and exitcode != 23:
|
if exitcode != 0 and exitcode != 23:
|
||||||
print("tint2 crashed with exit code {0}!".format(exitcode))
|
print("tint2 crashed with exit code {0}!".format(exitcode))
|
||||||
|
|
Loading…
Reference in a new issue