| 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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 self._AddBasicPythonTest('chromedriver_tests', script, timeout=timeout) | 668 self._AddBasicPythonTest('chromedriver_tests', script, timeout=timeout) |
| 669 | 669 |
| 670 def AddWebDriverTest(self, timeout=1200): | 670 def AddWebDriverTest(self, timeout=1200): |
| 671 J = self.PathJoin | 671 J = self.PathJoin |
| 672 script = J('src', 'chrome', 'test', 'webdriver', 'test', | 672 script = J('src', 'chrome', 'test', 'webdriver', 'test', |
| 673 'run_webdriver_tests.py') | 673 'run_webdriver_tests.py') |
| 674 self._AddBasicPythonTest('webdriver_tests', script, timeout=timeout) | 674 self._AddBasicPythonTest('webdriver_tests', script, timeout=timeout) |
| 675 | 675 |
| 676 def AddPyAutoFunctionalTest(self, test_name, timeout=1200, | 676 def AddPyAutoFunctionalTest(self, test_name, timeout=1200, |
| 677 workdir=None, | 677 workdir=None, |
| 678 src_base=None, | 678 src_base='.', |
| 679 suite=None, | 679 suite=None, |
| 680 test_args=None, |
| 680 factory_properties=None, | 681 factory_properties=None, |
| 681 perf=False): | 682 perf=False): |
| 682 """Adds a step to run PyAuto functional tests. | 683 """Adds a step to run PyAuto functional tests. |
| 683 | 684 |
| 684 Args: | 685 Args: |
| 686 test_name: a string describing the test, used to build its logfile name |
| 687 and its descriptions in the waterfall display |
| 688 timeout: The buildbot timeout for this step, in seconds. The step will |
| 689 fail if the test does not produce any output within this time. |
| 685 workdir: the working dir for this step | 690 workdir: the working dir for this step |
| 686 src_base: relative path (from workdir) to src. Not needed if workdir is | 691 src_base: relative path (from workdir) to src. Not needed if workdir is |
| 687 'build' (the default) | 692 'build' (the default) |
| 688 suite: PyAuto suite to execute. | 693 suite: PyAuto suite to execute. |
| 689 perf: Is this a perf test or not? Requires suite to be set. | 694 test_args: list of PyAuto test arguments. |
| 695 factory_properties: A dictionary of factory property values. |
| 696 perf: Is this a perf test or not? Requires suite or test_args to be set. |
| 690 """ | 697 """ |
| 691 factory_properties = factory_properties or {} | 698 factory_properties = factory_properties or {} |
| 692 J = self.PathJoin | 699 J = self.PathJoin |
| 693 pyauto_script = J('src', 'chrome', 'test', 'functional', | 700 pyauto_script = J(src_base, 'src', 'chrome', 'test', 'functional', |
| 694 'pyauto_functional.py') | 701 'pyauto_functional.py') |
| 695 # in case a '..' prefix is needed | 702 pyauto_cmd = ['python', pyauto_script, '-v'] |
| 696 if src_base: | |
| 697 pyauto_script = J(src_base, pyauto_script) | |
| 698 | |
| 699 pyauto_functional_cmd = ['python', pyauto_script, '-v'] | |
| 700 if self._target_platform == 'win32': | 703 if self._target_platform == 'win32': |
| 701 pyauto_functional_cmd = self.GetPythonTestCommand(pyauto_script, ['-v']) | 704 pyauto_cmd = self.GetPythonTestCommand(pyauto_script, ['-v']) |
| 702 if src_base: # Adjust runtest.py path if needed. | 705 pyauto_cmd[1] = J(src_base, pyauto_cmd[1]) # adjust runtest.py if needed |
| 703 pyauto_functional_cmd[1] = J(src_base, pyauto_functional_cmd[1]) | |
| 704 elif self._target_platform == 'darwin': | 706 elif self._target_platform == 'darwin': |
| 705 pyauto_functional_cmd = self.GetTestCommand('/usr/bin/python2.5', | 707 pyauto_cmd = self.GetTestCommand('/usr/bin/python2.5', |
| 706 [pyauto_script, '-v']) | 708 [pyauto_script, '-v']) |
| 707 if src_base: # Adjust runtest.py path if needed. | 709 pyauto_cmd[1] = J(src_base, pyauto_cmd[1]) # adjust runtest.py if needed |
| 708 pyauto_functional_cmd[1] = J(src_base, pyauto_functional_cmd[1]) | |
| 709 elif (self._target_platform.startswith('linux') and | 710 elif (self._target_platform.startswith('linux') and |
| 710 factory_properties.get('use_xvfb_on_linux')): | 711 factory_properties.get('use_xvfb_on_linux')): |
| 711 # Run thru runtest.py on linux to launch virtual x server | 712 # On Linux, use runtest.py to launch virtual X server. |
| 712 pyauto_functional_cmd = self.GetTestCommand('/usr/bin/python', | 713 pyauto_cmd = self.GetTestCommand('/usr/bin/python', [pyauto_script, '-v']) |
| 713 [pyauto_script, '-v']) | 714 pyauto_cmd[1] = J(src_base, pyauto_cmd[1]) # adjust runtest.py if needed |
| 714 if src_base: # Adjust runtest.py path if needed. | |
| 715 pyauto_functional_cmd[1] = J(src_base, pyauto_functional_cmd[1]) | |
| 716 | 715 |
| 717 if suite: | 716 if suite: |
| 718 pyauto_functional_cmd.append('--suite=%s' % suite) | 717 pyauto_cmd.append('--suite=%s' % suite) |
| 718 if test_args: |
| 719 pyauto_cmd.extend(test_args) |
| 719 | 720 |
| 720 # Use special command class for parsing perf values from output. | |
| 721 command_class = retcode_command.ReturnCodeCommand | 721 command_class = retcode_command.ReturnCodeCommand |
| 722 if perf and suite: | 722 if perf and (suite or test_args): |
| 723 # Use special command class for parsing perf values from output. |
| 723 command_class = self.GetPerfStepClass( | 724 command_class = self.GetPerfStepClass( |
| 724 factory_properties, suite.lower(), | 725 factory_properties, test_name, process_log.GraphingLogProcessor) |
| 725 process_log.GraphingLogProcessor) | |
| 726 | 726 |
| 727 self.AddTestStep(command_class, | 727 self.AddTestStep(command_class, |
| 728 test_name, | 728 test_name, |
| 729 pyauto_functional_cmd, | 729 pyauto_cmd, |
| 730 env={'PYTHONPATH': '.'}, | 730 env={'PYTHONPATH': '.'}, |
| 731 workdir=workdir, | 731 workdir=workdir, |
| 732 timeout=timeout, | 732 timeout=timeout, |
| 733 do_step_if=self.GetTestStepFilter(factory_properties)) | 733 do_step_if=self.GetTestStepFilter(factory_properties)) |
| 734 | 734 |
| 735 def AddChromeEndureTest(self, test_class_name, pyauto_test_list, | 735 def AddChromeEndureTest(self, test_class_name, pyauto_test_list, |
| 736 factory_properties, timeout=1200): | 736 factory_properties, timeout=1200): |
| 737 """Adds a step to run PyAuto-based Chrome Endure tests. | 737 """Adds a step to run PyAuto-based Chrome Endure tests. |
| 738 | 738 |
| 739 Args: | 739 Args: |
| 740 test_class_name: A string name for this class of tests. | 740 test_class_name: A string name for this class of tests. |
| 741 pyauto_test_list: A list of strings, where each string is the full name | 741 pyauto_test_list: A list of strings, where each string is the full name |
| 742 of a pyauto test to run (file.class.test_name). | 742 of a pyauto test to run (file.class.test_name). |
| 743 factory_properties: A dictionary of factory property values. | 743 factory_properties: A dictionary of factory property values. |
| 744 timeout: The buildbot timeout for this step, in seconds. The step will | 744 timeout: The buildbot timeout for this step, in seconds. The step will |
| 745 fail if the test does not produce any output within this time. | 745 fail if the test does not produce any output within this time. |
| 746 """ | 746 """ |
| 747 pyauto_script = self.PathJoin('src', 'chrome', 'test', 'functional', | 747 pyauto_script = self.PathJoin('src', 'chrome', 'test', 'functional', |
| 748 'pyauto_functional.py') | 748 'pyauto_functional.py') |
| 749 # Only run on linux for now. | 749 # Only run on linux for now. |
| 750 if not self._target_platform.startswith('linux'): | 750 if not self._target_platform.startswith('linux'): |
| 751 return | 751 return |
| 752 | 752 |
| 753 for pyauto_test_name in pyauto_test_list: | 753 for pyauto_test_name in pyauto_test_list: |
| 754 pyauto_functional_cmd = ['python', pyauto_script, '-v'] | 754 pyauto_cmd = ['python', pyauto_script, '-v'] |
| 755 if factory_properties.get('use_xvfb_on_linux'): | 755 if factory_properties.get('use_xvfb_on_linux'): |
| 756 # Run through runtest.py on linux to launch virtual x server. | 756 # Run through runtest.py on linux to launch virtual x server. |
| 757 pyauto_functional_cmd = self.GetTestCommand('/usr/bin/python', | 757 pyauto_cmd = self.GetTestCommand('/usr/bin/python', |
| 758 [pyauto_script, '-v']) | 758 [pyauto_script, '-v']) |
| 759 | 759 pyauto_cmd.append(pyauto_test_name) |
| 760 pyauto_functional_cmd.append(pyauto_test_name) | |
| 761 test_step_name = (test_class_name + ' ' + | 760 test_step_name = (test_class_name + ' ' + |
| 762 pyauto_test_name[pyauto_test_name.rfind('.') + 1:]) | 761 pyauto_test_name[pyauto_test_name.rfind('.') + 1:]) |
| 763 self.AddTestStep(retcode_command.ReturnCodeCommand, | 762 self.AddTestStep(retcode_command.ReturnCodeCommand, |
| 764 test_step_name, | 763 test_step_name, |
| 765 pyauto_functional_cmd, | 764 pyauto_cmd, |
| 766 env={'PYTHONPATH': '.'}, | 765 env={'PYTHONPATH': '.'}, |
| 767 timeout=timeout, | 766 timeout=timeout, |
| 768 do_step_if=self.GetTestStepFilter(factory_properties)) | 767 do_step_if=self.GetTestStepFilter(factory_properties)) |
| 769 | 768 |
| 770 def AddDevToolsTests(self, factory_properties=None): | 769 def AddDevToolsTests(self, factory_properties=None): |
| 771 factory_properties = factory_properties or {} | 770 factory_properties = factory_properties or {} |
| 772 c = self.GetPerfStepClass(factory_properties, 'devtools_perf', | 771 c = self.GetPerfStepClass(factory_properties, 'devtools_perf', |
| 773 process_log.GraphingLogProcessor) | 772 process_log.GraphingLogProcessor) |
| 774 | 773 |
| 775 cmd = [self._python, self._devtools_perf_test_tool, | 774 cmd = [self._python, self._devtools_perf_test_tool, |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1166 # ArchiveCommand.createSummary. | 1165 # ArchiveCommand.createSummary. |
| 1167 return '%s/%s/%s' % (config.Master.archive_url, archive_type, builder_name) | 1166 return '%s/%s/%s' % (config.Master.archive_url, archive_type, builder_name) |
| 1168 | 1167 |
| 1169 def _GetSnapshotUrl(factory_properties=None, builder_name='%(build_name)s'): | 1168 def _GetSnapshotUrl(factory_properties=None, builder_name='%(build_name)s'): |
| 1170 if not factory_properties or 'gs_bucket' not in factory_properties: | 1169 if not factory_properties or 'gs_bucket' not in factory_properties: |
| 1171 return (_GetArchiveUrl('snapshots', builder_name), None) | 1170 return (_GetArchiveUrl('snapshots', builder_name), None) |
| 1172 gs_bucket = factory_properties['gs_bucket'] | 1171 gs_bucket = factory_properties['gs_bucket'] |
| 1173 gs_bucket = re.sub(r'^gs://', 'http://commondatastorage.googleapis.com/', | 1172 gs_bucket = re.sub(r'^gs://', 'http://commondatastorage.googleapis.com/', |
| 1174 gs_bucket) | 1173 gs_bucket) |
| 1175 return ('%s/index.html?path=%s' % (gs_bucket, builder_name), '/') | 1174 return ('%s/index.html?path=%s' % (gs_bucket, builder_name), '/') |
| OLD | NEW |