| Index: tools/testing/perf_testing/run_perf_tests.py
|
| ===================================================================
|
| --- tools/testing/perf_testing/run_perf_tests.py (revision 11903)
|
| +++ tools/testing/perf_testing/run_perf_tests.py (working copy)
|
| @@ -5,7 +5,7 @@
|
| # BSD-style license that can be found in the LICENSE file.
|
|
|
| import datetime
|
| -import math
|
| +import math
|
| import optparse
|
| import os
|
| from os.path import dirname, abspath
|
| @@ -95,7 +95,7 @@
|
| if line.startswith('?'):
|
| to_remove = line.split()[1]
|
| if os.path.isdir(to_remove):
|
| - shutil.rmtree(to_remove)#, ignore_errors=True)
|
| + shutil.rmtree(to_remove, ignore_errors=True)
|
| else:
|
| os.remove(to_remove)
|
| elif any(line.startswith(status) for status in ['A', 'M', 'C', 'D']):
|
| @@ -104,18 +104,22 @@
|
| def GetArchive(self, archive_name):
|
| """Wrapper around the pulling down a specific archive from Google Storage.
|
| Adds a specific revision argument as needed.
|
| - Returns: The stdout and stderr from running this command."""
|
| + Returns: A tuple of a boolean (True if we successfully downloaded the
|
| + binary), and the stdout and stderr from running this command."""
|
| + num_fails = 0
|
| + success = True
|
| while True:
|
| cmd = ['python', os.path.join(DART_REPO_LOC, 'tools', 'get_archive.py'),
|
| archive_name]
|
| if int(self.current_revision_num) != -1:
|
| cmd += ['-r', str(self.current_revision_num)]
|
| stdout, stderr = self.RunCmd(cmd)
|
| - if 'Please try again later' in stdout:
|
| + if 'Please try again later' in stdout and num_fails < 20:
|
| time.sleep(100)
|
| + num_fails += 1
|
| else:
|
| break
|
| - return (stdout, stderr)
|
| + return (num_fails < 20, stdout, stderr)
|
|
|
| def _Sync(self, revision_num=None):
|
| """Update the repository to the latest or specified revision."""
|
| @@ -148,9 +152,9 @@
|
| revision_num = SearchForRevision()
|
|
|
| self.current_revision_num = revision_num
|
| - stdout, stderr = self.GetArchive('sdk')
|
| + success, stdout, stderr = self.GetArchive('sdk')
|
| if (not os.path.exists(os.path.join(
|
| - DART_REPO_LOC, 'tools', 'get_archive.py'))
|
| + DART_REPO_LOC, 'tools', 'get_archive.py')) or not success
|
| or 'InvalidUriError' in stderr or "Couldn't download" in stdout):
|
| # Couldn't find the SDK on Google Storage. Build it locally.
|
|
|
| @@ -257,9 +261,6 @@
|
| if len(results.split('\n')) >= 2:
|
| latest_interesting_server_rev = int(
|
| results.split('\n')[-2].split()[-1])
|
| - print 'success'
|
| - else:
|
| - print 'hrmmmm'
|
| if self.backfill:
|
| done_cls = list(UpdateSetOfDoneCls())
|
| done_cls.sort()
|
| @@ -422,8 +423,6 @@
|
| """
|
| # TODO(vsm): This avoids a bug in 32-bit Chrome (dartium)
|
| # running JS dromaeo.
|
| - if variant == 'js':
|
| - return False
|
| if platform == 'dartium' and variant == 'js':
|
| return False
|
| if (platform == 'safari' and variant == 'dart2js' and
|
| @@ -597,14 +596,14 @@
|
| class BrowserTester(Tester):
|
| @staticmethod
|
| def GetBrowsers(add_dartium=True):
|
| - browsers = ['ff']#, 'chrome']
|
| + browsers = ['ff', 'chrome']
|
| if add_dartium:
|
| - pass#browsers += ['dartium']
|
| + browsers += ['dartium']
|
| has_shell = False
|
| if platform.system() == 'Darwin':
|
| browsers += ['safari']
|
| if platform.system() == 'Windows':
|
| - #browsers += ['ie']
|
| + browsers += ['ie']
|
| has_shell = True
|
| return browsers
|
|
|
| @@ -665,7 +664,6 @@
|
| """Comb through the html to find the performance results.
|
| Returns: True if we successfully posted our data to storage and/or we can
|
| delete the trace file."""
|
| - print afile
|
| os.chdir(os.path.join(TOP_LEVEL_DIR, 'tools',
|
| 'testing', 'perf_testing'))
|
| parts = afile.split('-')
|
| @@ -814,6 +812,9 @@
|
| shenanigans once we're back to both versions of Chrome using the same
|
| version of ChromeDriver. IMPORTANT NOTE: This assumes your chromedriver is
|
| in the default location (inside depot_tools).
|
| +
|
| + Returns: True if we were successfully able to download a new version of
|
| + chromedriver and/or move the correct chromedriver into position.
|
| """
|
| current_dir = os.getcwd()
|
| self.test.test_runner.GetArchive('chromedriver')
|
| @@ -843,6 +844,8 @@
|
| print >> sys.stderr, to_dir
|
| if not os.path.exists(os.path.dirname(to_dir)):
|
| os.makedirs(os.path.dirname(to_dir))
|
| + if not os.path.exists(os.path.dirname(from_dir)):
|
| + os.makedirs(os.path.dirname(from_dir))
|
| shutil.copyfile(from_dir, to_dir)
|
|
|
| for loc in path:
|
| @@ -855,11 +858,15 @@
|
| FIRST_CHROMEDRIVER):
|
| # If we don't have a stashed a different chromedriver just use
|
| # the regular chromedriver.
|
| + if not os.path.exists(os.path.dirname(orig_chromedriver_path)):
|
| + os.makedirs(os.path.dirname(orig_chromedriver_path))
|
| self.test.test_runner.RunCmd([os.path.join(
|
| TOP_LEVEL_DIR, 'tools', 'testing', 'webdriver_test_setup.py'),
|
| '-f', '-p', '-s'])
|
| elif not os.path.exists(dartium_chromedriver_path):
|
| - stdout, _ = self.test.test_runner.GetArchive('chromedriver')
|
| + success, _, _ = self.test.test_runner.GetArchive('chromedriver')
|
| + if not success:
|
| + return False
|
| # Move original chromedriver for storage.
|
| if not os.path.exists(orig_chromedriver_path):
|
| MoveChromedriver(loc, copy_to_depot_tools_dir=False)
|
| @@ -868,11 +875,15 @@
|
| MoveChromedriver(loc, from_path=os.path.join(
|
| dartium_chromedriver_path, 'chromedriver'))
|
| os.chdir(current_dir)
|
| + return True
|
|
|
| def RunTests(self):
|
| """Run dromaeo in the browser."""
|
|
|
| - self.test.test_runner.GetArchive('dartium')
|
| + success, _, _ = self.test.test_runner.GetArchive('dartium')
|
| + if not success:
|
| + # Unable to download dartium. Try later.
|
| + return
|
|
|
| # Build tests.
|
| dromaeo_path = os.path.join('samples', 'third_party', 'dromaeo')
|
| @@ -890,7 +901,9 @@
|
| versions = DromaeoTester.GetDromaeoVersions()
|
|
|
| for browser in BrowserTester.GetBrowsers():
|
| - self.MoveChromeDriverIfNeeded(browser)
|
| + success = self.MoveChromeDriverIfNeeded(browser)
|
| + if not success:
|
| + return
|
| for version_name in versions:
|
| if not self.test.IsValidCombination(browser, version_name):
|
| continue
|
| @@ -923,7 +936,6 @@
|
| def ProcessFile(self, afile, should_post_file):
|
| """Comb through the html to find the performance results.
|
| Returns: True if we successfully posted our data to storage."""
|
| - print afile
|
| parts = afile.split('-')
|
| browser = parts[2]
|
| version = parts[3]
|
| @@ -1061,7 +1073,7 @@
|
| num_reruns=reruns)
|
| if num_results >= 10 or run == 0 and num_results + reruns >= 10:
|
| results_set = UpdateSetOfDoneCls(revision_number)
|
| - else:
|
| + elif run != 0:
|
| return False
|
| return True
|
|
|
|
|