Bug 866424 - Part g: Derecursify the importing of test suites; r=jhammel
authorMs2ger <ms2ger@gmail.com>
Fri, 10 May 2013 09:12:13 +0200
changeset 142316 870596f541f258d10d0359284b0f16fe863b2596
parent 142315 616de9bdf29c85dc4f4b959de0778d570be55a30
child 142317 eb2c1eb6ef5938db73823eca7d3bdaea6b931e27
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjhammel
bugs866424
milestone23.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 866424 - Part g: Derecursify the importing of test suites; r=jhammel
dom/imptests/html.mozbuild
dom/imptests/html/html/browsers/the-window-object/moz.build
dom/imptests/html/html/dom/documents/dom-tree-accessors/moz.build
dom/imptests/importTestsuite.py
--- a/dom/imptests/html.mozbuild
+++ b/dom/imptests/html.mozbuild
@@ -1,15 +1,17 @@
 # THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
 
 DIRS += [
     'html/domxpath',
     'html/html/browsers/browsing-the-web/read-media',
     'html/html/browsers/the-window-object',
+    'html/html/browsers/the-window-object/named-access-on-the-window-object',
     'html/html/dom/documents/dom-tree-accessors',
+    'html/html/dom/documents/dom-tree-accessors/document.getElementsByName',
     'html/html/dom/elements/global-attributes',
     'html/html/editing/the-hidden-attribute',
     'html/html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis',
     'html/html/semantics/document-metadata/the-title-element',
     'html/html/semantics/forms/the-form-element',
     'html/html/semantics/forms/the-option-element',
     'html/html/semantics/forms/the-select-element',
     'html/html/semantics/scripting-1/the-script-element',
--- a/dom/imptests/html/html/browsers/the-window-object/moz.build
+++ b/dom/imptests/html/html/browsers/the-window-object/moz.build
@@ -1,5 +1,4 @@
 # THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
 
 DIRS += [
-    'named-access-on-the-window-object',
 ]
--- a/dom/imptests/html/html/dom/documents/dom-tree-accessors/moz.build
+++ b/dom/imptests/html/html/dom/documents/dom-tree-accessors/moz.build
@@ -1,5 +1,4 @@
 # THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
 
 DIRS += [
-    'document.getElementsByName',
 ]
--- a/dom/imptests/importTestsuite.py
+++ b/dom/imptests/importTestsuite.py
@@ -15,19 +15,33 @@ from __future__ import print_function, u
 import os
 import shutil
 import subprocess
 import sys
 
 import parseManifest
 import writeBuildFiles
 
-def parseManifestFile(dest, dir):
-    subdirs, mochitests, _, __, supportfiles = parseManifest.parseManifestFile("hg-%s/%s/MANIFEST" % (dest, dir))
-    return subdirs, mochitests, supportfiles
+def readManifests(iden, dirs):
+    def parseManifestFile(iden, path):
+        pathstr = "hg-%s/%s/MANIFEST" % (iden, path)
+        subdirs, mochitests, _, __, supportfiles = parseManifest.parseManifestFile(pathstr)
+        return subdirs, mochitests, supportfiles
+
+    data = []
+    for path in dirs:
+        subdirs, mochitests, supportfiles = parseManifestFile(iden, path)
+        data.append({
+          "path": path,
+          "mochitests": mochitests,
+          "supportfiles": supportfiles,
+        })
+        data.extend(readManifests(iden, ["%s/%s" % (path, d) for d in subdirs]))
+    return data
+
 
 def getData(confFile):
     """This function parses a file of the form
     (hg or git)|URL of remote repository|identifier for the local directory
     First directory of tests
     ...
     Last directory of tests"""
     vcs = ""
@@ -51,83 +65,66 @@ def makePath(a, b):
         # Empty directory, i.e., the repository root.
         return a
     return "%s/%s" % (a, b)
 
 def copy(dest, directories):
     """Copy mochitests and support files from the external HG directory to their
     place in mozilla-central.
     """
-    print("Copying %s..." % directories)
+    print("Copying tests...")
     for d in directories:
-        subdirs, mochitests, supportfiles = parseManifestFile(dest, d)
-        sourcedir = makePath("hg-%s" % dest, d)
-        destdir = makePath(dest, d)
+        sourcedir = makePath("hg-%s" % dest, d["path"])
+        destdir = makePath(dest, d["path"])
         os.makedirs(destdir)
 
-        for mochitest in mochitests:
+        for mochitest in d["mochitests"]:
             shutil.copy("%s/%s" % (sourcedir, mochitest), "%s/test_%s" % (destdir, mochitest))
-        for support in supportfiles:
+        for support in d["supportfiles"]:
             shutil.copy("%s/%s" % (sourcedir, support), "%s/%s" % (destdir, support))
 
-        if len(subdirs):
-            if d:
-                importDirs(dest, ["%s/%s" % (d, subdir) for subdir in subdirs])
-            else:
-                # Empty directory, i.e., the repository root
-                importDirs(dest, subdirs)
-
 def printMozbuildFile(dest, directories):
     """Create a .mozbuild file to be included into the main moz.build, which
     lists the directories with tests.
     """
     print("Creating mozbuild...")
     path = dest + ".mozbuild"
     with open(path, 'w') as fh:
-        normalized = [makePath(dest, d) for d in directories]
+        normalized = [makePath(dest, d["path"]) for d in directories]
         result = writeBuildFiles.substMozbuild("importTestsuite.py",
             normalized)
         fh.write(result)
 
     subprocess.check_call(["hg", "add", path])
 
 def printBuildFiles(dest, directories):
     """Create Makefile.in files for each directory that contains tests we import.
     """
     print("Creating build files...")
     for d in directories:
-        path = makePath(dest, d)
-        print("Creating Makefile.in in %s..." % path)
+        path = makePath(dest, d["path"])
 
-        subdirs, mochitests, supportfiles = parseManifestFile(dest, d)
-
-        files = ["test_%s" % (mochitest, ) for mochitest in mochitests]
-        files.extend(supportfiles)
+        files = ["test_%s" % (mochitest, ) for mochitest in d["mochitests"]]
+        files.extend(d["supportfiles"])
 
         with open(path + "/Makefile.in", "w") as fh:
             result = writeBuildFiles.substMakefile("importTestsuite.py", files)
             fh.write(result)
 
-        print("Creating moz.build in %s..." % path)
         with open(path + "/moz.build", "w") as fh:
-            result = writeBuildFiles.substMozbuild("importTestsuite.py",
-                subdirs)
+            result = writeBuildFiles.substMozbuild("importTestsuite.py", [])
             fh.write(result)
 
 
 def hgadd(dest, directories):
     """Inform hg of the files in |directories|."""
     print("hg addremoving...")
     for d in directories:
         subprocess.check_call(["hg", "addremove", "%s/%s" % (dest, d)])
 
-def importDirs(dest, directories):
-    copy(dest, directories)
-    printBuildFiles(dest, directories)
-
 def removeAndCloneRepo(vcs, url, dest):
     """Replaces the repo at dest by a fresh clone from url using vcs"""
     assert vcs in ('hg', 'git')
 
     print("Removing %s..." % dest)
     subprocess.check_call(["rm", "-rf", dest])
 
     print("Cloning %s to %s with %s..." % (url, dest, vcs))
@@ -139,19 +136,22 @@ def importRepo(confFile):
         dest = iden
         hgdest = "hg-%s" % iden
 
         print("Removing %s..." % dest)
         subprocess.check_call(["rm", "-rf", dest])
 
         removeAndCloneRepo(vcs, url, hgdest)
 
-        print("Going to import %s..." % directories)
-        importDirs(dest, directories)
-        printMozbuildFile(dest, directories)
+        data = readManifests(iden, directories)
+        print("Going to import %s..." % [d["path"] for d in data])
+
+        copy(dest, data)
+        printBuildFiles(dest, data)
+        printMozbuildFile(dest, data)
         hgadd(dest, directories)
         print("Removing %s again..." % hgdest)
         subprocess.check_call(["rm", "-rf", hgdest])
     except subprocess.CalledProcessError as e:
         print(e.returncode)
     finally:
         print("Done")