Fix bug 1117637 - plugins and extensions moved to wrong directory by buildbotcustom. r=catlee
authorPhilipp Kewisch <mozilla@kewis.ch>
Mon, 19 Jan 2015 18:06:33 +0100 (2015-01-19)
changeset 4051 e5ba4d00f5d55672f5f5964780e94d3f753732c8
parent 4048 ef812b5bdee9c662eb15559bdf033e47bcee795a
child 4052 f74d08aada8def0b9aa3d97a2a2157583642980e
push id3356
push usermozilla@kewis.ch
push dateWed, 21 Jan 2015 17:07:48 +0000 (2015-01-21)
reviewerscatlee
bugs1117637
Fix bug 1117637 - plugins and extensions moved to wrong directory by buildbotcustom. r=catlee
misc.py
process/factory.py
steps/unittest.py
--- a/misc.py
+++ b/misc.py
@@ -852,16 +852,17 @@ def generateTestBuilder(config, branch_n
             platform=platform,
             test_suites=suites,
             mochitest_leak_threshold=mochitestLeakThreshold,
             crashtest_leak_threshold=crashtestLeakThreshold,
             hgHost=config['hghost'],
             repoPath=config['repo_path'],
             productName=productName,
             posixBinarySuffix=posixBinarySuffix,
+            macResSubdir=pf.get('mac_res_subdir', 'Resources'),
             buildToolsRepoPath=config['build_tools_repo_path'],
             buildSpace=1.0,
             buildsBeforeReboot=config['platforms'][
                 platform]['builds_before_reboot'],
             downloadSymbols=pf.get('download_symbols', False),
             downloadSymbolsOnDemand=pf.get(
                 'download_symbols_ondemand', True),
             env=pf.get('unittest-env', {}),
--- a/process/factory.py
+++ b/process/factory.py
@@ -4620,29 +4620,30 @@ def parse_sendchange_files(build, includ
     assert len(potential_files) == 1, 'Ambiguous testing sendchange!'
     return potential_files[0]
 
 
 class MozillaTestFactory(MozillaBuildFactory):
     def __init__(self, platform, productName='firefox',
                  downloadSymbols=True, downloadSymbolsOnDemand=True,
                  downloadTests=False, posixBinarySuffix='-bin',
-                 resetHwClock=False, **kwargs):
+                 resetHwClock=False, macResSubdir='Resources', **kwargs):
         # Note: the posixBinarySuffix is needed because some products (firefox)
         # use 'firefox-bin' and some (fennec) use 'fennec' for the name of the
         # actual application binary.  This is only applicable to posix-like
         # systems.  Windows always uses productName.exe (firefox.exe and
         # fennec.exe)
         self.platform = platform.split('-')[0]
         self.productName = productName
         if not posixBinarySuffix:
             # all forms of no should result in empty string
             self.posixBinarySuffix = ''
         else:
             self.posixBinarySuffix = posixBinarySuffix
+        self.macResSubdir = macResSubdir
         self.downloadSymbols = downloadSymbols
         self.downloadSymbolsOnDemand = downloadSymbolsOnDemand
         self.downloadTests = downloadTests
         self.resetHwClock = resetHwClock
 
         assert self.platform in getSupportedPlatforms()
 
         MozillaBuildFactory.__init__(self, **kwargs)
@@ -4744,16 +4745,29 @@ class MozillaTestFactory(MozillaBuildFac
 
         def get_exedir(build):
             return os.path.dirname(build.getProperty('exepath'))
         self.addStep(SetBuildProperty(
                      property_name="exedir",
                      value=get_exedir,
                      ))
 
+        # OSX 10.9.5+ requires putting extensions and plugins into
+        # Contents/Resources, this property sets up that directory.
+        def get_xredir(build):
+            if self.platform.startswith("macosx"):
+                contentsdir = os.path.dirname(get_exedir(build))
+                return os.path.join(contentsdir, self.macResSubdir)
+            else:
+                return get_exedir(build)
+        self.addStep(SetBuildProperty(
+                     property_name="xredir",
+                     value=get_xredir,
+                     ))
+
         # Need to override toolsdir as set by MozillaBuildFactory because
         # we need Windows-style paths for the stack walker.
         if self.platform.startswith('win'):
             self.addStep(SetProperty(
                          command=['bash', '-c', 'pwd -W'],
                          property='toolsdir',
                          workdir='tools'
                          ))
@@ -4822,17 +4836,17 @@ class MozillaTestFactory(MozillaBuildFac
             retval = {}
             stdout = "\n".join([stdout, stderr])
             m = re.search("^buildid: (\w+)", stdout, re.M)
             if m:
                 retval['buildid'] = m.group(1)
             return retval
         self.addStep(SetProperty(
                      command=['python', WithProperties('%(toolsdir)s/buildfarm/utils/printbuildrev.py'),
-                              WithProperties('%(exedir)s')],
+                              WithProperties('%(xredir)s')],
                      workdir='build',
                      extract_fn=get_build_info,
                      name='get build info',
                      ))
 
     def addSetupSteps(self):
         '''This stub is for implementing classes to do harness specific setup'''
         pass
@@ -5001,20 +5015,20 @@ class UnittestPackagedBuildFactory(Mozil
                     ))
                 self.addStep(UnpackTest(
                              filename=WithProperties('%(tests_filename)s'),
                              testtype='mozmill',
                              haltOnFailure=True,
                              name='unpack mozmill tests',
                              ))
 
-                installscript = " && ".join(["if [ ! -d %(exedir)s/plugins ]; then mkdir %(exedir)s/plugins; fi",
-                                             "if [ ! -d %(exedir)s/extensions ]; then mkdir %(exedir)s/extensions; fi",
-                                             "cp -R bin/plugins/* %(exedir)s/plugins/",
-                                             "if [ -d extensions ]; then cp -R extensions/* %(exedir)s/extensions/; fi"])
+                installscript = " && ".join(["if [ ! -d %(xredir)s/plugins ]; then mkdir %(xredir)s/plugins; fi",
+                                             "if [ ! -d %(xredir)s/extensions ]; then mkdir %(xredir)s/extensions; fi",
+                                             "cp -R bin/plugins/* %(xredir)s/plugins/",
+                                             "if [ -d extensions ]; then cp -R extensions/* %(xredir)s/extensions/; fi"])
                 self.addStep(ShellCommand(
                              name='install plugins and extensions',
                              command=['sh', '-c', WithProperties(installscript)],
                              haltOnFailure=True,
                              ))
 
                 # Older comm-central branches use a centrally-installed
                 # MozMill. We figure this out by seeing if installmozmill.py is
--- a/steps/unittest.py
+++ b/steps/unittest.py
@@ -491,26 +491,26 @@ class MozillaPackagedXPCShellTests(XPCSh
         self.super_class = ShellCommandReportTimeout
         ShellCommandReportTimeout.__init__(self, **kwargs)
 
         self.addFactoryArguments(platform=platform, symbols_path=symbols_path)
 
         bin_extension = ""
         if platform.startswith('win'):
             bin_extension = ".exe"
-        script = " && ".join(["if [ ! -d %(exedir)s/plugins ]; then mkdir %(exedir)s/plugins; fi",
-                              "if [ ! -d %(exedir)s/components ]; then mkdir %(exedir)s/components; fi",
-                              "if [ ! -d %(exedir)s/extensions ]; then mkdir %(exedir)s/extensions; fi",
+        script = " && ".join(["if [ ! -d %(xredir)s/plugins ]; then mkdir %(xredir)s/plugins; fi",
+                              "if [ ! -d %(xredir)s/components ]; then mkdir %(xredir)s/components; fi",
+                              "if [ ! -d %(xredir)s/extensions ]; then mkdir %(xredir)s/extensions; fi",
                               "cp bin/xpcshell" +
                               bin_extension + " %(exedir)s",
                               "cp bin/ssltunnel" +
                               bin_extension + " %(exedir)s",
-                              "cp -R bin/components/* %(exedir)s/components/",
-                              "cp -R bin/plugins/* %(exedir)s/plugins/",
-                              "if [ -d extensions ]; then cp -R extensions/* %(exedir)s/extensions/; fi",
+                              "cp -R bin/components/* %(xredir)s/components/",
+                              "cp -R bin/plugins/* %(xredir)s/plugins/",
+                              "if [ -d extensions ]; then cp -R extensions/* %(xredir)s/extensions/; fi",
                               "python -u xpcshell/runxpcshelltests.py"])
 
         if symbols_path:
             script += " --symbols-path=%s" % symbols_path
         script += " --manifest=xpcshell/tests/all-test-dirs.list %(exedir)s/xpcshell" + bin_extension
 
         self.command = ['bash', '-c', WithProperties(script)]