Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Unified Diff: gm/rebaseline_server/compare_to_expectations.py

Issue 376623002: rebaseline_server: allow JSON to control column filtering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Ravi suggestions Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/rebaseline_server/column.py ('k') | gm/rebaseline_server/imagepairset.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/rebaseline_server/compare_to_expectations.py
diff --git a/gm/rebaseline_server/compare_to_expectations.py b/gm/rebaseline_server/compare_to_expectations.py
index 1a93c6674fd77e00354898500bda76a826896cb1..e1a5f5f4744801370df0a1636bc10daca4714a9f 100755
--- a/gm/rebaseline_server/compare_to_expectations.py
+++ b/gm/rebaseline_server/compare_to_expectations.py
@@ -12,16 +12,18 @@ Repackage expected/actual GM results as needed by our HTML rebaseline viewer.
# System-level imports
import argparse
import fnmatch
-import json
import logging
import os
-import re
-import sys
import time
+# Must fix up PYTHONPATH before importing from within Skia
+# pylint: disable=W0611
+import fix_pythonpath
+# pylint: enable=W0611
+
# Imports from within Skia
-import fix_pythonpath # must do this first
from pyutils import url_utils
+import column
import gm_json
import imagediffdb
import imagepair
@@ -33,6 +35,17 @@ EXPECTATION_FIELDS_PASSED_THRU_VERBATIM = [
results.KEY__EXPECTATIONS__IGNOREFAILURE,
results.KEY__EXPECTATIONS__REVIEWED,
]
+FREEFORM_COLUMN_IDS = [
+ results.KEY__EXTRACOLUMNS__BUILDER,
+ results.KEY__EXTRACOLUMNS__TEST,
+]
+ORDERED_COLUMN_IDS = [
+ results.KEY__EXTRACOLUMNS__RESULT_TYPE,
+ results.KEY__EXTRACOLUMNS__BUILDER,
+ results.KEY__EXTRACOLUMNS__TEST,
+ results.KEY__EXTRACOLUMNS__CONFIG,
+]
+
TRUNK_DIRECTORY = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
DEFAULT_EXPECTATIONS_DIR = os.path.join(TRUNK_DIRECTORY, 'expectations', 'gm')
DEFAULT_IGNORE_FAILURES_FILE = 'ignored-tests.txt'
@@ -171,7 +184,7 @@ class ExpectationComparisons(results.BaseComparisons):
if not os.path.isdir(root):
raise IOError('no directory found at path %s' % root)
actual_builders_written = []
- for dirpath, dirnames, filenames in os.walk(root):
+ for dirpath, _, filenames in os.walk(root):
for matching_filename in fnmatch.filter(filenames, pattern):
builder = os.path.basename(dirpath)
per_builder_dict = meta_dict.get(builder)
@@ -211,6 +224,15 @@ class ExpectationComparisons(results.BaseComparisons):
descriptions=IMAGEPAIR_SET_DESCRIPTIONS,
diff_base_url=self._diff_base_url)
+ # Override settings for columns that should be filtered using freeform text.
+ for column_id in FREEFORM_COLUMN_IDS:
+ factory = column.ColumnHeaderFactory(
+ header_text=column_id, use_freeform_filter=True)
+ all_image_pairs.set_column_header_factory(
+ column_id=column_id, column_header_factory=factory)
+ failing_image_pairs.set_column_header_factory(
+ column_id=column_id, column_header_factory=factory)
+
all_image_pairs.ensure_extra_column_values_in_summary(
column_id=results.KEY__EXTRACOLUMNS__RESULT_TYPE, values=[
results.KEY__RESULT_TYPE__FAILED,
@@ -339,9 +361,12 @@ class ExpectationComparisons(results.BaseComparisons):
except Exception:
logging.exception('got exception while creating new ImagePair')
+ # pylint: disable=W0201
self._results = {
- results.KEY__HEADER__RESULTS_ALL: all_image_pairs.as_dict(),
- results.KEY__HEADER__RESULTS_FAILURES: failing_image_pairs.as_dict(),
+ results.KEY__HEADER__RESULTS_ALL: all_image_pairs.as_dict(
+ column_ids_in_order=ORDERED_COLUMN_IDS),
+ results.KEY__HEADER__RESULTS_FAILURES: failing_image_pairs.as_dict(
+ column_ids_in_order=ORDERED_COLUMN_IDS),
}
« no previous file with comments | « gm/rebaseline_server/column.py ('k') | gm/rebaseline_server/imagepairset.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698