зеркало из https://github.com/mozilla/gecko-dev.git
Bug 918011 part 2. Preprocess some of our test WebIDL files so we can have debug-only tests. r=khuey
This commit is contained in:
Родитель
a22f746363
Коммит
9938e4eef7
|
@ -23,7 +23,7 @@ exported_generated_events_headers := $(subst .webidl,.h,$(generated_events_webid
|
|||
linked_binding_cpp_files := $(subst .webidl,Binding.cpp,$(all_webidl_files))
|
||||
linked_generated_events_cpp_files := $(subst .webidl,.cpp,$(generated_events_webidl_files))
|
||||
|
||||
all_webidl_files += $(test_webidl_files)
|
||||
all_webidl_files += $(test_webidl_files) $(preprocessed_test_webidl_files)
|
||||
|
||||
generated_header_files := $(subst .webidl,Binding.h,$(all_webidl_files)) $(exported_generated_events_headers)
|
||||
generated_cpp_files := $(subst .webidl,Binding.cpp,$(all_webidl_files)) $(linked_generated_events_cpp_files)
|
||||
|
@ -168,6 +168,12 @@ $(preprocessed_webidl_files): %: $(webidl_base)/% $(GLOBAL_DEPS)
|
|||
PYTHONDONTWRITEBYTECODE=1 $(PYTHON) \
|
||||
$(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $(webidl_base)/$* -o $@
|
||||
|
||||
# See the comment about PP_TARGETS for $(preprocessed_webidl_files)
|
||||
$(preprocessed_test_webidl_files): %: $(srcdir)/test/% $(GLOBAL_DEPS)
|
||||
$(RM) $@
|
||||
PYTHONDONTWRITEBYTECODE=1 $(PYTHON) \
|
||||
$(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $(srcdir)/test/$* -o $@
|
||||
|
||||
# Make is dumb and can get confused between "foo" and "$(CURDIR)/foo". Make
|
||||
# sure that the latter depends on the former, since the latter gets used in .pp
|
||||
# files.
|
||||
|
|
|
@ -13,11 +13,15 @@ endif
|
|||
# Need this to find all our DOM source files.
|
||||
include $(topsrcdir)/dom/dom-config.mk
|
||||
|
||||
# And need this for $(test_webidl_files)
|
||||
# And need this for $(test_webidl_files) and $(preprocessed_test_webidl_files)
|
||||
include ../webidlsrcs.mk
|
||||
|
||||
# But the webidl actually lives in our parent dir
|
||||
test_webidl_files := $(addprefix ../,$(test_webidl_files))
|
||||
# Store the actual locations of our source preprocessed files, so we
|
||||
# can depend on them sanely.
|
||||
source_preprocessed_test_webidl_files := $(addprefix $(srcdir)/,$(preprocessed_test_webidl_files))
|
||||
preprocessed_test_webidl_files := $(addprefix ../,$(preprocessed_test_webidl_files))
|
||||
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(topsrcdir)/js/xpconnect/src \
|
||||
|
@ -89,6 +93,7 @@ $(CPPSRCS): .BindingGen
|
|||
|
||||
.BindingGen: $(bindinggen_dependencies) \
|
||||
$(test_webidl_files) \
|
||||
$(source_preprocessed_test_webidl_files) \
|
||||
$(NULL)
|
||||
# The export phase in dom/bindings is what actually looks at
|
||||
# dependencies and regenerates things as needed, so just go ahead and
|
||||
|
|
|
@ -502,6 +502,16 @@ public:
|
|||
returnValue.SetAsLong() = i;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
void PassUnion2(const LongOrBoolean& arg);
|
||||
void PassUnion3(JSContext*, const ObjectOrLongOrBoolean& arg);
|
||||
void PassUnion4(const NodeOrLongOrBoolean& arg);
|
||||
void PassUnion5(JSContext*, const ObjectOrBoolean& arg);
|
||||
void PassUnion6(JSContext*, const ObjectOrString& arg);
|
||||
void PassUnion7(JSContext*, const ObjectOrStringOrLong& arg);
|
||||
void PassUnion8(JSContext*, const ObjectOrStringOrBoolean& arg);
|
||||
void PassUnion9(JSContext*, const ObjectOrStringOrLongOrBoolean& arg);
|
||||
#endif
|
||||
void PassNullableUnion(JSContext*, const Nullable<ObjectOrLong>&);
|
||||
void PassOptionalUnion(JSContext*, const Optional<ObjectOrLong>&);
|
||||
void PassOptionalNullableUnion(JSContext*, const Optional<Nullable<ObjectOrLong> >&);
|
||||
|
|
|
@ -440,15 +440,18 @@ interface TestInterface {
|
|||
|
||||
// Union types
|
||||
void passUnion((object or long) arg);
|
||||
// Commented out tests 2-9 to avoid creating all those unused union types
|
||||
/* void passUnion2((long or boolean) arg);
|
||||
// Some union tests are debug-only to avoid creating all those
|
||||
// unused union types in opt builds.
|
||||
#ifdef DEBUG
|
||||
void passUnion2((long or boolean) arg);
|
||||
void passUnion3((object or long or boolean) arg);
|
||||
void passUnion4((Node or long or boolean) arg);
|
||||
void passUnion5((object or boolean) arg);
|
||||
void passUnion6((object or DOMString) arg);
|
||||
void passUnion7((object or DOMString or long) arg);
|
||||
void passUnion8((object or DOMString or boolean) arg);
|
||||
void passUnion9((object or DOMString or long or boolean) arg); */
|
||||
void passUnion9((object or DOMString or long or boolean) arg);
|
||||
#endif
|
||||
void passUnionWithNullable((object? or long) arg);
|
||||
void passNullableUnion((object or long)? arg);
|
||||
void passOptionalUnion(optional (object or long) arg);
|
||||
|
|
|
@ -336,15 +336,18 @@ interface TestExampleInterface {
|
|||
|
||||
// Union types
|
||||
void passUnion((object or long) arg);
|
||||
// Commented out tests 2-9 to avoid creating all those unused union types
|
||||
/* void passUnion2((long or boolean) arg);
|
||||
// Some union tests are debug-only to avoid creating all those
|
||||
// unused union types in opt builds.
|
||||
#ifdef DEBUG
|
||||
void passUnion2((long or boolean) arg);
|
||||
void passUnion3((object or long or boolean) arg);
|
||||
void passUnion4((Node or long or boolean) arg);
|
||||
void passUnion5((object or boolean) arg);
|
||||
void passUnion6((object or DOMString) arg);
|
||||
void passUnion7((object or DOMString or long) arg);
|
||||
void passUnion8((object or DOMString or boolean) arg);
|
||||
void passUnion9((object or DOMString or long or boolean) arg); */
|
||||
void passUnion9((object or DOMString or long or boolean) arg);
|
||||
#endif
|
||||
void passUnionWithNullable((object? or long) arg);
|
||||
void passNullableUnion((object or long)? arg);
|
||||
void passOptionalUnion(optional (object or long) arg);
|
||||
|
|
|
@ -358,15 +358,18 @@ interface TestJSImplInterface {
|
|||
|
||||
// Union types
|
||||
void passUnion((object or long) arg);
|
||||
// Commented out tests 2-9 to avoid creating all those unused union types
|
||||
/* void passUnion2((long or boolean) arg);
|
||||
// Some union tests are debug-only to avoid creating all those
|
||||
// unused union types in opt builds.
|
||||
#ifdef DEBUG
|
||||
void passUnion2((long or boolean) arg);
|
||||
void passUnion3((object or long or boolean) arg);
|
||||
void passUnion4((Node or long or boolean) arg);
|
||||
void passUnion5((object or boolean) arg);
|
||||
void passUnion6((object or DOMString) arg);
|
||||
void passUnion7((object or DOMString or long) arg);
|
||||
void passUnion8((object or DOMString or boolean) arg);
|
||||
void passUnion9((object or DOMString or long or boolean) arg); */
|
||||
void passUnion9((object or DOMString or long or boolean) arg);
|
||||
#endif
|
||||
void passUnionWithNullable((object? or long) arg);
|
||||
// FIXME: Bug 863948 Nullable unions not supported yet
|
||||
// void passNullableUnion((object or long)? arg);
|
||||
|
|
|
@ -8,6 +8,7 @@ MODULE = 'dom'
|
|||
|
||||
CPP_SOURCES += [
|
||||
'$(subst .webidl,Binding.cpp,$(test_webidl_files))',
|
||||
'$(subst .webidl,Binding.cpp,$(preprocessed_test_webidl_files))',
|
||||
]
|
||||
|
||||
LIBXUL_LIBRARY = True
|
||||
|
|
|
@ -522,13 +522,15 @@ if CONFIG['MOZ_B2G_FM']:
|
|||
|
||||
if CONFIG['ENABLE_TESTS']:
|
||||
TEST_WEBIDL_FILES += [
|
||||
'TestCodeGen.webidl',
|
||||
'TestDictionary.webidl',
|
||||
'TestExampleGen.webidl',
|
||||
'TestJSImplGen.webidl',
|
||||
'TestJSImplInheritanceGen.webidl',
|
||||
'TestTypedef.webidl',
|
||||
]
|
||||
PREPROCESSED_TEST_WEBIDL_FILES += [
|
||||
'TestCodeGen.webidl',
|
||||
'TestExampleGen.webidl',
|
||||
'TestJSImplGen.webidl',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_B2G']:
|
||||
WEBIDL_FILES += [
|
||||
|
|
|
@ -27,6 +27,7 @@ from ..frontend.data import (
|
|||
GeneratedWebIDLFile,
|
||||
IPDLFile,
|
||||
LocalInclude,
|
||||
PreprocessedTestWebIDLFile,
|
||||
PreprocessedWebIDLFile,
|
||||
Program,
|
||||
SandboxDerived,
|
||||
|
@ -266,6 +267,7 @@ class RecursiveMakeBackend(CommonBackend):
|
|||
self._webidl_sources = set()
|
||||
self._generated_events_webidl_sources = set()
|
||||
self._test_webidl_sources = set()
|
||||
self._preprocessed_test_webidl_sources = set()
|
||||
self._preprocessed_webidl_sources = set()
|
||||
self._generated_webidl_sources = set()
|
||||
|
||||
|
@ -371,6 +373,11 @@ class RecursiveMakeBackend(CommonBackend):
|
|||
obj.basename))
|
||||
# Test WebIDL files are not exported.
|
||||
|
||||
elif isinstance(obj, PreprocessedTestWebIDLFile):
|
||||
self._preprocessed_test_webidl_sources.add(mozpath.join(obj.srcdir,
|
||||
obj.basename))
|
||||
# Test WebIDL files are not exported.
|
||||
|
||||
elif isinstance(obj, GeneratedWebIDLFile):
|
||||
self._generated_webidl_sources.add(mozpath.join(obj.srcdir,
|
||||
obj.basename))
|
||||
|
@ -575,6 +582,8 @@ class RecursiveMakeBackend(CommonBackend):
|
|||
webidls.write('generated_events_webidl_files += %s\n' % os.path.basename(webidl))
|
||||
for webidl in sorted(self._test_webidl_sources):
|
||||
webidls.write('test_webidl_files += %s\n' % os.path.basename(webidl))
|
||||
for webidl in sorted(self._preprocessed_test_webidl_sources):
|
||||
webidls.write('preprocessed_test_webidl_files += %s\n' % os.path.basename(webidl))
|
||||
for webidl in sorted(self._generated_webidl_sources):
|
||||
webidls.write('generated_webidl_files += %s\n' % os.path.basename(webidl))
|
||||
for webidl in sorted(self._preprocessed_webidl_sources):
|
||||
|
|
|
@ -235,6 +235,19 @@ class TestWebIDLFile(SandboxDerived):
|
|||
|
||||
self.basename = path
|
||||
|
||||
class PreprocessedTestWebIDLFile(SandboxDerived):
|
||||
"""Describes an individual test-only .webidl source file that requires
|
||||
preprocessing."""
|
||||
|
||||
__slots__ = (
|
||||
'basename',
|
||||
)
|
||||
|
||||
def __init__(self, sandbox, path):
|
||||
SandboxDerived.__init__(self, sandbox)
|
||||
|
||||
self.basename = path
|
||||
|
||||
class PreprocessedWebIDLFile(SandboxDerived):
|
||||
"""Describes an individual .webidl source file that requires preprocessing."""
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ from .data import (
|
|||
GeneratedWebIDLFile,
|
||||
IPDLFile,
|
||||
LocalInclude,
|
||||
PreprocessedTestWebIDLFile,
|
||||
PreprocessedWebIDLFile,
|
||||
Program,
|
||||
ReaderSummary,
|
||||
|
@ -189,6 +190,7 @@ class TreeMetadataEmitter(LoggingMixin):
|
|||
('GENERATED_WEBIDL_FILES', GeneratedWebIDLFile),
|
||||
('IPDL_SOURCES', IPDLFile),
|
||||
('LOCAL_INCLUDES', LocalInclude),
|
||||
('PREPROCESSED_TEST_WEBIDL_FILES', PreprocessedTestWebIDLFile),
|
||||
('PREPROCESSED_WEBIDL_FILES', PreprocessedWebIDLFile),
|
||||
('TEST_WEBIDL_FILES', TestWebIDLFile),
|
||||
('WEBIDL_FILES', WebIDLFile),
|
||||
|
|
|
@ -444,6 +444,13 @@ VARIABLES = {
|
|||
These will be generated from some other files.
|
||||
"""),
|
||||
|
||||
'PREPROCESSED_TEST_WEBIDL_FILES': (StrictOrderingOnAppendList, list, [],
|
||||
"""Preprocessed test WebIDL source files.
|
||||
|
||||
These will be preprocessed, then parsed and converted to .cpp
|
||||
and .h files if tests are enabled.
|
||||
"""),
|
||||
|
||||
'PREPROCESSED_WEBIDL_FILES': (StrictOrderingOnAppendList, list, [],
|
||||
"""Preprocessed WebIDL source files.
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче