bug 488116 - Move CCUnittestBuildFactory into buildbotcustom, r=bhearsum
authorRobert Kaiser <kairo@kairo.at>
Mon, 20 Apr 2009 21:20:30 +0200
changeset 255 4a337a624db258dbfda45d50e9881ab00cdb5dd8
parent 254 d160c1da3488109e64eb9aae88c40817f55e8e8c
child 256 fe254d49f9525093fa29c2d5654ad191e32d826b
push id65
push userkairo@kairo.at
push dateMon, 20 Apr 2009 19:21:07 +0000
reviewersbhearsum
bugs488116
bug 488116 - Move CCUnittestBuildFactory into buildbotcustom, r=bhearsum
process/factory.py
--- a/process/factory.py
+++ b/process/factory.py
@@ -2037,16 +2037,265 @@ class UnittestBuildFactory(MozillaBuildF
         )
 
     def addPreTestSteps(self):
         pass
 
     def addPostTestSteps(self):
         pass
 
+class CCUnittestBuildFactory(MozillaBuildFactory):
+    def __init__(self, platform, config_repo_path, config_dir, objdir, mozRepoPath,
+            productName=None, brandName=None, mochitest_leak_threshold=None,
+            mochichrome_leak_threshold=None, mochibrowser_leak_threshold=None,
+            exec_reftest_suites=True, exec_mochi_suites=True, **kwargs):
+        self.env = {}
+        MozillaBuildFactory.__init__(self, **kwargs)
+        self.config_repo_path = config_repo_path
+        self.mozRepoPath = mozRepoPath
+        self.config_dir = config_dir
+        self.objdir = objdir
+        self.productName = productName
+        if brandName:
+            self.brandName = brandName
+        else:
+            self.brandName = productName.capitalize()
+        self.mochitest_leak_threshold = mochitest_leak_threshold
+        self.mochichrome_leak_threshold = mochichrome_leak_threshold
+        self.mochibrowser_leak_threshold = mochibrowser_leak_threshold
+        self.exec_reftest_suites = exec_reftest_suites
+        self.exec_mochi_suites = exec_mochi_suites
+
+        self.config_repo_url = self.getRepository(self.config_repo_path)
+
+        env_map = {
+                'linux': 'linux-centos-unittest',
+                'macosx': 'mac-osx-unittest',
+                'win32': 'win32-vc8-mozbuild-unittest',
+                }
+
+        self.platform = platform.split('-')[0]
+        assert self.platform in ('linux', 'linux64', 'win32', 'macosx')
+
+        self.env = MozillaEnvironments[env_map[self.platform]]
+        self.env['MOZ_OBJDIR'] = self.objdir
+
+        if self.platform == 'win32':
+            self.addStep(TinderboxShellCommand, name="kill hg",
+             description='kill hg',
+             descriptionDone="killed hg",
+             command="pskill -t hg.exe",
+             workdir="D:\\Utilities"
+            )
+            self.addStep(TinderboxShellCommand, name="kill sh",
+             description='kill sh',
+             descriptionDone="killed sh",
+             command="pskill -t sh.exe",
+             workdir="D:\\Utilities"
+            )
+            self.addStep(TinderboxShellCommand, name="kill make",
+             description='kill make',
+             descriptionDone="killed make",
+             command="pskill -t make.exe",
+             workdir="D:\\Utilities"
+            )
+            self.addStep(TinderboxShellCommand, name="kill %s" % self.productName,
+             description='kill %s' % self.productName,
+             descriptionDone="killed %s" % self.productName,
+             command="pskill -t %s.exe" % self.productName,
+             workdir="D:\\Utilities"
+            )
+            self.addStep(TinderboxShellCommand, name="kill xpcshell",
+             description='kill xpcshell',
+             descriptionDone="killed xpcshell",
+             command="pskill -t xpcshell.exe",
+             workdir="D:\\Utilities"
+            )
+
+        self.addStepNoEnv(Mercurial, mode='update',
+         baseURL='http://%s/' % self.hgHost,
+         defaultBranch=self.repoPath,
+         alwaysUseLatest=True,
+         timeout=60*60 # 1 hour
+        )
+
+        self.addPrintChangesetStep()
+
+        self.addStepNoEnv(ShellCommand,
+         name="client.py checkout",
+         command=['python', 'client.py', 'checkout']
+        )
+
+        self.addPrintMozillaChangesetStep()
+
+        self.addStep(ShellCommand,
+         name="clean configs",
+         command=['rm', '-rf', 'mozconfigs'],
+         workdir='.'
+        )
+
+        self.addStep(ShellCommand,
+         name="buildbot configs",
+         command=['hg', 'clone', self.config_repo_url, 'mozconfigs'],
+         workdir='.'
+        )
+
+        self.addCopyMozconfigStep()
+
+        self.addStep(ShellCommand, name='mozconfig contents',
+         command=['cat', '.mozconfig']
+        )
+
+        self.addStep(ShellCommand,
+         command=["make", "-f", "client.mk", "build"],
+         description=['compile'],
+         timeout=60*60, # 1 hour
+         haltOnFailure=1
+        )
+        self.addStep(ShellCommand,
+                     command=['make', 'buildsymbols'],
+                     workdir='build/%s' % self.objdir,
+                     )
+
+        self.addStep(SetProperty,
+         command=['bash', '-c', 'pwd'],
+         property='toolsdir',
+         workdir='tools'
+        )
+
+        platform_minidump_path = {
+            'linux': WithProperties('%(toolsdir:-)s/breakpad/linux/minidump_stackwalk'),
+            'win32': WithProperties('%(toolsdir:-)s/breakpad/win32/minidump_stackwalk.exe'),
+            'macosx': WithProperties('%(toolsdir:-)s/breakpad/osx/minidump_stackwalk'),
+            }
+
+        self.env['MINIDUMP_STACKWALK'] = platform_minidump_path[self.platform]
+
+        self.addPreTestSteps()
+
+        self.addStep(unittest_steps.MozillaCheck,
+         test_name="check",
+         warnOnWarnings=True,
+         workdir="build/%s" % self.objdir,
+         timeout=5*60, # 5 minutes.
+        )
+
+        self.addStep(unittest_steps.MozillaCheck,
+         test_name="xpcshell-tests",
+         warnOnWarnings=True,
+         workdir="build/%s" % self.objdir,
+         timeout=5*60, # 5 minutes.
+        )
+
+        if platform == 'win32':
+            self.addStep(unittest_steps.CreateProfileWin,
+             warnOnWarnings=True,
+             workdir="build",
+             command = r'python mozilla\testing\tools\profiles\createTestingProfile.py --clobber --binary %s\mozilla\dist\bin\%s.exe' %
+                          (self.objdir, self.productName),
+            )
+        else:
+            if platform == 'macosx':
+                app_run = '%s.app/Contents/MacOS/%s-bin' % (self.brandName, self.productName)
+            else:
+                app_run = 'bin/%s' % self.productName
+            self.addStep(unittest_steps.CreateProfile,
+             warnOnWarnings=True,
+             workdir="build",
+             command = r'python mozilla/testing/tools/profiles/createTestingProfile.py --clobber --binary %s/mozilla/dist/%s' %
+                          (self.objdir, app_run),
+            )
+
+        if self.exec_reftest_suites:
+            self.addStep(unittest_steps.MozillaReftest, warnOnWarnings=True,
+             test_name="reftest",
+             workdir="build/%s" % self.objdir,
+             timeout=5*60,
+            )
+            self.addStep(unittest_steps.MozillaReftest, warnOnWarnings=True,
+             test_name="crashtest",
+             workdir="build/%s" % self.objdir,
+            )
+
+        if self.exec_mochi_suites:
+            self.addStep(unittest_steps.MozillaMochitest, warnOnWarnings=True,
+             test_name="mochitest-plain",
+             workdir="build/%s" % self.objdir,
+             leakThreshold=self.mochitest_leak_threshold,
+             timeout=5*60,
+            )
+            self.addStep(unittest_steps.MozillaMochitest, warnOnWarnings=True,
+             test_name="mochitest-chrome",
+             workdir="build/%s" % self.objdir,
+             leakThreshold=self.mochichrome_leak_threshold,
+            )
+            self.addStep(unittest_steps.MozillaMochitest, warnOnWarnings=True,
+             test_name="mochitest-browser-chrome",
+             workdir="build/%s" % self.objdir,
+             leakThreshold=self.mochibrowser_leak_threshold,
+            )
+            # Don't run the a11y tests on MacOSX. (Bug 482598)
+            if not self.platform == 'macosx':
+              self.addStep(unittest_steps.MozillaMochitest, warnOnWarnings=True,
+               test_name="mochitest-a11y",
+               workdir="build/%s" % self.objdir,
+              )
+
+        self.addPostTestSteps()
+
+        if self.buildsBeforeReboot and self.buildsBeforeReboot > 0:
+            self.addPeriodicRebootSteps()
+
+    def addPrintChangesetStep(self):
+        changesetLink = '<a href=http://%s/%s/rev' % (self.hgHost, self.repoPath)
+        changesetLink += '/%(got_revision)s title="Built from revision %(got_revision)s">rev:%(got_revision)s</a>'
+        self.addStep(ShellCommand,
+         command=['echo', 'TinderboxPrint:', WithProperties(changesetLink)],
+        )
+
+    def addPrintMozillaChangesetStep(self):
+        self.addStep(SetProperty,
+         command=['hg', 'identify', '-i'],
+         workdir='build/mozilla',
+         property='hg_revision'
+        )
+        changesetLink = '<a href=http://%s/%s/rev' % (self.hgHost, self.mozRepoPath)
+        changesetLink += '/%(hg_revision)s title="Built from Mozilla revision %(hg_revision)s">moz:%(hg_revision)s</a>'
+        self.addStep(ShellCommand,
+         command=['echo', 'TinderboxPrint:', WithProperties(changesetLink)]
+        )
+
+    def addStep(self, *args, **kw):
+        kw.setdefault('env', self.env)
+        return BuildFactory.addStep(self, *args, **kw)
+
+    def addStepNoEnv(self, *args, **kw):
+        return BuildFactory.addStep(self, *args, **kw)
+
+    def addCopyMozconfigStep(self):
+        config_dir_map = {
+                'linux': 'linux/%s/unittest' % self.branchName,
+                'macosx': 'macosx/%s/unittest' % self.branchName,
+                'win32': 'win32/%s/unittest' % self.branchName,
+                }
+        mozconfig = 'mozconfigs/%s/%s/mozconfig' % \
+            (self.config_dir, config_dir_map[self.platform])
+
+        self.addStep(ShellCommand, name="copy mozconfig",
+         command=['cp', mozconfig, 'build/.mozconfig'],
+         description=['copy mozconfig'],
+         workdir='.'
+        )
+
+    def addPreTestSteps(self):
+        pass
+
+    def addPostTestSteps(self):
+        pass
+
 class CodeCoverageFactory(UnittestBuildFactory):
     def __init__(self, stageUsername=None, stageServer=None, stageSshKey=None,
             **kwargs):
         self.stageServer = stageServer
         self.stageUsername = stageUsername
         self.stageSshKey = stageSshKey
 
         UnittestBuildFactory.__init__(self, **kwargs)