Tests: pretty output.
Hide expected alerts by default. Silence succesfull "go build" information.
This commit is contained in:
parent
f67a01b88f
commit
648e91a623
3 changed files with 10 additions and 9 deletions
|
@ -485,14 +485,15 @@ def _check_alerts(*, log=None):
|
||||||
log = f.read()
|
log = f.read()
|
||||||
|
|
||||||
found = False
|
found = False
|
||||||
|
|
||||||
alerts = re.findall(r'.+\[alert\].+', log)
|
alerts = re.findall(r'.+\[alert\].+', log)
|
||||||
|
|
||||||
if alerts:
|
if alerts:
|
||||||
print('\nAll alerts/sanitizer errors found in log:')
|
|
||||||
[print(alert) for alert in alerts]
|
|
||||||
found = True
|
found = True
|
||||||
|
|
||||||
|
if option.detailed:
|
||||||
|
print('\nAll alerts/sanitizer errors found in log:')
|
||||||
|
[print(alert) for alert in alerts]
|
||||||
|
|
||||||
if option.skip_alerts:
|
if option.skip_alerts:
|
||||||
for skip in option.skip_alerts:
|
for skip in option.skip_alerts:
|
||||||
alerts = [al for al in alerts if re.search(skip, al) is None]
|
alerts = [al for al in alerts if re.search(skip, al) is None]
|
||||||
|
@ -504,7 +505,7 @@ def _check_alerts(*, log=None):
|
||||||
|
|
||||||
assert not sanitizer_errors, 'sanitizer error(s)'
|
assert not sanitizer_errors, 'sanitizer error(s)'
|
||||||
|
|
||||||
if found:
|
if found and option.detailed:
|
||||||
print('skipped.')
|
print('skipped.')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,9 @@ replace unit.nginx.org/go => {replace_path}
|
||||||
print("\n$ GOPATH=" + env['GOPATH'] + " " + " ".join(args))
|
print("\n$ GOPATH=" + env['GOPATH'] + " " + " ".join(args))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
process = subprocess.run(args, env=env, cwd=temp_dir)
|
output = subprocess.check_output(
|
||||||
|
args, env=env, cwd=temp_dir, stderr=subprocess.STDOUT
|
||||||
|
)
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise
|
raise
|
||||||
|
@ -75,7 +77,7 @@ replace unit.nginx.org/go => {replace_path}
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return process
|
return output
|
||||||
|
|
||||||
def load(self, script, name='app', **kwargs):
|
def load(self, script, name='app', **kwargs):
|
||||||
static_build = False
|
static_build = False
|
||||||
|
|
|
@ -2,7 +2,5 @@ from unit.applications.lang.go import TestApplicationGo
|
||||||
|
|
||||||
|
|
||||||
def check_go():
|
def check_go():
|
||||||
process = TestApplicationGo.prepare_env('empty')
|
if TestApplicationGo.prepare_env('empty') is not None:
|
||||||
|
|
||||||
if process != None and process.returncode == 0:
|
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue