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

Unified Diff: tools/telemetry/telemetry/page_runner.py

Issue 11881051: Telemetry: add a metadata layer between page set and .wpr. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 11 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/page_runner.py
diff --git a/tools/telemetry/telemetry/page_runner.py b/tools/telemetry/telemetry/page_runner.py
index 779fb0da697873d07ae3353eb77fd5fef1fb06c5..6a44ad670a09e2b9b4caaa978f07ac5b6fa03408 100644
--- a/tools/telemetry/telemetry/page_runner.py
+++ b/tools/telemetry/telemetry/page_runner.py
@@ -64,31 +64,27 @@ class PageRunner(object):
def __exit__(self, *args):
self.Close()
- def Run(self, options, possible_browser, test, results):
- # Set up WPR mode.
- if not self.page_set.archive_path:
- archive_path = ''
- if not self.page_set.ContainsOnlyFileURLs():
+ def Run(self, options, possible_browser, test, results, pages_run=None):
+ # Check if we can run against WPR.
+ for page in self.page_set.pages:
+ parsed_url = urlparse.urlparse(page.url)
+ if parsed_url.scheme == 'file':
+ continue
+ if not page.archive_path:
logging.warning("""
- No page set archive provided for the chosen page set. Benchmarking against
- live sites! Results won't be repeatable or comparable.
-""")
- else:
- archive_path = os.path.abspath(os.path.join(self.page_set.base_dir,
- self.page_set.archive_path))
- if options.wpr_mode == wpr_modes.WPR_OFF:
- if os.path.isfile(archive_path):
- possible_browser.options.wpr_mode = wpr_modes.WPR_REPLAY
- else:
- possible_browser.options.wpr_mode = wpr_modes.WPR_OFF
- if not self.page_set.ContainsOnlyFileURLs():
- logging.warning("""
- The page set archive %s does not exist, benchmarking against live sites!
+ No page set archive provided for the page %s. Benchmarking against live sites!
Results won't be repeatable or comparable.
+""", page.url)
+ elif options.wpr_mode != wpr_modes.WPR_RECORD:
+ # The page has an archive, and we're not recording.
+ if not os.path.isfile(page.archive_path):
+ logging.warning("""
+ The page set archive %s for page %s does not exist, benchmarking against live
+ sites! Results won't be repeatable or comparable.
To fix this, either add svn-internal to your .gclient using
http://goto/read-src-internal, or create a new archive using record_wpr.
- """, os.path.relpath(archive_path))
+ """, os.path.relpath(page.archive_path), page.url)
# Verify credentials path.
credentials_path = None
@@ -119,14 +115,24 @@ class PageRunner(object):
pages = _ShuffleAndFilterPageSet(self.page_set, options)
state = _RunState()
+ last_archive_path = None
try:
for page in pages:
+ if options.wpr_mode != wpr_modes.WPR_RECORD:
+ if page.archive_path and os.path.isfile(page.archive_path):
+ possible_browser.options.wpr_mode = wpr_modes.WPR_REPLAY
+ else:
+ possible_browser.options.wpr_mode = wpr_modes.WPR_OFF
+ if last_archive_path != page.archive_path:
+ state.Close()
+ state = _RunState()
+ last_archive_path = page.archive_path
tries = 3
while tries:
try:
if not state.browser:
self._SetupBrowser(state, test, possible_browser,
- credentials_path, archive_path)
+ credentials_path, page.archive_path)
if not state.tab:
if len(state.browser.tabs) == 0:
state.browser.tabs.New()
@@ -136,6 +142,8 @@ class PageRunner(object):
try:
self._RunPage(options, page, state.tab, test, results)
+ if pages_run is not None:
+ pages_run.append(page)
except tab_crash_exception.TabCrashException:
stdout = ''
if not options.show_stdout:

Powered by Google App Engine
This is Rietveld 408576698