--- a/dom/imptests/importTestsuite.py
+++ b/dom/imptests/importTestsuite.py
@@ -18,25 +18,26 @@ import subprocess
import sys
import parseManifest
import writeBuildFiles
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
+ subdirs, mochitests, reftests, _, supportfiles = parseManifest.parseManifestFile(pathstr)
+ return subdirs, mochitests, reftests, supportfiles
data = []
for path in dirs:
- subdirs, mochitests, supportfiles = parseManifestFile(iden, path)
+ subdirs, mochitests, reftests, supportfiles = parseManifestFile(iden, path)
data.append({
"path": path,
"mochitests": mochitests,
+ "reftests": reftests,
"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
@@ -81,28 +82,40 @@ def makeDestPath(a, b):
path = path.replace('document.getElementsByName', 'doc.gEBN')
path = path.replace('requirements-for-implementations', 'implreq')
path = path.replace('other-elements-attributes-and-apis', 'oeaaa')
return path
return shorten(makePathInternal(a, b))
+def extractReftestFiles(reftests):
+ """Returns the set of files referenced in the reftests argument"""
+ files = set()
+ for line in reftests:
+ files.update([line[1], line[2]])
+ return files
+
+
def copy(dest, directories):
"""Copy mochitests and support files from the external HG directory to their
place in mozilla-central.
"""
print("Copying tests...")
for d in directories:
sourcedir = makeSourcePath(dest, d["path"])
destdir = makeDestPath(dest, d["path"])
os.makedirs(destdir)
+ reftestfiles = extractReftestFiles(d["reftests"])
+
for mochitest in d["mochitests"]:
shutil.copy("%s/%s" % (sourcedir, mochitest), "%s/test_%s" % (destdir, mochitest))
+ for reftest in sorted(reftestfiles):
+ shutil.copy("%s/%s" % (sourcedir, reftest), "%s/%s" % (destdir, reftest))
for support in d["supportfiles"]:
shutil.copy("%s/%s" % (sourcedir, support), "%s/%s" % (destdir, support))
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...")
@@ -128,16 +141,22 @@ def printBuildFiles(dest, directories):
with open(path + "/Makefile.in", "w") as fh:
result = writeBuildFiles.substMakefile("importTestsuite.py", files)
fh.write(result)
with open(path + "/moz.build", "w") as fh:
result = writeBuildFiles.substMozbuild("importTestsuite.py", [])
fh.write(result)
+ if d["reftests"]:
+ with open(path + "/reftest.list", "w") as fh:
+ result = writeBuildFiles.substReftestList("importTestsuite.py",
+ d["reftests"])
+ 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", makeDestPath(dest, d)])
def removeAndCloneRepo(vcs, url, dest):
--- a/dom/imptests/writeBuildFiles.py
+++ b/dom/imptests/writeBuildFiles.py
@@ -22,16 +22,21 @@ include $$(DEPTH)/config/autoconf.mk
include $$(topsrcdir)/config/rules.mk
"""
mozbuild_template = """# THIS FILE IS AUTOGENERATED BY ${caller} - DO NOT EDIT
${dirs}
"""
+reftest_template = """# THIS FILE IS AUTOGENERATED BY ${caller} - DO NOT EDIT
+
+${reftests}
+"""
+
def makefileString(entries):
if not len(entries):
return " $(NULL)"
return "\n".join([" %s \\" % (entry, ) for entry in entries]) + "\n $(NULL)"
@@ -56,8 +61,18 @@ def substMakefile(caller, files):
def substMozbuild(caller, dirs):
return string.Template(mozbuild_template).substitute({
"caller": caller,
"dirs": mozbuildDirs(dirs),
})
+
+def substReftestList(caller, tests):
+ def reftests(tests):
+ return "\n".join(" ".join(line) for line in tests)
+
+ return string.Template(reftest_template).substitute({
+ "caller": caller,
+ "reftests": reftests(tests),
+ })
+