summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/tools/safetynet_conclusions.py8
-rwxr-xr-xtesting/tools/safetynet_job.py12
2 files changed, 12 insertions, 8 deletions
diff --git a/testing/tools/safetynet_conclusions.py b/testing/tools/safetynet_conclusions.py
index 5764ede0c5..3d8758764c 100644
--- a/testing/tools/safetynet_conclusions.py
+++ b/testing/tools/safetynet_conclusions.py
@@ -263,15 +263,15 @@ def PrintConclusionsDictHumanReadable(conclusions_dict, colored, key=None):
case_pairs = sorted(conclusions_dict['comparison_by_case'].iteritems())
for case_name, case_dict in case_pairs:
+ if colored:
+ color = RATING_TO_COLOR[case_dict['rating']]
+
if case_dict['rating'] == RATING_FAILURE:
print u'{} to measure time for {}'.format(
- RATING_TO_COLOR[RATING_FAILURE].format('Failed'),
+ color.format('Failed'),
case_name).encode('utf-8')
continue
- if colored:
- color = RATING_TO_COLOR[case_dict['rating']]
-
print u'{0} {1:15,d} {2}' .format(
color.format('{:+11.4%}'.format(case_dict['ratio'])),
case_dict['after'],
diff --git a/testing/tools/safetynet_job.py b/testing/tools/safetynet_job.py
index 5cb926aec9..f3ea9c5d9a 100755
--- a/testing/tools/safetynet_job.py
+++ b/testing/tools/safetynet_job.py
@@ -60,7 +60,7 @@ class JobRun(object):
Returns:
Exit code for the script: 0 if no significant changes are found; 1 if
- there was an error in the comparison; 2 if there was a regression; 3 if
+ there was an error in the comparison; 3 if there was a regression; 4 if
there was an improvement and no regression.
"""
pdfium_src_dir = os.path.join(
@@ -144,18 +144,19 @@ class JobRun(object):
output_info = json.loads(json_output)
PrintConclusionsDictHumanReadable(output_info,
- colored=(not self.args.output_to_log),
+ colored=(not self.args.output_to_log
+ and not self.args.no_color),
key='after')
status = 0
if output_info['summary']['improvement']:
PrintWithTime('Improvement detected.')
- status = 3
+ status = 4
if output_info['summary']['regression']:
PrintWithTime('Regression detected.')
- status = 2
+ status = 3
if status == 0:
PrintWithTime('Nothing detected.')
@@ -183,6 +184,9 @@ def main():
parser.add_argument('--no-checkpoint', action='store_true',
help='whether to skip writing the new checkpoint. Use '
'for script debugging.')
+ parser.add_argument('--no-color', action='store_true',
+ help='whether to write output without color escape '
+ 'codes.')
parser.add_argument('--output-to-log', action='store_true',
help='whether to write output to a log file')
args = parser.parse_args()