Bug 811068 - Copy ^headers^ file in importTestsuite.py; r=jhammel (DONTBUILD)
authorMs2ger <ms2ger@gmail.com>
Mon, 12 Nov 2012 23:20:19 +0100
changeset 112979 b857905d82b45456853866330c98b372b14f20db
parent 112978 96e7580fb756584faa1e59644af537b85bb7c4b3
child 113027 7c8fa27e95be7dfa24a8123b0dfcc6a391446580
child 113042 c958c734e3d3580033d33fb406db26e53c646c94
push id23846
push userMs2ger@gmail.com
push dateMon, 12 Nov 2012 22:21:12 +0000
treeherdermozilla-central@b857905d82b4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjhammel
bugs811068
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 811068 - Copy ^headers^ file in importTestsuite.py; r=jhammel (DONTBUILD)
dom/imptests/importTestsuite.py
--- a/dom/imptests/importTestsuite.py
+++ b/dom/imptests/importTestsuite.py
@@ -15,16 +15,18 @@ from __future__ import print_function, u
 import os
 import shutil
 import subprocess
 import sys
 
 import parseManifest
 import writeMakefile
 
+HEADERS_SUFFIX = "^headers^"
+
 def parseManifestFile(dest, dir):
   subdirs, mochitests, _, __, supportfiles = parseManifest.parseManifestFile("hg-%s/%s/MANIFEST" % (dest, dir))
   return subdirs, mochitests, supportfiles
 
 def getData(confFile):
   """This function parses a file of the form
   URL of remote repository|Name of the destination directory
   First directory of tests
@@ -49,31 +51,38 @@ def getData(confFile):
     return repo, dest, directories
 
 def makePath(a, b):
   if not b:
     # Empty directory, i.e., the repository root.
     return a
   return "%s/%s" % (a, b)
 
+def copyTest(source, dest):
+  """Copy the file at source to dest, as well as any ^headers^ file associated
+  with it."""
+  shutil.copy(source, dest)
+  if os.path.exists(source + HEADERS_SUFFIX):
+    shutil.copy(source + HEADERS_SUFFIX, dest + HEADERS_SUFFIX)
+
 def copy(thissrcdir, dest, directories):
   """Copy mochitests and support files from the external HG directory to their
   place in mozilla-central.
   """
   print("Copying %s..." % directories)
   for d in directories:
     subdirs, mochitests, supportfiles = parseManifestFile(dest, d)
     sourcedir = makePath("hg-%s" % dest, d)
     destdir = makePath(dest, d)
     os.makedirs(destdir)
 
     for mochitest in mochitests:
-      shutil.copy("%s/%s" % (sourcedir, mochitest), "%s/test_%s" % (destdir, mochitest))
+      copyTest("%s/%s" % (sourcedir, mochitest), "%s/test_%s" % (destdir, mochitest))
     for support in supportfiles:
-      shutil.copy("%s/%s" % (sourcedir, support), "%s/%s" % (destdir, support))
+      copyTest("%s/%s" % (sourcedir, support), "%s/%s" % (destdir, support))
 
     if len(subdirs):
       if d:
         importDirs(thissrcdir, dest, ["%s/%s" % (d, subdir) for subdir in subdirs])
       else:
         # Empty directory, i.e., the repository root
         importDirs(thissrcdir, dest, subdirs)
 
@@ -97,16 +106,17 @@ def printMakefiles(thissrcdir, dest, dir
   for d in directories:
     path = makePath(dest, d)
     print("Creating Makefile.in in %s..." % path)
 
     subdirs, mochitests, supportfiles = parseManifestFile(dest, d)
 
     files = ["test_%s" % (mochitest, ) for mochitest in mochitests]
     files.extend(supportfiles)
+    files.extend(f for f in os.listdir(path) if f.endswith(HEADERS_SUFFIX))
 
     result = writeMakefile.substMakefile("importTestsuite.py", subdirs, files)
 
     fp = open(path + "/Makefile.in", "w")
     fp.write(result)
     fp.close()
 
 def hgadd(dest, directories):