Merge "Make output from check_logs less verbose"

This commit is contained in:
Jenkins 2014-09-20 07:32:35 +00:00 committed by Gerrit Code Review
commit cc6ca0d184

View File

@ -80,7 +80,6 @@ def process_files(file_specs, url_specs, whitelists):
def scan_content(name, content, regexp, whitelist): def scan_content(name, content, regexp, whitelist):
had_errors = False had_errors = False
print_log_name = True
for line in content: for line in content:
if not line.startswith("Stderr:") and regexp.match(line): if not line.startswith("Stderr:") and regexp.match(line):
whitelisted = False whitelisted = False
@ -91,13 +90,8 @@ def scan_content(name, content, regexp, whitelist):
whitelisted = True whitelisted = True
break break
if not whitelisted or dump_all_errors: if not whitelisted or dump_all_errors:
if print_log_name:
print("\nLog File Has Errors: %s" % name)
print_log_name = False
if not whitelisted: if not whitelisted:
had_errors = True had_errors = True
print("*** Not Whitelisted ***"),
print(line.rstrip())
return had_errors return had_errors
@ -151,17 +145,21 @@ def main(opts):
whitelists = loaded whitelists = loaded
logs_with_errors = process_files(files_to_process, urls_to_process, logs_with_errors = process_files(files_to_process, urls_to_process,
whitelists) whitelists)
if logs_with_errors:
print("Logs have errors")
if is_grenade:
print("Currently not failing grenade runs with errors")
return 0
failed = False failed = False
for log in logs_with_errors: if logs_with_errors:
if log not in allowed_dirty: log_files = set(logs_with_errors)
print("Log: %s not allowed to have ERRORS or TRACES" % log) for log in log_files:
failed = True msg = '%s log file has errors' % log
if log not in allowed_dirty:
msg += ' and is not allowed to have them'
failed = True
print(msg)
print("\nPlease check the respective log files to see the errors")
if failed: if failed:
if is_grenade:
print("Currently not failing grenade runs with errors")
return 0
return 1 return 1
print("ok") print("ok")
return 0 return 0