| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 | 6 |
| 7 import datetime | 7 import datetime |
| 8 import math» » | 8 import math |
| 9 import optparse | 9 import optparse |
| 10 import os | 10 import os |
| 11 from os.path import dirname, abspath | 11 from os.path import dirname, abspath |
| 12 import pickle | 12 import pickle |
| 13 import platform | 13 import platform |
| 14 import random | 14 import random |
| 15 import re | 15 import re |
| 16 import shutil | 16 import shutil |
| 17 import stat | 17 import stat |
| 18 import subprocess | 18 import subprocess |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 def ClearOutUnversionedFiles(self): | 89 def ClearOutUnversionedFiles(self): |
| 90 """Remove all files that are unversioned by svn.""" | 90 """Remove all files that are unversioned by svn.""" |
| 91 if os.path.exists(DART_REPO_LOC): | 91 if os.path.exists(DART_REPO_LOC): |
| 92 os.chdir(DART_REPO_LOC) | 92 os.chdir(DART_REPO_LOC) |
| 93 results, _ = self.RunCmd(['svn', 'st']) | 93 results, _ = self.RunCmd(['svn', 'st']) |
| 94 for line in results.split('\n'): | 94 for line in results.split('\n'): |
| 95 if line.startswith('?'): | 95 if line.startswith('?'): |
| 96 to_remove = line.split()[1] | 96 to_remove = line.split()[1] |
| 97 if os.path.isdir(to_remove): | 97 if os.path.isdir(to_remove): |
| 98 shutil.rmtree(to_remove)#, ignore_errors=True) | 98 shutil.rmtree(to_remove, ignore_errors=True) |
| 99 else: | 99 else: |
| 100 os.remove(to_remove) | 100 os.remove(to_remove) |
| 101 elif any(line.startswith(status) for status in ['A', 'M', 'C', 'D']): | 101 elif any(line.startswith(status) for status in ['A', 'M', 'C', 'D']): |
| 102 self.RunCmd(['svn', 'revert', line.split()[1]]) | 102 self.RunCmd(['svn', 'revert', line.split()[1]]) |
| 103 | 103 |
| 104 def GetArchive(self, archive_name): | 104 def GetArchive(self, archive_name): |
| 105 """Wrapper around the pulling down a specific archive from Google Storage. | 105 """Wrapper around the pulling down a specific archive from Google Storage. |
| 106 Adds a specific revision argument as needed. | 106 Adds a specific revision argument as needed. |
| 107 Returns: The stdout and stderr from running this command.""" | 107 Returns: A tuple of a boolean (True if we successfully downloaded the |
| 108 binary), and the stdout and stderr from running this command.""" |
| 109 num_fails = 0 |
| 110 success = True |
| 108 while True: | 111 while True: |
| 109 cmd = ['python', os.path.join(DART_REPO_LOC, 'tools', 'get_archive.py'), | 112 cmd = ['python', os.path.join(DART_REPO_LOC, 'tools', 'get_archive.py'), |
| 110 archive_name] | 113 archive_name] |
| 111 if int(self.current_revision_num) != -1: | 114 if int(self.current_revision_num) != -1: |
| 112 cmd += ['-r', str(self.current_revision_num)] | 115 cmd += ['-r', str(self.current_revision_num)] |
| 113 stdout, stderr = self.RunCmd(cmd) | 116 stdout, stderr = self.RunCmd(cmd) |
| 114 if 'Please try again later' in stdout: | 117 if 'Please try again later' in stdout and num_fails < 20: |
| 115 time.sleep(100) | 118 time.sleep(100) |
| 119 num_fails += 1 |
| 116 else: | 120 else: |
| 117 break | 121 break |
| 118 return (stdout, stderr) | 122 return (num_fails < 20, stdout, stderr) |
| 119 | 123 |
| 120 def _Sync(self, revision_num=None): | 124 def _Sync(self, revision_num=None): |
| 121 """Update the repository to the latest or specified revision.""" | 125 """Update the repository to the latest or specified revision.""" |
| 122 os.chdir(dirname(DART_REPO_LOC)) | 126 os.chdir(dirname(DART_REPO_LOC)) |
| 123 self.ClearOutUnversionedFiles() | 127 self.ClearOutUnversionedFiles() |
| 124 if not revision_num: | 128 if not revision_num: |
| 125 self.RunCmd(['gclient', 'sync']) | 129 self.RunCmd(['gclient', 'sync']) |
| 126 else: | 130 else: |
| 127 self.RunCmd(['gclient', 'sync', '-r', str(revision_num), '-t']) | 131 self.RunCmd(['gclient', 'sync', '-r', str(revision_num), '-t']) |
| 128 | 132 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 141 Args: | 145 Args: |
| 142 suites: The set of suites that we wish to build. | 146 suites: The set of suites that we wish to build. |
| 143 | 147 |
| 144 Returns: | 148 Returns: |
| 145 err_code = 1 if there was a problem building.""" | 149 err_code = 1 if there was a problem building.""" |
| 146 self._Sync(revision_num) | 150 self._Sync(revision_num) |
| 147 if not revision_num: | 151 if not revision_num: |
| 148 revision_num = SearchForRevision() | 152 revision_num = SearchForRevision() |
| 149 | 153 |
| 150 self.current_revision_num = revision_num | 154 self.current_revision_num = revision_num |
| 151 stdout, stderr = self.GetArchive('sdk') | 155 success, stdout, stderr = self.GetArchive('sdk') |
| 152 if (not os.path.exists(os.path.join( | 156 if (not os.path.exists(os.path.join( |
| 153 DART_REPO_LOC, 'tools', 'get_archive.py')) | 157 DART_REPO_LOC, 'tools', 'get_archive.py')) or not success |
| 154 or 'InvalidUriError' in stderr or "Couldn't download" in stdout): | 158 or 'InvalidUriError' in stderr or "Couldn't download" in stdout): |
| 155 # Couldn't find the SDK on Google Storage. Build it locally. | 159 # Couldn't find the SDK on Google Storage. Build it locally. |
| 156 | 160 |
| 157 # On Windows, the output directory is marked as "Read Only," which causes | 161 # On Windows, the output directory is marked as "Read Only," which causes |
| 158 # an error to be thrown when we use shutil.rmtree. This helper function | 162 # an error to be thrown when we use shutil.rmtree. This helper function |
| 159 # changes the permissions so we can still delete the directory. | 163 # changes the permissions so we can still delete the directory. |
| 160 def on_rm_error(func, path, exc_info): | 164 def on_rm_error(func, path, exc_info): |
| 161 if os.path.exists(path): | 165 if os.path.exists(path): |
| 162 os.chmod(path, stat.S_IWRITE) | 166 os.chmod(path, stat.S_IWRITE) |
| 163 os.unlink(path) | 167 os.unlink(path) |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 if revision_num: | 254 if revision_num: |
| 251 return (HasPerfAffectingResults(GetFileList( | 255 return (HasPerfAffectingResults(GetFileList( |
| 252 revision_num)), revision_num) | 256 revision_num)), revision_num) |
| 253 else: | 257 else: |
| 254 latest_interesting_server_rev = None | 258 latest_interesting_server_rev = None |
| 255 while not latest_interesting_server_rev: | 259 while not latest_interesting_server_rev: |
| 256 results, _ = self.RunCmd(['svn', 'st', '-u'], std_in='p\r\n') | 260 results, _ = self.RunCmd(['svn', 'st', '-u'], std_in='p\r\n') |
| 257 if len(results.split('\n')) >= 2: | 261 if len(results.split('\n')) >= 2: |
| 258 latest_interesting_server_rev = int( | 262 latest_interesting_server_rev = int( |
| 259 results.split('\n')[-2].split()[-1]) | 263 results.split('\n')[-2].split()[-1]) |
| 260 print 'success' | |
| 261 else: | |
| 262 print 'hrmmmm' | |
| 263 if self.backfill: | 264 if self.backfill: |
| 264 done_cls = list(UpdateSetOfDoneCls()) | 265 done_cls = list(UpdateSetOfDoneCls()) |
| 265 done_cls.sort() | 266 done_cls.sort() |
| 266 if done_cls: | 267 if done_cls: |
| 267 last_done_cl = int(done_cls[-1]) | 268 last_done_cl = int(done_cls[-1]) |
| 268 else: | 269 else: |
| 269 last_done_cl = EARLIEST_REVISION | 270 last_done_cl = EARLIEST_REVISION |
| 270 while latest_interesting_server_rev >= last_done_cl: | 271 while latest_interesting_server_rev >= last_done_cl: |
| 271 file_list = GetFileList(latest_interesting_server_rev) | 272 file_list = GetFileList(latest_interesting_server_rev) |
| 272 if HasPerfAffectingResults(file_list): | 273 if HasPerfAffectingResults(file_list): |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 for extra_metric in extra_metrics: | 416 for extra_metric in extra_metrics: |
| 416 self.revision_dict[platform][f][extra_metric] = [] | 417 self.revision_dict[platform][f][extra_metric] = [] |
| 417 self.values_dict[platform][f][extra_metric] = [] | 418 self.values_dict[platform][f][extra_metric] = [] |
| 418 | 419 |
| 419 def IsValidCombination(self, platform, variant): | 420 def IsValidCombination(self, platform, variant): |
| 420 """Check whether data should be captured for this platform/variant | 421 """Check whether data should be captured for this platform/variant |
| 421 combination. | 422 combination. |
| 422 """ | 423 """ |
| 423 # TODO(vsm): This avoids a bug in 32-bit Chrome (dartium) | 424 # TODO(vsm): This avoids a bug in 32-bit Chrome (dartium) |
| 424 # running JS dromaeo. | 425 # running JS dromaeo. |
| 425 if variant == 'js': | |
| 426 return False | |
| 427 if platform == 'dartium' and variant == 'js': | 426 if platform == 'dartium' and variant == 'js': |
| 428 return False | 427 return False |
| 429 if (platform == 'safari' and variant == 'dart2js' and | 428 if (platform == 'safari' and variant == 'dart2js' and |
| 430 int(self.test_runner.current_revision_num) < 10193): | 429 int(self.test_runner.current_revision_num) < 10193): |
| 431 # In revision 10193 we fixed a bug that allows Safari 6 to run dart2js | 430 # In revision 10193 we fixed a bug that allows Safari 6 to run dart2js |
| 432 # code. Since we can't change the Safari version on the machine, we're | 431 # code. Since we can't change the Safari version on the machine, we're |
| 433 # just not running | 432 # just not running |
| 434 # for this case. | 433 # for this case. |
| 435 return False | 434 return False |
| 436 return True | 435 return True |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 file_processor) | 589 file_processor) |
| 591 self.platform_list = platform_list | 590 self.platform_list = platform_list |
| 592 self.platform_type = platform_type | 591 self.platform_type = platform_type |
| 593 self.versions = versions | 592 self.versions = versions |
| 594 self.benchmarks = benchmarks | 593 self.benchmarks = benchmarks |
| 595 | 594 |
| 596 | 595 |
| 597 class BrowserTester(Tester): | 596 class BrowserTester(Tester): |
| 598 @staticmethod | 597 @staticmethod |
| 599 def GetBrowsers(add_dartium=True): | 598 def GetBrowsers(add_dartium=True): |
| 600 browsers = ['ff']#, 'chrome'] | 599 browsers = ['ff', 'chrome'] |
| 601 if add_dartium: | 600 if add_dartium: |
| 602 pass#browsers += ['dartium'] | 601 browsers += ['dartium'] |
| 603 has_shell = False | 602 has_shell = False |
| 604 if platform.system() == 'Darwin': | 603 if platform.system() == 'Darwin': |
| 605 browsers += ['safari'] | 604 browsers += ['safari'] |
| 606 if platform.system() == 'Windows': | 605 if platform.system() == 'Windows': |
| 607 #browsers += ['ie'] | 606 browsers += ['ie'] |
| 608 has_shell = True | 607 has_shell = True |
| 609 return browsers | 608 return browsers |
| 610 | 609 |
| 611 | 610 |
| 612 class CommonBrowserTest(RuntimePerformanceTest): | 611 class CommonBrowserTest(RuntimePerformanceTest): |
| 613 """Runs this basic performance tests (Benchpress, some V8 benchmarks) in the | 612 """Runs this basic performance tests (Benchpress, some V8 benchmarks) in the |
| 614 browser.""" | 613 browser.""" |
| 615 | 614 |
| 616 def __init__(self, test_runner): | 615 def __init__(self, test_runner): |
| 617 """Args: | 616 """Args: |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 '--out', file_path, '--browser', browser, | 657 '--out', file_path, '--browser', browser, |
| 659 '--timeout', '600', '--mode', 'perf'], self.test.trace_file, | 658 '--timeout', '600', '--mode', 'perf'], self.test.trace_file, |
| 660 append=True) | 659 append=True) |
| 661 | 660 |
| 662 class CommonBrowserFileProcessor(Processor): | 661 class CommonBrowserFileProcessor(Processor): |
| 663 | 662 |
| 664 def ProcessFile(self, afile, should_post_file): | 663 def ProcessFile(self, afile, should_post_file): |
| 665 """Comb through the html to find the performance results. | 664 """Comb through the html to find the performance results. |
| 666 Returns: True if we successfully posted our data to storage and/or we can | 665 Returns: True if we successfully posted our data to storage and/or we can |
| 667 delete the trace file.""" | 666 delete the trace file.""" |
| 668 print afile | |
| 669 os.chdir(os.path.join(TOP_LEVEL_DIR, 'tools', | 667 os.chdir(os.path.join(TOP_LEVEL_DIR, 'tools', |
| 670 'testing', 'perf_testing')) | 668 'testing', 'perf_testing')) |
| 671 parts = afile.split('-') | 669 parts = afile.split('-') |
| 672 browser = parts[2] | 670 browser = parts[2] |
| 673 version = parts[3] | 671 version = parts[3] |
| 674 f = self.OpenTraceFile(afile, should_post_file) | 672 f = self.OpenTraceFile(afile, should_post_file) |
| 675 lines = f.readlines() | 673 lines = f.readlines() |
| 676 line = '' | 674 line = '' |
| 677 i = 0 | 675 i = 0 |
| 678 revision_num = 0 | 676 revision_num = 0 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 | 805 |
| 808 class DromaeoPerfTester(DromaeoTester): | 806 class DromaeoPerfTester(DromaeoTester): |
| 809 def MoveChromeDriverIfNeeded(self, browser): | 807 def MoveChromeDriverIfNeeded(self, browser): |
| 810 """Move the appropriate version of ChromeDriver onto the path. | 808 """Move the appropriate version of ChromeDriver onto the path. |
| 811 TODO(efortuna): This is a total hack because the latest version of Chrome | 809 TODO(efortuna): This is a total hack because the latest version of Chrome |
| 812 (Dartium builds) requires a different version of ChromeDriver, that is | 810 (Dartium builds) requires a different version of ChromeDriver, that is |
| 813 incompatible with the release or beta Chrome and vice versa. Remove these | 811 incompatible with the release or beta Chrome and vice versa. Remove these |
| 814 shenanigans once we're back to both versions of Chrome using the same | 812 shenanigans once we're back to both versions of Chrome using the same |
| 815 version of ChromeDriver. IMPORTANT NOTE: This assumes your chromedriver is | 813 version of ChromeDriver. IMPORTANT NOTE: This assumes your chromedriver is |
| 816 in the default location (inside depot_tools). | 814 in the default location (inside depot_tools). |
| 815 |
| 816 Returns: True if we were successfully able to download a new version of |
| 817 chromedriver and/or move the correct chromedriver into position. |
| 817 """ | 818 """ |
| 818 current_dir = os.getcwd() | 819 current_dir = os.getcwd() |
| 819 self.test.test_runner.GetArchive('chromedriver') | 820 self.test.test_runner.GetArchive('chromedriver') |
| 820 path = os.environ['PATH'].split(os.pathsep) | 821 path = os.environ['PATH'].split(os.pathsep) |
| 821 orig_chromedriver_path = os.path.join(DART_REPO_LOC, 'tools', 'testing', | 822 orig_chromedriver_path = os.path.join(DART_REPO_LOC, 'tools', 'testing', |
| 822 'orig-chromedriver') | 823 'orig-chromedriver') |
| 823 dartium_chromedriver_path = os.path.join(DART_REPO_LOC, 'tools', | 824 dartium_chromedriver_path = os.path.join(DART_REPO_LOC, 'tools', |
| 824 'testing', | 825 'testing', |
| 825 'dartium-chromedriver') | 826 'dartium-chromedriver') |
| 826 extension = '' | 827 extension = '' |
| 827 if platform.system() == 'Windows': | 828 if platform.system() == 'Windows': |
| 828 extension = '.exe' | 829 extension = '.exe' |
| 829 | 830 |
| 830 def MoveChromedriver(depot_tools, copy_to_depot_tools_dir=True, | 831 def MoveChromedriver(depot_tools, copy_to_depot_tools_dir=True, |
| 831 from_path=None): | 832 from_path=None): |
| 832 if from_path: | 833 if from_path: |
| 833 from_dir = from_path + extension | 834 from_dir = from_path + extension |
| 834 else: | 835 else: |
| 835 from_dir = os.path.join(orig_chromedriver_path, | 836 from_dir = os.path.join(orig_chromedriver_path, |
| 836 'chromedriver' + extension) | 837 'chromedriver' + extension) |
| 837 to_dir = os.path.join(depot_tools, 'chromedriver' + extension) | 838 to_dir = os.path.join(depot_tools, 'chromedriver' + extension) |
| 838 if not copy_to_depot_tools_dir: | 839 if not copy_to_depot_tools_dir: |
| 839 tmp = to_dir | 840 tmp = to_dir |
| 840 to_dir = from_dir | 841 to_dir = from_dir |
| 841 from_dir = tmp | 842 from_dir = tmp |
| 842 print >> sys.stderr, from_dir | 843 print >> sys.stderr, from_dir |
| 843 print >> sys.stderr, to_dir | 844 print >> sys.stderr, to_dir |
| 844 if not os.path.exists(os.path.dirname(to_dir)): | 845 if not os.path.exists(os.path.dirname(to_dir)): |
| 845 os.makedirs(os.path.dirname(to_dir)) | 846 os.makedirs(os.path.dirname(to_dir)) |
| 847 if not os.path.exists(os.path.dirname(from_dir)): |
| 848 os.makedirs(os.path.dirname(from_dir)) |
| 846 shutil.copyfile(from_dir, to_dir) | 849 shutil.copyfile(from_dir, to_dir) |
| 847 | 850 |
| 848 for loc in path: | 851 for loc in path: |
| 849 if 'depot_tools' in loc: | 852 if 'depot_tools' in loc: |
| 850 if browser == 'chrome': | 853 if browser == 'chrome': |
| 851 if os.path.exists(orig_chromedriver_path): | 854 if os.path.exists(orig_chromedriver_path): |
| 852 MoveChromedriver(loc) | 855 MoveChromedriver(loc) |
| 853 elif browser == 'dartium': | 856 elif browser == 'dartium': |
| 854 if (int(self.test.test_runner.current_revision_num) < | 857 if (int(self.test.test_runner.current_revision_num) < |
| 855 FIRST_CHROMEDRIVER): | 858 FIRST_CHROMEDRIVER): |
| 856 # If we don't have a stashed a different chromedriver just use | 859 # If we don't have a stashed a different chromedriver just use |
| 857 # the regular chromedriver. | 860 # the regular chromedriver. |
| 861 if not os.path.exists(os.path.dirname(orig_chromedriver_path)): |
| 862 os.makedirs(os.path.dirname(orig_chromedriver_path)) |
| 858 self.test.test_runner.RunCmd([os.path.join( | 863 self.test.test_runner.RunCmd([os.path.join( |
| 859 TOP_LEVEL_DIR, 'tools', 'testing', 'webdriver_test_setup.py'), | 864 TOP_LEVEL_DIR, 'tools', 'testing', 'webdriver_test_setup.py'), |
| 860 '-f', '-p', '-s']) | 865 '-f', '-p', '-s']) |
| 861 elif not os.path.exists(dartium_chromedriver_path): | 866 elif not os.path.exists(dartium_chromedriver_path): |
| 862 stdout, _ = self.test.test_runner.GetArchive('chromedriver') | 867 success, _, _ = self.test.test_runner.GetArchive('chromedriver') |
| 868 if not success: |
| 869 return False |
| 863 # Move original chromedriver for storage. | 870 # Move original chromedriver for storage. |
| 864 if not os.path.exists(orig_chromedriver_path): | 871 if not os.path.exists(orig_chromedriver_path): |
| 865 MoveChromedriver(loc, copy_to_depot_tools_dir=False) | 872 MoveChromedriver(loc, copy_to_depot_tools_dir=False) |
| 866 if self.test.test_runner.current_revision_num >= FIRST_CHROMEDRIVER: | 873 if self.test.test_runner.current_revision_num >= FIRST_CHROMEDRIVER: |
| 867 # Copy Dartium chromedriver into depot_tools | 874 # Copy Dartium chromedriver into depot_tools |
| 868 MoveChromedriver(loc, from_path=os.path.join( | 875 MoveChromedriver(loc, from_path=os.path.join( |
| 869 dartium_chromedriver_path, 'chromedriver')) | 876 dartium_chromedriver_path, 'chromedriver')) |
| 870 os.chdir(current_dir) | 877 os.chdir(current_dir) |
| 878 return True |
| 871 | 879 |
| 872 def RunTests(self): | 880 def RunTests(self): |
| 873 """Run dromaeo in the browser.""" | 881 """Run dromaeo in the browser.""" |
| 874 | 882 |
| 875 self.test.test_runner.GetArchive('dartium') | 883 success, _, _ = self.test.test_runner.GetArchive('dartium') |
| 884 if not success: |
| 885 # Unable to download dartium. Try later. |
| 886 return |
| 876 | 887 |
| 877 # Build tests. | 888 # Build tests. |
| 878 dromaeo_path = os.path.join('samples', 'third_party', 'dromaeo') | 889 dromaeo_path = os.path.join('samples', 'third_party', 'dromaeo') |
| 879 current_path = os.getcwd() | 890 current_path = os.getcwd() |
| 880 os.chdir(dromaeo_path) | 891 os.chdir(dromaeo_path) |
| 881 if os.path.exists('generate_dart2js_tests.py'): | 892 if os.path.exists('generate_dart2js_tests.py'): |
| 882 stdout, _ = self.test.test_runner.RunCmd( | 893 stdout, _ = self.test.test_runner.RunCmd( |
| 883 ['python', 'generate_dart2js_tests.py']) | 894 ['python', 'generate_dart2js_tests.py']) |
| 884 else: | 895 else: |
| 885 stdout, _ = self.test.test_runner.RunCmd( | 896 stdout, _ = self.test.test_runner.RunCmd( |
| 886 ['python', 'generate_frog_tests.py']) | 897 ['python', 'generate_frog_tests.py']) |
| 887 os.chdir(current_path) | 898 os.chdir(current_path) |
| 888 if 'Error: Compilation failed' in stdout: | 899 if 'Error: Compilation failed' in stdout: |
| 889 return | 900 return |
| 890 versions = DromaeoTester.GetDromaeoVersions() | 901 versions = DromaeoTester.GetDromaeoVersions() |
| 891 | 902 |
| 892 for browser in BrowserTester.GetBrowsers(): | 903 for browser in BrowserTester.GetBrowsers(): |
| 893 self.MoveChromeDriverIfNeeded(browser) | 904 success = self.MoveChromeDriverIfNeeded(browser) |
| 905 if not success: |
| 906 return |
| 894 for version_name in versions: | 907 for version_name in versions: |
| 895 if not self.test.IsValidCombination(browser, version_name): | 908 if not self.test.IsValidCombination(browser, version_name): |
| 896 continue | 909 continue |
| 897 version = DromaeoTest.DromaeoPerfTester.GetDromaeoUrlQuery( | 910 version = DromaeoTest.DromaeoPerfTester.GetDromaeoUrlQuery( |
| 898 browser, version_name) | 911 browser, version_name) |
| 899 self.test.trace_file = os.path.join(TOP_LEVEL_DIR, | 912 self.test.trace_file = os.path.join(TOP_LEVEL_DIR, |
| 900 'tools', 'testing', 'perf_testing', self.test.result_folder_name, | 913 'tools', 'testing', 'perf_testing', self.test.result_folder_name, |
| 901 'dromaeo-%s-%s-%s' % (self.test.cur_time, browser, version_name)) | 914 'dromaeo-%s-%s-%s' % (self.test.cur_time, browser, version_name)) |
| 902 self.AddSvnRevisionToTrace(self.test.trace_file, browser) | 915 self.AddSvnRevisionToTrace(self.test.trace_file, browser) |
| 903 file_path = '"%s"' % os.path.join(os.getcwd(), dromaeo_path, | 916 file_path = '"%s"' % os.path.join(os.getcwd(), dromaeo_path, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 916 version = version.replace('frog', 'dart') | 929 version = version.replace('frog', 'dart') |
| 917 version = version.replace('_','AND') | 930 version = version.replace('_','AND') |
| 918 tags = DromaeoTester.GetValidDromaeoTags() | 931 tags = DromaeoTester.GetValidDromaeoTags() |
| 919 return 'OR'.join([ '%sAND%s' % (version, tag) for tag in tags]) | 932 return 'OR'.join([ '%sAND%s' % (version, tag) for tag in tags]) |
| 920 | 933 |
| 921 | 934 |
| 922 class DromaeoFileProcessor(Processor): | 935 class DromaeoFileProcessor(Processor): |
| 923 def ProcessFile(self, afile, should_post_file): | 936 def ProcessFile(self, afile, should_post_file): |
| 924 """Comb through the html to find the performance results. | 937 """Comb through the html to find the performance results. |
| 925 Returns: True if we successfully posted our data to storage.""" | 938 Returns: True if we successfully posted our data to storage.""" |
| 926 print afile | |
| 927 parts = afile.split('-') | 939 parts = afile.split('-') |
| 928 browser = parts[2] | 940 browser = parts[2] |
| 929 version = parts[3] | 941 version = parts[3] |
| 930 | 942 |
| 931 bench_dict = self.test.values_dict[browser][version] | 943 bench_dict = self.test.values_dict[browser][version] |
| 932 | 944 |
| 933 f = self.OpenTraceFile(afile, should_post_file) | 945 f = self.OpenTraceFile(afile, should_post_file) |
| 934 lines = f.readlines() | 946 lines = f.readlines() |
| 935 i = 0 | 947 i = 0 |
| 936 revision_num = 0 | 948 revision_num = 0 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 if num_results < 10: | 1066 if num_results < 10: |
| 1055 # Run at most two more times. | 1067 # Run at most two more times. |
| 1056 if num_results > 8: | 1068 if num_results > 8: |
| 1057 reruns = 10 - num_results | 1069 reruns = 10 - num_results |
| 1058 else: | 1070 else: |
| 1059 reruns = 2 | 1071 reruns = 2 |
| 1060 run = runner.RunTestSequence(revision_num=str(revision_number), | 1072 run = runner.RunTestSequence(revision_num=str(revision_number), |
| 1061 num_reruns=reruns) | 1073 num_reruns=reruns) |
| 1062 if num_results >= 10 or run == 0 and num_results + reruns >= 10: | 1074 if num_results >= 10 or run == 0 and num_results + reruns >= 10: |
| 1063 results_set = UpdateSetOfDoneCls(revision_number) | 1075 results_set = UpdateSetOfDoneCls(revision_number) |
| 1064 else: | 1076 elif run != 0: |
| 1065 return False | 1077 return False |
| 1066 return True | 1078 return True |
| 1067 | 1079 |
| 1068 if random.choice([True, False]): | 1080 if random.choice([True, False]): |
| 1069 # Select a random CL number, with greater likelihood of selecting a CL in | 1081 # Select a random CL number, with greater likelihood of selecting a CL in |
| 1070 # the more recent history than the distant past (using a simplified weighted | 1082 # the more recent history than the distant past (using a simplified weighted |
| 1071 # bucket algorithm). If that CL has less than 10 runs, run additional. If it | 1083 # bucket algorithm). If that CL has less than 10 runs, run additional. If it |
| 1072 # already has 10 runs, look for another CL number that is not yet have all | 1084 # already has 10 runs, look for another CL number that is not yet have all |
| 1073 # of its additional runs (do this up to 15 times). | 1085 # of its additional runs (do this up to 15 times). |
| 1074 tries = 0 | 1086 tries = 0 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 else: | 1142 else: |
| 1131 if runner.backfill: | 1143 if runner.backfill: |
| 1132 results_set = FillInBackHistory(results_set, runner) | 1144 results_set = FillInBackHistory(results_set, runner) |
| 1133 else: | 1145 else: |
| 1134 time.sleep(200) | 1146 time.sleep(200) |
| 1135 else: | 1147 else: |
| 1136 runner.RunTestSequence() | 1148 runner.RunTestSequence() |
| 1137 | 1149 |
| 1138 if __name__ == '__main__': | 1150 if __name__ == '__main__': |
| 1139 main() | 1151 main() |
| OLD | NEW |