Commit adee1f52 authored by Ben Joyce's avatar Ben Joyce Committed by Chromium LUCI CQ

Fix test_log possibly being too large.

Bug: 1169407
Change-Id: I66080a99bfcd36ce17fce4e5d5bfc8ed09de7e9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2644062Reviewed-by: default avatarNodir Turakulov <nodir@chromium.org>
Auto-Submit: benjamin joyce <bjoyce@chromium.org>
Commit-Queue: benjamin joyce <bjoyce@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845898}
parent b129baae
...@@ -80,12 +80,12 @@ class ResultSinkClient(object): ...@@ -80,12 +80,12 @@ class ResultSinkClient(object):
# Slightly smaller to allow addition of <pre> tags and message. # Slightly smaller to allow addition of <pre> tags and message.
report_check_size = MAX_REPORT_LEN - 45 report_check_size = MAX_REPORT_LEN - 45
test_log_formatted = cgi.escape(test_log) test_log_escaped = cgi.escape(test_log)
if len(test_log) > report_check_size: if len(test_log_escaped) > report_check_size:
test_log_formatted = ('<pre>' + test_log_formatted[:report_check_size] + test_log_formatted = ('<pre>' + test_log_escaped[:report_check_size] +
'...Full output in Artifact.</pre>') '...Full output in Artifact.</pre>')
elif test_log: else:
test_log_formatted = '<pre>' + test_log_formatted + '</pre>' test_log_formatted = '<pre>' + test_log_escaped + '</pre>'
tr = { tr = {
'expected': expected, 'expected': expected,
...@@ -98,7 +98,8 @@ class ResultSinkClient(object): ...@@ -98,7 +98,8 @@ class ResultSinkClient(object):
'testId': test_id, 'testId': test_id,
} }
artifacts = artifacts or {} artifacts = artifacts or {}
if len(test_log) > report_check_size: if len(test_log_escaped) > report_check_size:
# Upload the original log without any modifications.
artifacts.update({'Test Log': {'contents': base64.b64encode(test_log)}}) artifacts.update({'Test Log': {'contents': base64.b64encode(test_log)}})
if artifacts: if artifacts:
tr['artifacts'] = artifacts tr['artifacts'] = artifacts
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment