Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Set of utilities to add commands to a buildbot factory. | 5 """Set of utilities to add commands to a buildbot factory. |
| 6 | 6 |
| 7 This is based on commands.py and adds chromium-specific commands.""" | 7 This is based on commands.py and adds chromium-specific commands.""" |
| 8 | 8 |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 factory_properties, perf_dashboard_name, | 279 factory_properties, perf_dashboard_name, |
| 280 process_log.GraphingPageCyclerLogProcessor) | 280 process_log.GraphingPageCyclerLogProcessor) |
| 281 | 281 |
| 282 # Get the test's command. | 282 # Get the test's command. |
| 283 cmd = self.GetPageCyclerCommand(command_name, enable_http, | 283 cmd = self.GetPageCyclerCommand(command_name, enable_http, |
| 284 factory_properties=factory_properties) | 284 factory_properties=factory_properties) |
| 285 | 285 |
| 286 # Add the test step to the factory. | 286 # Add the test step to the factory. |
| 287 self.AddTestStep(test_class, test, cmd, do_step_if=self.TestStepFilter) | 287 self.AddTestStep(test_class, test, cmd, do_step_if=self.TestStepFilter) |
| 288 | 288 |
| 289 def AddWebPageReplayTest(self, test_name, wpr_test, | |
|
tonyg_google
2012/05/31 01:59:56
A selfish suggestion: I'm going to be adding some
dennis_jeffrey
2012/05/31 17:18:53
I think we could just get rid of this function and
slamm_google
2012/06/02 22:04:56
Done.
| |
| 290 factory_properties=None, timeout=1800): | |
| 291 """Add Web Page Replay Page Cycler test step. | |
| 292 | |
| 293 Args: | |
| 294 test_name: a string describing the test, used to build its logfile name | |
| 295 and its descriptions in the waterfall display | |
| 296 wpr_test_suffix: suffix of pyauto test: | |
| 297 perf.WebPageReplayPageCyclerTest.{wpr_test} | |
| 298 factory_properties: A dictionary of factory property values. | |
| 299 timeout: The buildbot timeout for this step, in seconds. The step will | |
| 300 fail if the test does not produce any output within this time. | |
| 301 """ | |
| 302 pyauto_test = 'perf.WebPageReplayPageCyclerTest.%s' % wpr_test | |
| 303 self.AddPyAutoFunctionalTest( | |
| 304 test_name, test_args=[pyauto_test], timeout=timeout, | |
| 305 perf=True, factory_properties=factory_properties) | |
| 306 | |
| 289 def AddStartupTests(self, factory_properties=None): | 307 def AddStartupTests(self, factory_properties=None): |
| 290 factory_properties = factory_properties or {} | 308 factory_properties = factory_properties or {} |
| 291 c = self.GetPerfStepClass(factory_properties, 'startup', | 309 c = self.GetPerfStepClass(factory_properties, 'startup', |
| 292 process_log.GraphingLogProcessor) | 310 process_log.GraphingLogProcessor) |
| 293 | 311 |
| 294 test_list = 'StartupTest.*:ShutdownTest.*' | 312 test_list = 'StartupTest.*:ShutdownTest.*' |
| 295 # We don't need to run the Reference tests in debug mode. | 313 # We don't need to run the Reference tests in debug mode. |
| 296 if self._target == 'Debug': | 314 if self._target == 'Debug': |
| 297 test_list += ':-*.*Ref*' | 315 test_list += ':-*.*Ref*' |
| 298 options = ['--gtest_filter=%s' % test_list] | 316 options = ['--gtest_filter=%s' % test_list] |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 656 script = J('src', 'chrome', 'test', 'webdriver', 'test', | 674 script = J('src', 'chrome', 'test', 'webdriver', 'test', |
| 657 'run_chromedriver_tests.py') | 675 'run_chromedriver_tests.py') |
| 658 self._AddBasicPythonTest('chromedriver_tests', script, timeout=timeout) | 676 self._AddBasicPythonTest('chromedriver_tests', script, timeout=timeout) |
| 659 | 677 |
| 660 def AddWebDriverTest(self, timeout=1200): | 678 def AddWebDriverTest(self, timeout=1200): |
| 661 J = self.PathJoin | 679 J = self.PathJoin |
| 662 script = J('src', 'chrome', 'test', 'webdriver', 'test', | 680 script = J('src', 'chrome', 'test', 'webdriver', 'test', |
| 663 'run_webdriver_tests.py') | 681 'run_webdriver_tests.py') |
| 664 self._AddBasicPythonTest('webdriver_tests', script, timeout=timeout) | 682 self._AddBasicPythonTest('webdriver_tests', script, timeout=timeout) |
| 665 | 683 |
| 666 def AddPyAutoFunctionalTest(self, test_name, timeout=1200, | 684 def AddPyAutoFunctionalTest(self, test_name, timeout=1200, |
|
slamm_google
2012/05/31 00:05:28
Most of this diff is making the code a little easi
| |
| 667 workdir=None, | 685 workdir=None, |
| 668 src_base=None, | 686 src_base='.', |
| 669 suite=None, | 687 suite=None, |
| 688 test_args=None, | |
| 670 factory_properties=None, | 689 factory_properties=None, |
| 671 perf=False): | 690 perf=False): |
| 672 """Adds a step to run PyAuto functional tests. | 691 """Adds a step to run PyAuto functional tests. |
| 673 | 692 |
| 674 Args: | 693 Args: |
| 694 test_name: a string describing the test, used to build its logfile name | |
| 695 and its descriptions in the waterfall display | |
| 696 timeout: The buildbot timeout for this step, in seconds. The step will | |
| 697 fail if the test does not produce any output within this time. | |
| 675 workdir: the working dir for this step | 698 workdir: the working dir for this step |
| 676 src_base: relative path (from workdir) to src. Not needed if workdir is | 699 src_base: relative path (from workdir) to src. Not needed if workdir is |
| 677 'build' (the default) | 700 'build' (the default) |
| 678 suite: PyAuto suite to execute. | 701 suite: PyAuto suite to execute. |
| 679 perf: Is this a perf test or not? Requires suite to be set. | 702 test_args: list of PyAuto test arguments. |
| 703 factory_properties: A dictionary of factory property values. | |
| 704 perf: Is this a perf test or not? Requires suite or test_args to be set. | |
| 680 """ | 705 """ |
| 681 factory_properties = factory_properties or {} | 706 factory_properties = factory_properties or {} |
| 682 J = self.PathJoin | 707 J = self.PathJoin |
| 683 pyauto_script = J('src', 'chrome', 'test', 'functional', | 708 pyauto_script = J(src_base, 'src', 'chrome', 'test', 'functional', |
|
dennis_jeffrey
2012/05/31 17:18:53
Cool! I really like how the "src_base" parameter
| |
| 684 'pyauto_functional.py') | 709 'pyauto_functional.py') |
| 685 # in case a '..' prefix is needed | 710 pyauto_cmd = ['python', pyauto_script, '-v'] |
| 686 if src_base: | |
| 687 pyauto_script = J(src_base, pyauto_script) | |
| 688 | |
| 689 pyauto_functional_cmd = ['python', pyauto_script, '-v'] | |
| 690 if self._target_platform == 'win32': | 711 if self._target_platform == 'win32': |
| 691 pyauto_functional_cmd = self.GetPythonTestCommand(pyauto_script, ['-v']) | 712 pyauto_cmd = self.GetPythonTestCommand(pyauto_script, ['-v']) |
| 692 if src_base: # Adjust runtest.py path if needed. | 713 pyauto_cmd[1] = J(src_base, pyauto_cmd[1]) # adjust runtest.py if needed |
| 693 pyauto_functional_cmd[1] = J(src_base, pyauto_functional_cmd[1]) | |
| 694 elif self._target_platform == 'darwin': | 714 elif self._target_platform == 'darwin': |
| 695 pyauto_functional_cmd = self.GetTestCommand('/usr/bin/python2.5', | 715 pyauto_cmd = self.GetTestCommand('/usr/bin/python2.5', |
| 696 [pyauto_script, '-v']) | 716 [pyauto_script, '-v']) |
| 697 if src_base: # Adjust runtest.py path if needed. | 717 pyauto_cmd[1] = J(src_base, pyauto_cmd[1]) # adjust runtest.py if needed |
| 698 pyauto_functional_cmd[1] = J(src_base, pyauto_functional_cmd[1]) | |
| 699 elif (self._target_platform.startswith('linux') and | 718 elif (self._target_platform.startswith('linux') and |
| 700 factory_properties.get('use_xvfb_on_linux')): | 719 factory_properties.get('use_xvfb_on_linux')): |
| 701 # Run thru runtest.py on linux to launch virtual x server | 720 # On Linux, use runtest.py to launch virtual X server. |
| 702 pyauto_functional_cmd = self.GetTestCommand('/usr/bin/python', | 721 pyauto_cmd = self.GetTestCommand('/usr/bin/python', [pyauto_script, '-v']) |
| 703 [pyauto_script, '-v']) | 722 pyauto_cmd[1] = J(src_base, pyauto_cmd[1]) # adjust runtest.py if needed |
| 704 if src_base: # Adjust runtest.py path if needed. | 723 if suite: |
|
dennis_jeffrey
2012/05/31 17:18:53
nit: I recommend adding a blank line right above t
slamm_google
2012/06/02 22:04:56
Done.
| |
| 705 pyauto_functional_cmd[1] = J(src_base, pyauto_functional_cmd[1]) | 724 pyauto_cmd.append('--suite=%s' % suite) |
| 725 if test_args: | |
| 726 pyauto_cmd.extend(test_args) | |
| 706 | 727 |
| 707 if suite: | |
| 708 pyauto_functional_cmd.append('--suite=%s' % suite) | |
| 709 | |
| 710 # Use special command class for parsing perf values from output. | |
| 711 command_class = retcode_command.ReturnCodeCommand | 728 command_class = retcode_command.ReturnCodeCommand |
| 712 if perf and suite: | 729 if perf and (suite or test_args): |
| 730 # Use special command class for parsing perf values from output. | |
| 713 command_class = self.GetPerfStepClass( | 731 command_class = self.GetPerfStepClass( |
| 714 factory_properties, suite.lower(), | 732 factory_properties, suite.lower(), |
| 715 process_log.GraphingLogProcessor) | 733 process_log.GraphingLogProcessor) |
| 716 | 734 |
| 717 self.AddTestStep(command_class, | 735 self.AddTestStep(command_class, |
| 718 test_name, | 736 test_name, |
| 719 pyauto_functional_cmd, | 737 pyauto_cmd, |
| 720 env={'PYTHONPATH': '.'}, | 738 env={'PYTHONPATH': '.'}, |
| 721 workdir=workdir, | 739 workdir=workdir, |
| 722 timeout=timeout, | 740 timeout=timeout, |
| 723 do_step_if=self.GetTestStepFilter(factory_properties)) | 741 do_step_if=self.GetTestStepFilter(factory_properties)) |
| 724 | 742 |
| 725 def AddChromeEndureTest(self, test_class_name, pyauto_test_list, | 743 def AddChromeEndureTest(self, test_class_name, pyauto_test_list, |
| 726 factory_properties, timeout=1200): | 744 factory_properties, timeout=1200): |
| 727 """Adds a step to run PyAuto-based Chrome Endure tests. | 745 """Adds a step to run PyAuto-based Chrome Endure tests. |
| 728 | 746 |
| 729 Args: | 747 Args: |
| 730 test_class_name: A string name for this class of tests. | 748 test_class_name: A string name for this class of tests. |
| 731 pyauto_test_list: A list of strings, where each string is the full name | 749 pyauto_test_list: A list of strings, where each string is the full name |
| 732 of a pyauto test to run (file.class.test_name). | 750 of a pyauto test to run (file.class.test_name). |
| 733 factory_properties: A dictionary of factory property values. | 751 factory_properties: A dictionary of factory property values. |
| 734 timeout: The buildbot timeout for this step, in seconds. The step will | 752 timeout: The buildbot timeout for this step, in seconds. The step will |
| 735 fail if the test does not produce any output within this time. | 753 fail if the test does not produce any output within this time. |
| 736 """ | 754 """ |
| 737 pyauto_script = self.PathJoin('src', 'chrome', 'test', 'functional', | 755 pyauto_script = self.PathJoin('src', 'chrome', 'test', 'functional', |
| 738 'pyauto_functional.py') | 756 'pyauto_functional.py') |
| 739 # Only run on linux for now. | 757 # Only run on linux for now. |
| 740 if not self._target_platform.startswith('linux'): | 758 if not self._target_platform.startswith('linux'): |
| 741 return | 759 return |
| 742 | 760 |
| 743 for pyauto_test_name in pyauto_test_list: | 761 for pyauto_test_name in pyauto_test_list: |
| 744 pyauto_functional_cmd = ['python', pyauto_script, '-v'] | 762 pyauto_cmd = ['python', pyauto_script, '-v'] |
| 745 if factory_properties.get('use_xvfb_on_linux'): | 763 if factory_properties.get('use_xvfb_on_linux'): |
| 746 # Run through runtest.py on linux to launch virtual x server. | 764 # Run through runtest.py on linux to launch virtual x server. |
| 747 pyauto_functional_cmd = self.GetTestCommand('/usr/bin/python', | 765 pyauto_cmd = self.GetTestCommand('/usr/bin/python', |
| 748 [pyauto_script, '-v']) | 766 [pyauto_script, '-v']) |
| 749 | 767 pyauto_cmd.append(pyauto_test_name) |
| 750 pyauto_functional_cmd.append(pyauto_test_name) | |
| 751 test_step_name = (test_class_name + ' ' + | 768 test_step_name = (test_class_name + ' ' + |
| 752 pyauto_test_name[pyauto_test_name.rfind('.') + 1:]) | 769 pyauto_test_name[pyauto_test_name.rfind('.') + 1:]) |
| 753 self.AddTestStep(retcode_command.ReturnCodeCommand, | 770 self.AddTestStep(retcode_command.ReturnCodeCommand, |
| 754 test_step_name, | 771 test_step_name, |
| 755 pyauto_functional_cmd, | 772 pyauto_cmd, |
| 756 env={'PYTHONPATH': '.'}, | 773 env={'PYTHONPATH': '.'}, |
| 757 timeout=timeout, | 774 timeout=timeout, |
| 758 do_step_if=self.GetTestStepFilter(factory_properties)) | 775 do_step_if=self.GetTestStepFilter(factory_properties)) |
| 759 | 776 |
| 760 def AddDevToolsTests(self, factory_properties=None): | 777 def AddDevToolsTests(self, factory_properties=None): |
| 761 factory_properties = factory_properties or {} | 778 factory_properties = factory_properties or {} |
| 762 c = self.GetPerfStepClass(factory_properties, 'devtools_perf', | 779 c = self.GetPerfStepClass(factory_properties, 'devtools_perf', |
| 763 process_log.GraphingLogProcessor) | 780 process_log.GraphingLogProcessor) |
| 764 | 781 |
| 765 cmd = [self._python, self._devtools_perf_test_tool, | 782 cmd = [self._python, self._devtools_perf_test_tool, |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1133 # ArchiveCommand.createSummary. | 1150 # ArchiveCommand.createSummary. |
| 1134 return '%s/%s/%s' % (config.Master.archive_url, archive_type, builder_name) | 1151 return '%s/%s/%s' % (config.Master.archive_url, archive_type, builder_name) |
| 1135 | 1152 |
| 1136 def _GetSnapshotUrl(factory_properties=None, builder_name='%(build_name)s'): | 1153 def _GetSnapshotUrl(factory_properties=None, builder_name='%(build_name)s'): |
| 1137 if not factory_properties or 'gs_bucket' not in factory_properties: | 1154 if not factory_properties or 'gs_bucket' not in factory_properties: |
| 1138 return (_GetArchiveUrl('snapshots', builder_name), None) | 1155 return (_GetArchiveUrl('snapshots', builder_name), None) |
| 1139 gs_bucket = factory_properties['gs_bucket'] | 1156 gs_bucket = factory_properties['gs_bucket'] |
| 1140 gs_bucket = re.sub(r'^gs://', 'http://commondatastorage.googleapis.com/', | 1157 gs_bucket = re.sub(r'^gs://', 'http://commondatastorage.googleapis.com/', |
| 1141 gs_bucket) | 1158 gs_bucket) |
| 1142 return ('%s/index.html?path=%s' % (gs_bucket, builder_name), '/') | 1159 return ('%s/index.html?path=%s' % (gs_bucket, builder_name), '/') |
| OLD | NEW |