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

Unified Diff: master/skia_master_scripts/factory.py

Issue 14081044: Add Validation for BuildFactory Configuration (Closed) Base URL: http://skia.googlecode.com/svn/buildbot/
Patch Set: Created 7 years, 8 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: master/skia_master_scripts/factory.py
===================================================================
--- master/skia_master_scripts/factory.py (revision 8776)
+++ master/skia_master_scripts/factory.py (working copy)
@@ -16,7 +16,9 @@
import config
import config_private
import ntpath
+import os
import posixpath
+import utils
# TODO(epoger): My intent is to make the build steps identical on all platforms
@@ -113,11 +115,11 @@
self._do_patch_step = do_patch_step
if not environment_variables:
- my_env_vars = {}
+ self._env_vars = {}
else:
- my_env_vars = dict(environment_variables)
- gyp_defines = my_env_vars.get('GYP_DEFINES', '')
- my_env_vars['GYP_DEFINES'] = gyp_defines + \
+ self._env_vars = dict(environment_variables)
+ gyp_defines = self._env_vars.get('GYP_DEFINES', '')
+ self._env_vars['GYP_DEFINES'] = gyp_defines + \
' skia_warnings_as_errors=%d' % int(compile_warnings_as_errors)
# Get an implementation of SkiaCommands as appropriate for
@@ -127,7 +129,7 @@
target_platform=target_platform, factory=self,
configuration=configuration, workdir=workdir,
target_arch=None, default_timeout=default_timeout,
- environment_variables=my_env_vars)
+ environment_variables=self._env_vars)
self._perf_output_basedir = perf_output_basedir
@@ -184,6 +186,27 @@
]
BuildFactory.__init__(self, build_factory_properties=properties)
+ def Validate(self):
+ """ Validate the Factory against the known good configuration. """
+ test_dir = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
+ 'tools', 'tests', 'factory_configuration')
+ expected_dir = os.path.join(test_dir, 'expected')
+ actual_dir = os.path.join(test_dir, 'actual')
+ if not os.path.exists(actual_dir):
+ os.makedirs(actual_dir)
+ expectation = None
rmistry 2013/04/25 20:53:17 I am suprised you need need a None here since the
borenet 2013/04/25 21:12:39 That's left over from before the Exception. Remove
+ try:
+ expectation = open(os.path.join(expected_dir, self._builder_name)).read()
+ except IOError:
+ raise Exception('Warning: No expected factory configuration for %s.' %
+ self._builder_name)
+ self_as_string = utils.ToString(self.__dict__)
+ with open(os.path.join(actual_dir, self._builder_name), 'w') as f:
+ f.write(self_as_string)
+ if self_as_string != expectation:
+ raise ValueError('Factory configuration for %s does not match '
+ 'expectation!' % self._builder_name)
+
def AddSlaveScript(self, script, description, args=None, timeout=None,
halt_on_failure=False, is_upload_step=False,
is_rebaseline_step=False, get_props_from_stdout=None,
@@ -497,6 +520,7 @@
self.CommonSteps(clobber)
self.NonPerfSteps()
self.PerfSteps()
+ self.Validate()
return self
def BuildCompileOnly(self, clobber=None):
@@ -509,6 +533,7 @@
"""
self.UpdateSteps()
self.Compile(clobber=clobber, build_in_one_step=False)
+ self.Validate()
return self
def BuildNoPerf(self, clobber=None):
@@ -519,6 +544,7 @@
"""
self.CommonSteps(clobber)
self.NonPerfSteps()
+ self.Validate()
return self
def BuildPerfOnly(self, clobber=None):
@@ -535,4 +561,5 @@
CONFIG_RELEASE)
self.CommonSteps(clobber)
self.PerfSteps()
+ self.Validate()
return self

Powered by Google App Engine
This is Rietveld 408576698