mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 20:49:27 +00:00
Bug 756083 - Part a: Factor out Makefile utilities; r=jhammel
This commit is contained in:
parent
2dfe3e8c29
commit
7cb14a31d1
@ -49,6 +49,10 @@ Source; Usage and purpose; License
|
||||
use with outstanding changes in either directory.
|
||||
MPL
|
||||
|
||||
* writeMakefile.py
|
||||
Helper functions to write out Makefiles.
|
||||
MPL
|
||||
|
||||
* Makefile.in
|
||||
Integration with our build system. Installs support files into /resources and
|
||||
includes a .mk file for each repository.
|
||||
|
@ -16,13 +16,10 @@ DIRS = \
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TESTS = \
|
||||
$(NULL)
|
||||
|
||||
_TESTS += \
|
||||
_FILES = \
|
||||
implementation.js \
|
||||
tests.js \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TESTS)
|
||||
libs:: $(_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
@ -13,14 +13,11 @@ DIRS = \
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TESTS = \
|
||||
_FILES = \
|
||||
test_runtest.html \
|
||||
test_event.html \
|
||||
$(NULL)
|
||||
|
||||
_TESTS += \
|
||||
data.js \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TESTS)
|
||||
libs:: $(_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
@ -13,12 +13,9 @@ DIRS = \
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TESTS = \
|
||||
$(NULL)
|
||||
|
||||
_TESTS += \
|
||||
_FILES = \
|
||||
reset.css \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TESTS)
|
||||
libs:: $(_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
@ -13,7 +13,7 @@ DIRS = \
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TESTS = \
|
||||
_FILES = \
|
||||
test_addRange.html \
|
||||
test_collapse.html \
|
||||
test_collapseToStartEnd.html \
|
||||
@ -26,12 +26,9 @@ _TESTS = \
|
||||
test_isCollapsed.html \
|
||||
test_removeAllRanges.html \
|
||||
test_selectAllChildren.html \
|
||||
$(NULL)
|
||||
|
||||
_TESTS += \
|
||||
common.js \
|
||||
test-iframe.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TESTS)
|
||||
libs:: $(_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
@ -13,7 +13,7 @@ DIRS = \
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TESTS = \
|
||||
_FILES = \
|
||||
test_body-onload.html \
|
||||
test_pageload-image.html \
|
||||
test_pageload-video.html \
|
||||
@ -21,11 +21,8 @@ _TESTS = \
|
||||
test_window-onerror-parse-error.html \
|
||||
test_window-onerror-runtime-error.html \
|
||||
test_window-onerror-runtime-error-throw.html \
|
||||
$(NULL)
|
||||
|
||||
_TESTS += \
|
||||
nested-document-write-external.js \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TESTS)
|
||||
libs:: $(_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
@ -13,12 +13,9 @@ DIRS = \
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TESTS = \
|
||||
_FILES = \
|
||||
test_001.html \
|
||||
$(NULL)
|
||||
|
||||
_TESTS += \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TESTS)
|
||||
libs:: $(_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
@ -17,6 +17,7 @@ import subprocess
|
||||
import sys
|
||||
|
||||
import parseManifest
|
||||
import writeMakefile
|
||||
|
||||
def parseManifestFile(dest, dir):
|
||||
subdirs, mochitests, _, __, supportfiles = parseManifest.parseManifestFile("hg-%s/%s/MANIFEST" % (dest, dir))
|
||||
@ -77,11 +78,6 @@ def copy(thissrcdir, dest, directories):
|
||||
# Empty directory, i.e., the repository root
|
||||
importDirs(thissrcdir, dest, subdirs)
|
||||
|
||||
def makefileString(entries):
|
||||
if not len(entries):
|
||||
return " $(NULL)"
|
||||
return "\n".join([" %s \\" % (entry, ) for entry in entries]) + "\n $(NULL)"
|
||||
|
||||
def printMakefile(dest, directories):
|
||||
"""Create a .mk file to be included into the main Makefile.in, which lists the
|
||||
directories with tests.
|
||||
@ -90,37 +86,11 @@ def printMakefile(dest, directories):
|
||||
path = dest + ".mk"
|
||||
fp = open(path, "wb")
|
||||
fp.write("DIRS += \\\n")
|
||||
fp.write(makefileString([makePath(dest, d) for d in directories]))
|
||||
fp.write(writeMakefile.makefileString([makePath(dest, d) for d in directories]))
|
||||
fp.write("\n")
|
||||
fp.close()
|
||||
subprocess.check_call(["hg", "add", path])
|
||||
|
||||
makefileTemplate = """# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
|
||||
|
||||
DEPTH = ${depth}
|
||||
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = ${relativesrcdir}
|
||||
|
||||
DIRS = \\
|
||||
${dirs}
|
||||
|
||||
include $$(DEPTH)/config/autoconf.mk
|
||||
include $$(topsrcdir)/config/rules.mk
|
||||
"""
|
||||
testsTemplate = """
|
||||
_TESTS = \\
|
||||
${tests}
|
||||
|
||||
_TESTS += \\
|
||||
${support}
|
||||
|
||||
libs:: $$(_TESTS)
|
||||
\t$$(INSTALL) $$(foreach f,$$^,"$$f") $$(DEPTH)/_tests/testing/mochitest/tests/$$(relativesrcdir)
|
||||
"""
|
||||
|
||||
def printMakefiles(thissrcdir, dest, directories):
|
||||
"""Create Makefile.in files for each directory that contains tests we import.
|
||||
"""
|
||||
@ -131,24 +101,17 @@ def printMakefiles(thissrcdir, dest, directories):
|
||||
else:
|
||||
# Empty directory, i.e., the repository root
|
||||
path = dest
|
||||
abspath = "%s/%s" % (thissrcdir, path)
|
||||
print "Creating Makefile.in in %s..." % (path, )
|
||||
|
||||
subdirs, mochitests, supportfiles = parseManifestFile(dest, d)
|
||||
|
||||
abspath = "%s/%s" % (thissrcdir, path)
|
||||
files = ["test_%s" % (mochitest, ) for mochitest in mochitests]
|
||||
files.extend(supportfiles)
|
||||
|
||||
result = writeMakefile.substMakefile("importTestsuite.py", abspath, subdirs, files)
|
||||
|
||||
fp = open(path + "/Makefile.in", "wb")
|
||||
result = string.Template(makefileTemplate).substitute({
|
||||
"depth": "..%s" % ("/.." * abspath.count("/"), ),
|
||||
"relativesrcdir": "%s/%s" % (thissrcdir, path),
|
||||
"dirs": makefileString(subdirs)
|
||||
})
|
||||
|
||||
if len(mochitests) + len(supportfiles):
|
||||
result += string.Template(testsTemplate).substitute({
|
||||
"tests": makefileString(["test_%s" % (mochitest, ) for mochitest in mochitests]),
|
||||
"support": makefileString(supportfiles)
|
||||
})
|
||||
|
||||
fp.write(result)
|
||||
fp.close()
|
||||
|
||||
|
@ -13,7 +13,7 @@ DIRS = \
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TESTS = \
|
||||
_FILES = \
|
||||
test_interfaces.html \
|
||||
test_Range-cloneContents.html \
|
||||
test_Range-cloneRange.html \
|
||||
@ -30,12 +30,9 @@ _TESTS = \
|
||||
test_Range-selectNode.html \
|
||||
test_Range-set.html \
|
||||
test_Range-surroundContents.html \
|
||||
$(NULL)
|
||||
|
||||
_TESTS += \
|
||||
common.js \
|
||||
Range-test-iframe.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TESTS)
|
||||
libs:: $(_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
@ -13,7 +13,7 @@ DIRS = \
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TESTS = \
|
||||
_FILES = \
|
||||
test_getElementsByClassName-01.htm \
|
||||
test_getElementsByClassName-02.htm \
|
||||
test_getElementsByClassName-03.htm \
|
||||
@ -34,8 +34,5 @@ _TESTS = \
|
||||
test_getElementsByClassName-18.htm \
|
||||
$(NULL)
|
||||
|
||||
_TESTS += \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TESTS)
|
||||
libs:: $(_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
@ -14,7 +14,7 @@ DIRS = \
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TESTS = \
|
||||
_FILES = \
|
||||
test_event_constructor.html \
|
||||
test_event_local_key.html \
|
||||
test_event_local_newvalue.html \
|
||||
@ -43,8 +43,5 @@ _TESTS = \
|
||||
test_storage_session_setitem.html \
|
||||
$(NULL)
|
||||
|
||||
_TESTS += \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TESTS)
|
||||
libs:: $(_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
@ -13,10 +13,7 @@ DIRS = \
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TESTS = \
|
||||
$(NULL)
|
||||
|
||||
_TESTS += \
|
||||
_FILES = \
|
||||
local_change_item_iframe.html \
|
||||
local_security_iframe.html \
|
||||
local_set_item_clear_iframe.html \
|
||||
@ -26,5 +23,5 @@ _TESTS += \
|
||||
session_set_item_iframe.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TESTS)
|
||||
libs:: $(_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
@ -13,7 +13,7 @@ DIRS = \
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TESTS = \
|
||||
_FILES = \
|
||||
test_event_constructor_js.html \
|
||||
test_missing_arguments.html \
|
||||
test_storage_local_clear_js.html \
|
||||
@ -32,8 +32,5 @@ _TESTS = \
|
||||
test_storage_session_setitem_js.html \
|
||||
$(NULL)
|
||||
|
||||
_TESTS += \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TESTS)
|
||||
libs:: $(_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
@ -13,13 +13,10 @@ DIRS = \
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TESTS = \
|
||||
_FILES = \
|
||||
test_interfaces.html \
|
||||
test_setrequestheader-invalid-arguments.htm \
|
||||
$(NULL)
|
||||
|
||||
_TESTS += \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TESTS)
|
||||
libs:: $(_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
49
dom/imptests/writeMakefile.py
Normal file
49
dom/imptests/writeMakefile.py
Normal file
@ -0,0 +1,49 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import string
|
||||
|
||||
makefileTemplate = """# THIS FILE IS AUTOGENERATED BY ${caller} - DO NOT EDIT
|
||||
|
||||
DEPTH = ${depth}
|
||||
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = ${relativesrcdir}
|
||||
|
||||
DIRS = \\
|
||||
${dirs}
|
||||
|
||||
include $$(DEPTH)/config/autoconf.mk
|
||||
include $$(topsrcdir)/config/rules.mk
|
||||
"""
|
||||
|
||||
filesTemplate = """
|
||||
_FILES = \\
|
||||
${files}
|
||||
|
||||
libs:: $$(_FILES)
|
||||
\t$$(INSTALL) $$(foreach f,$$^,"$$f") $$(DEPTH)/_tests/testing/mochitest/tests/$$(relativesrcdir)
|
||||
"""
|
||||
|
||||
def makefileString(entries):
|
||||
if not len(entries):
|
||||
return " $(NULL)"
|
||||
return "\n".join([" %s \\" % (entry, ) for entry in entries]) + "\n $(NULL)"
|
||||
|
||||
def substMakefile(caller, path, subdirs, files):
|
||||
result = string.Template(makefileTemplate).substitute({
|
||||
"caller": caller,
|
||||
"depth": "..%s" % ("/.." * path.count("/"), ),
|
||||
"relativesrcdir": path,
|
||||
"dirs": makefileString(subdirs)
|
||||
})
|
||||
|
||||
if files:
|
||||
result += string.Template(filesTemplate).substitute({
|
||||
"files": makefileString(files)
|
||||
})
|
||||
|
||||
return result
|
Loading…
x
Reference in New Issue
Block a user