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

Unified Diff: tools/telemetry/telemetry/results/page_test_results.py

Issue 545523002: [Telemetry] Add capability for values to reference external files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better approach + more tests Created 6 years, 3 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
Index: tools/telemetry/telemetry/results/page_test_results.py
diff --git a/tools/telemetry/telemetry/results/page_test_results.py b/tools/telemetry/telemetry/results/page_test_results.py
index 676e003414de3f2f5ddecf2d26540316287d4189..4353563885701d64d736fa933dfc5889fa343a49 100644
--- a/tools/telemetry/telemetry/results/page_test_results.py
+++ b/tools/telemetry/telemetry/results/page_test_results.py
@@ -4,6 +4,8 @@
import collections
import copy
+import itertools
+import os
import traceback
from telemetry import value as value_module
@@ -66,6 +68,12 @@ class PageTestResults(object):
return self._all_summary_values
@property
+ def all_values(self):
+ return itertools.chain(
+ self.all_page_specific_values,
+ self.all_summary_values)
+
+ @property
def current_page(self):
assert self._current_page_run, 'Not currently running test.'
return self._current_page_run.page
@@ -96,6 +104,21 @@ class PageTestResults(object):
return failed_pages
@property
+ def all_paths(self):
+ """Returns the set of all paths to referenced files.
+
+ Since we are dealing with paths, and paths are not necessarily unique even
+ if they refer to the same file, we canonicalize paths using
+ os.path.normcase and os.path.realpath before adding them to the set that we
+ return.
+ """
+ paths = set()
+ for v in self.all_values:
+ paths.update(os.path.normcase(os.path.realpath(path)) for path in v.paths)
+
+ return paths
+
+ @property
def failures(self):
values = self.all_page_specific_values
return [v for v in values if isinstance(v, failure.FailureValue)]

Powered by Google App Engine
This is Rietveld 408576698