diff options
Diffstat (limited to 'ipc/ipdl/test/ipdl')
183 files changed, 2084 insertions, 0 deletions
diff --git a/ipc/ipdl/test/ipdl/IPDLCompile.py b/ipc/ipdl/test/ipdl/IPDLCompile.py new file mode 100644 index 0000000000..bfaf7860d6 --- /dev/null +++ b/ipc/ipdl/test/ipdl/IPDLCompile.py @@ -0,0 +1,78 @@ +import copy +import os +import re +import subprocess +import tempfile + +# We test the compiler indirectly, rather than reaching into the ipdl/ +# module, to make the testing framework as general as possible. + + +class IPDLCompile: + def __init__(self, specfilename, ipdlargv=["python", "ipdl.py"]): + self.argv = copy.deepcopy(ipdlargv) + self.specfilename = specfilename + self.stdout = None + self.stderr = None + self.returncode = None + + def run(self): + """Run |self.specfilename| through the IPDL compiler.""" + assert self.returncode is None + + tmpoutdir = tempfile.mkdtemp(prefix="ipdl_unit_test") + + try: + self.argv.extend(["-d", tmpoutdir, self.specfilename]) + + proc = subprocess.Popen( + args=self.argv, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + universal_newlines=True, + ) + self.stdout, self.stderr = proc.communicate() + + self.returncode = proc.returncode + assert self.returncode is not None + + finally: + for root, dirs, files in os.walk(tmpoutdir, topdown=0): + for name in files: + os.remove(os.path.join(root, name)) + for name in dirs: + os.rmdir(os.path.join(root, name)) + os.rmdir(tmpoutdir) + + if proc.returncode is None: + proc.kill() + + def completed(self): + return ( + self.returncode is not None + and isinstance(self.stdout, str) + and isinstance(self.stderr, str) + ) + + def error(self, expectedError): + """Return True iff compiling self.specstring resulted in an + IPDL compiler error.""" + assert self.completed() + + errorRe = re.compile(re.escape(expectedError)) + return None is not re.search(errorRe, self.stderr) + + def exception(self): + """Return True iff compiling self.specstring resulted in a Python + exception being raised.""" + assert self.completed() + + return None is not re.search(r"Traceback (most recent call last):", self.stderr) + + def ok(self): + """Return True iff compiling self.specstring was successful.""" + assert self.completed() + + return ( + not self.exception() and not self.error("error:") and (0 == self.returncode) + ) diff --git a/ipc/ipdl/test/ipdl/Makefile.in b/ipc/ipdl/test/ipdl/Makefile.in new file mode 100644 index 0000000000..67f241775b --- /dev/null +++ b/ipc/ipdl/test/ipdl/Makefile.in @@ -0,0 +1,17 @@ +# 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/. + +include $(topsrcdir)/config/rules.mk + +OKTESTS := $(wildcard $(srcdir)/ok/*.ipdl) $(wildcard $(srcdir)/ok/*.ipdlh) +ERRORTESTS := $(wildcard $(srcdir)/error/*.ipdl) $(wildcard $(srcdir)/error/*.ipdlh) + +check:: + @$(PYTHON3) $(srcdir)/runtests.py \ + $(srcdir)/ok $(srcdir)/error \ + $(PYTHON3) $(topsrcdir)/ipc/ipdl/ipdl.py \ + --sync-msg-list=$(srcdir)/sync-messages.ini \ + --msg-metadata=$(srcdir)/message-metadata.ini \ + OKTESTS $(OKTESTS) \ + ERRORTESTS $(ERRORTESTS) diff --git a/ipc/ipdl/test/ipdl/error/AsyncCtorReturns.ipdl b/ipc/ipdl/test/ipdl/error/AsyncCtorReturns.ipdl new file mode 100644 index 0000000000..8295a1c9a7 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/AsyncCtorReturns.ipdl @@ -0,0 +1,11 @@ +//error: asynchronous ctor/dtor message `AsyncCtorReturnsManageeConstructor' declares return values + +include protocol AsyncCtorReturnsManagee; + +[ChildProc=any] +protocol AsyncCtorReturns { + manages AsyncCtorReturnsManagee; + +child: + async AsyncCtorReturnsManagee() returns (bool unused); +}; diff --git a/ipc/ipdl/test/ipdl/error/AsyncCtorReturnsManagee.ipdl b/ipc/ipdl/test/ipdl/error/AsyncCtorReturnsManagee.ipdl new file mode 100644 index 0000000000..46aeb6e9fd --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/AsyncCtorReturnsManagee.ipdl @@ -0,0 +1,11 @@ +//error: asynchronous ctor/dtor message `AsyncCtorReturnsManageeConstructor' declares return values + +include protocol AsyncCtorReturns; + +[ChildProc=any] +protocol AsyncCtorReturnsManagee { + manager AsyncCtorReturns; + +parent: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/AsyncInsideSync.ipdl b/ipc/ipdl/test/ipdl/error/AsyncInsideSync.ipdl new file mode 100644 index 0000000000..104ced1c72 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/AsyncInsideSync.ipdl @@ -0,0 +1,10 @@ +// inside_sync nested messages must be sync + +//error: inside_sync nested messages must be sync (here, message `Msg' in protocol `AsyncInsideSync') +//error: message `Msg' requires more powerful send semantics than its protocol `AsyncInsideSync' provides + +[ChildProc=any] +protocol AsyncInsideSync { +child: + [Nested=inside_sync] async Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/ExtendedAttrBadValue.ipdlh b/ipc/ipdl/test/ipdl/error/ExtendedAttrBadValue.ipdlh new file mode 100644 index 0000000000..880bf54179 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/ExtendedAttrBadValue.ipdlh @@ -0,0 +1,5 @@ +//error: unexpected value for valueless attribute `RefCounted' + +[RefCounted=Invalid] using SomeType from "SomeFile.h"; + +struct ExtendedAttrBadValue {};
\ No newline at end of file diff --git a/ipc/ipdl/test/ipdl/error/ExtendedAttrEmpty.ipdlh b/ipc/ipdl/test/ipdl/error/ExtendedAttrEmpty.ipdlh new file mode 100644 index 0000000000..625bedc58a --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/ExtendedAttrEmpty.ipdlh @@ -0,0 +1,5 @@ +//error: bad syntax near `]' + +[ ] using SomeType from "SomeFile.h"; + +struct ExtendedAttrEmpty {}; diff --git a/ipc/ipdl/test/ipdl/error/ExtendedAttrInvalidNestedValue.ipdl b/ipc/ipdl/test/ipdl/error/ExtendedAttrInvalidNestedValue.ipdl new file mode 100644 index 0000000000..64899286db --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/ExtendedAttrInvalidNestedValue.ipdl @@ -0,0 +1,7 @@ +//error: invalid value for attribute `Nested', expected one of: not, inside_sync, inside_cpow + +[ChildProc=any] +protocol ExtendedAttrInvalidNestedValue { +child: + [Nested=invalid] async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/ExtendedAttrInvalidPriorityValue.ipdl b/ipc/ipdl/test/ipdl/error/ExtendedAttrInvalidPriorityValue.ipdl new file mode 100644 index 0000000000..51f21f0458 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/ExtendedAttrInvalidPriorityValue.ipdl @@ -0,0 +1,7 @@ +//error: invalid value for attribute `Priority', expected one of: normal, input, vsync, mediumhigh, control + +[ChildProc=any] +protocol ExtendedAttrInvalidPriorityValue { +child: + [Priority=invalid] async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/ExtendedAttrRepeated.ipdlh b/ipc/ipdl/test/ipdl/error/ExtendedAttrRepeated.ipdlh new file mode 100644 index 0000000000..33defc8ca4 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/ExtendedAttrRepeated.ipdlh @@ -0,0 +1,5 @@ +//error: Repeated extended attribute `RefCounted' + +[RefCounted, RefCounted] using SomeType from "SomeFile.h"; + +struct ExtendedAttrRepeated {}; diff --git a/ipc/ipdl/test/ipdl/error/ExtendedAttrUnknown.ipdlh b/ipc/ipdl/test/ipdl/error/ExtendedAttrUnknown.ipdlh new file mode 100644 index 0000000000..c41e91008f --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/ExtendedAttrUnknown.ipdlh @@ -0,0 +1,5 @@ +//error: unknown attribute `InvalidAttribute' + +[InvalidAttribute] using SomeType from "SomeFile.h"; + +struct ExtendedAttrUnknown {}; diff --git a/ipc/ipdl/test/ipdl/error/ForgottenManagee.ipdl b/ipc/ipdl/test/ipdl/error/ForgottenManagee.ipdl new file mode 100644 index 0000000000..35f6f02e4d --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/ForgottenManagee.ipdl @@ -0,0 +1,12 @@ +//error: |manager| declaration in protocol `ForgottenManagee' does not match any |manages| declaration in protocol `ManagerForgot' + +include protocol ManagerForgot; + +// This protocol says ManagerForgot manages it, +// but ManagerForgot does not manage it. + +protocol ForgottenManagee { + manager ManagerForgot; +child: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/ForgottenManager.ipdl b/ipc/ipdl/test/ipdl/error/ForgottenManager.ipdl new file mode 100644 index 0000000000..f2c524056a --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/ForgottenManager.ipdl @@ -0,0 +1,12 @@ +//error: |manages| declaration in protocol `ForgottenManager' does not match any |manager| declaration in protocol `ManageeForgot' + +include protocol ManageeForgot; + +// ManageeForgot should have this protocol as its manager. + +[ChildProc=any] +protocol ForgottenManager { + manages ManageeForgot; +child: + async ManageeForgot(); +}; diff --git a/ipc/ipdl/test/ipdl/error/InsideCpowToChild.ipdl b/ipc/ipdl/test/ipdl/error/InsideCpowToChild.ipdl new file mode 100644 index 0000000000..054964a817 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/InsideCpowToChild.ipdl @@ -0,0 +1,10 @@ +// inside_cpow nested parent-to-child messages are verboten + +//error: inside_cpow nested parent-to-child messages are verboten (here, message `Msg' in protocol `InsideCpowToChild') +//error: message `Msg' requires more powerful send semantics than its protocol `InsideCpowToChild' provides + +[ChildProc=any] +protocol InsideCpowToChild { +child: + [Nested=inside_cpow] sync Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/IntrAsyncManagee.ipdl b/ipc/ipdl/test/ipdl/error/IntrAsyncManagee.ipdl new file mode 100644 index 0000000000..527c007ec4 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/IntrAsyncManagee.ipdl @@ -0,0 +1,9 @@ +//error: protocol `IntrAsyncManagee' requires more powerful send semantics than its manager `IntrAsyncManager' provides + +include protocol IntrAsyncManager; + +intr protocol IntrAsyncManagee { + manager IntrAsyncManager; +child: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/IntrAsyncManager.ipdl b/ipc/ipdl/test/ipdl/error/IntrAsyncManager.ipdl new file mode 100644 index 0000000000..dc5768df28 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/IntrAsyncManager.ipdl @@ -0,0 +1,10 @@ +//error: protocol `IntrAsyncManagee' requires more powerful send semantics than its manager `IntrAsyncManager' provides + +include protocol IntrAsyncManagee; + +[ChildProc=any] +async protocol IntrAsyncManager { + manages IntrAsyncManagee; +parent: + async IntrAsyncManagee(); +}; diff --git a/ipc/ipdl/test/ipdl/error/IntrSyncManagee.ipdl b/ipc/ipdl/test/ipdl/error/IntrSyncManagee.ipdl new file mode 100644 index 0000000000..d0b1462e86 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/IntrSyncManagee.ipdl @@ -0,0 +1,9 @@ +//error: protocol `IntrSyncManagee' requires more powerful send semantics than its manager `IntrSyncManager' provides + +include protocol IntrSyncManager; + +intr protocol IntrSyncManagee { + manager IntrSyncManager; +child: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/IntrSyncManager.ipdl b/ipc/ipdl/test/ipdl/error/IntrSyncManager.ipdl new file mode 100644 index 0000000000..f8e762093c --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/IntrSyncManager.ipdl @@ -0,0 +1,10 @@ +//error: protocol `IntrSyncManagee' requires more powerful send semantics than its manager `IntrSyncManager' provides + +include protocol IntrSyncManagee; + +[ChildProc=any] +sync protocol IntrSyncManager { + manages IntrSyncManagee; +parent: + async IntrSyncManagee(); +}; diff --git a/ipc/ipdl/test/ipdl/error/ManageeForgot.ipdl b/ipc/ipdl/test/ipdl/error/ManageeForgot.ipdl new file mode 100644 index 0000000000..9e11fe49fd --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/ManageeForgot.ipdl @@ -0,0 +1,12 @@ +//error: |manages| declaration in protocol `ForgottenManager' does not match any |manager| declaration in protocol `ManageeForgot' + +include protocol ForgottenManager; + +// See ForgottenManager. This includes ForgottenManager to ensure that +// loading this file fails. + +[ChildProc=any] +protocol ManageeForgot { +child: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/ManagerForgot.ipdl b/ipc/ipdl/test/ipdl/error/ManagerForgot.ipdl new file mode 100644 index 0000000000..ae87534fb9 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/ManagerForgot.ipdl @@ -0,0 +1,12 @@ +//error: |manager| declaration in protocol `ForgottenManagee' does not match any |manages| declaration in protocol `ManagerForgot' + +include protocol ForgottenManagee; + +// See ForgottenManagee.ipdl. This includes ForgottenManagee to +// ensure that loading this file fails. + +[ChildProc=any] +protocol ManagerForgot { +child: + async Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/Nullable.ipdl b/ipc/ipdl/test/ipdl/error/Nullable.ipdl new file mode 100644 index 0000000000..c5257accbb --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/Nullable.ipdl @@ -0,0 +1,7 @@ +//error: `nullable' qualifier for type `int' is unsupported + +[ChildProc=any] +protocol PNullable { +child: + async Msg(nullable int i); +}; diff --git a/ipc/ipdl/test/ipdl/error/Nullable2.ipdl b/ipc/ipdl/test/ipdl/error/Nullable2.ipdl new file mode 100644 index 0000000000..3dcd66a321 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/Nullable2.ipdl @@ -0,0 +1,11 @@ +//error: `nullable' qualifier for type `int' is unsupported + +union Union { + nullable int; +}; + +[ChildProc=any] +protocol Nullable2 { +child: + async Msg(Union i); +}; diff --git a/ipc/ipdl/test/ipdl/error/PBadArrayBase.ipdl b/ipc/ipdl/test/ipdl/error/PBadArrayBase.ipdl new file mode 100644 index 0000000000..3d791761c2 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PBadArrayBase.ipdl @@ -0,0 +1,8 @@ +//error: argument typename `X' of message `Test' has not been declared + +[ChildProc=any] +protocol PBadArrayBase { +child: + async Test(X[] x); + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PBadNestedManagee.ipdl b/ipc/ipdl/test/ipdl/error/PBadNestedManagee.ipdl new file mode 100644 index 0000000000..3fda366674 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PBadNestedManagee.ipdl @@ -0,0 +1,10 @@ +//error: protocol `PBadNestedManagee' requires more powerful send semantics than its manager `PBadNestedManager' provides + +include protocol PBadNestedManager; + +[NestedUpTo=inside_sync, ChildProc=any] +async protocol PBadNestedManagee { + manager PBadNestedManager; +child: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PBadNestedManager.ipdl b/ipc/ipdl/test/ipdl/error/PBadNestedManager.ipdl new file mode 100644 index 0000000000..b395da2f30 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PBadNestedManager.ipdl @@ -0,0 +1,10 @@ +//error: protocol `PBadNestedManagee' requires more powerful send semantics than its manager `PBadNestedManager' provides + +include protocol PBadNestedManagee; + +[NestedUpTo=not, ChildProc=any] +async protocol PBadNestedManager { + manages PBadNestedManagee; +parent: + async PBadNestedManagee(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PBadSideImpl.ipdl b/ipc/ipdl/test/ipdl/error/PBadSideImpl.ipdl new file mode 100644 index 0000000000..787bba1d04 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PBadSideImpl.ipdl @@ -0,0 +1,8 @@ +//error: invalid value for attribute `ParentImpl', expected one of: virtual, StringLiteral +//error: invalid value for attribute `ChildImpl', expected one of: virtual, StringLiteral + +[ParentImpl=NotQuoted, ChildImpl, ChildProc=any] +async protocol PBadSideImpl { + parent: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PBadUniquePtrBase.ipdl b/ipc/ipdl/test/ipdl/error/PBadUniquePtrBase.ipdl new file mode 100644 index 0000000000..8058fb5334 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PBadUniquePtrBase.ipdl @@ -0,0 +1,8 @@ +//error: argument typename `UndeclaredType' of message `Test' has not been declared + +[ChildProc=any] +protocol PBadUniquePtrBase { +child: + async Test(UniquePtr<UndeclaredType> x); + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PCompressInvalid.ipdl b/ipc/ipdl/test/ipdl/error/PCompressInvalid.ipdl new file mode 100644 index 0000000000..bc81e4544b --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PCompressInvalid.ipdl @@ -0,0 +1,9 @@ +//error: invalid value for attribute `Compress', expected one of: None, all + +include protocol compressCtor; + +[ChildProc=any] +async protocol PCompressInvalid { +child: + [Compress=Invalid] async Message(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PDouble.ipdl b/ipc/ipdl/test/ipdl/error/PDouble.ipdl new file mode 100644 index 0000000000..a6c6dd3a8d --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PDouble.ipdl @@ -0,0 +1,12 @@ +//error: Trying to load `PDouble' from a file when we'd already seen it in file + +// This will load extra/PDouble.ipdl because extra/ is earlier +// in the list of include directories than the current working +// directory. Loading the same protocol from two files is +// obviously bad. +include protocol PDouble; + +[ChildProc=any] +protocol PDouble { +child: async Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PExtendedAttrInvalidValue.ipdl b/ipc/ipdl/test/ipdl/error/PExtendedAttrInvalidValue.ipdl new file mode 100644 index 0000000000..796f25d8c2 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PExtendedAttrInvalidValue.ipdl @@ -0,0 +1,7 @@ +//error: invalid value for attribute `NestedUpTo', expected one of: not, inside_sync, inside_cpow + +[NestedUpTo=invalid, ChildProc=any] +async protocol PExtendedAttrInvalidValue { +parent: + async Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PExtendedAttrRepeated.ipdl b/ipc/ipdl/test/ipdl/error/PExtendedAttrRepeated.ipdl new file mode 100644 index 0000000000..c15dbce788 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PExtendedAttrRepeated.ipdl @@ -0,0 +1,7 @@ +//error: Repeated extended attribute `RefCounted' + +[RefCounted, RefCounted, ChildProc=any] +async protocol PExtendedAttrRepeated { +parent: + async Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PExtendedAttrUnexpectedValue.ipdl b/ipc/ipdl/test/ipdl/error/PExtendedAttrUnexpectedValue.ipdl new file mode 100644 index 0000000000..dcc7b043c5 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PExtendedAttrUnexpectedValue.ipdl @@ -0,0 +1,7 @@ +//error: unexpected value for valueless attribute `ManualDealloc' + +[ManualDealloc=invalid, ChildProc=any] +async protocol PExtendedAttrUnexpectedValue { +parent: + async Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PExtendedAttrUnknownAttribute.ipdl b/ipc/ipdl/test/ipdl/error/PExtendedAttrUnknownAttribute.ipdl new file mode 100644 index 0000000000..193c1d6608 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PExtendedAttrUnknownAttribute.ipdl @@ -0,0 +1,7 @@ +//error: unknown attribute `InvalidAttr' + +[InvalidAttr, ChildProc=any] +async protocol PExtendedAttrUnknownValue { +parent: + async Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PInconsistentMoveOnly.ipdl b/ipc/ipdl/test/ipdl/error/PInconsistentMoveOnly.ipdl new file mode 100644 index 0000000000..9968b3b2ab --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PInconsistentMoveOnly.ipdl @@ -0,0 +1,14 @@ +//error: inconsistent moveonly status of type `::mozilla::ipc::SomeMoveonlyType` +//error: inconsistent moveonly status of type `::mozilla::ipc::SomeMoveonlySendType` + +[MoveOnly] using class mozilla::ipc::SomeMoveonlyType from "SomeFile.h"; +using class mozilla::ipc::SomeMoveonlyType from "SomeFile.h"; + +[MoveOnly=send] using class mozilla::ipc::SomeMoveonlySendType from "SomeFile.h"; +[MoveOnly=data] using class mozilla::ipc::SomeMoveonlySendType from "SomeFile.h"; + +[ChildProc=any] +protocol PInconsistentMoveOnly { +child: + async SomeMessage(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PIntrNested.ipdl b/ipc/ipdl/test/ipdl/error/PIntrNested.ipdl new file mode 100644 index 0000000000..c487bcd49d --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PIntrNested.ipdl @@ -0,0 +1,7 @@ +//error: intr message `Msg' cannot specify [Nested] + +[ChildProc=any] +intr protocol PIntrNested { +child: + [Nested=inside_sync, LegacyIntr] intr Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PIntrNestedProtocol.ipdl b/ipc/ipdl/test/ipdl/error/PIntrNestedProtocol.ipdl new file mode 100644 index 0000000000..dd95a7c002 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PIntrNestedProtocol.ipdl @@ -0,0 +1,7 @@ +//error: intr protocol `PIntrNestedProtocol' cannot specify [NestedUpTo] + +[NestedUpTo=inside_sync, ChildProc=any] +intr protocol PIntrNestedProtocol { +child: + [LegacyIntr] intr Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PIntrPriority.ipdl b/ipc/ipdl/test/ipdl/error/PIntrPriority.ipdl new file mode 100644 index 0000000000..c8bf75e9a3 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PIntrPriority.ipdl @@ -0,0 +1,7 @@ +//error: intr message `Msg' cannot specify [Priority] + +[ChildProc=any] +intr protocol PIntrPriority { +child: + [Priority=vsync, LegacyIntr] intr Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PLazySendInvalid.ipdl b/ipc/ipdl/test/ipdl/error/PLazySendInvalid.ipdl new file mode 100644 index 0000000000..b34f686132 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PLazySendInvalid.ipdl @@ -0,0 +1,7 @@ +//error: unexpected value for valueless attribute `LazySend' + +[ChildProc=any] +async protocol PLazySendInvalid { +child: + [LazySend=Invalid] async Message(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PLazySendSync.ipdl b/ipc/ipdl/test/ipdl/error/PLazySendSync.ipdl new file mode 100644 index 0000000000..76e9e60fb9 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PLazySendSync.ipdl @@ -0,0 +1,7 @@ +//error: non-async message `Message' cannot specify [LazySend] + +[ChildProc=any] +sync protocol PLazySendSync { +child: + [LazySend] sync Message() returns (bool ok); +}; diff --git a/ipc/ipdl/test/ipdl/error/PManagerManualDealloc.ipdl b/ipc/ipdl/test/ipdl/error/PManagerManualDealloc.ipdl new file mode 100644 index 0000000000..91ff4f4769 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PManagerManualDealloc.ipdl @@ -0,0 +1,13 @@ +//error: [ManualDealloc] protocols cannot be managers + +include protocol PManagerManualDeallocTop; +include protocol PManagerManualDeallocManaged; + +[ManualDealloc] +async protocol PManagerManualDealloc { + manager PManagerManualDeallocTop; + manages PManagerManualDeallocManaged; + +child: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PMissingProc.ipdl b/ipc/ipdl/test/ipdl/error/PMissingProc.ipdl new file mode 100644 index 0000000000..b4d32e55ac --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PMissingProc.ipdl @@ -0,0 +1,6 @@ +//error: Toplevel protocols must specify [ChildProc] + +protocol PMissingProc { +parent: + async Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PNoTaintWithoutTainted.ipdl b/ipc/ipdl/test/ipdl/error/PNoTaintWithoutTainted.ipdl new file mode 100644 index 0000000000..b196050c48 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PNoTaintWithoutTainted.ipdl @@ -0,0 +1,7 @@ +//error: argument typename `int' of message `foo' has a NoTaint attribute, but the message lacks the Tainted attribute + +[ChildProc=any] +intr protocol PNoTaintWithoutTainted { +child: + async foo([NoTaint=passback] int id); +}; diff --git a/ipc/ipdl/test/ipdl/error/PToplevelManualDealloc.ipdl b/ipc/ipdl/test/ipdl/error/PToplevelManualDealloc.ipdl new file mode 100644 index 0000000000..1936fda2bb --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PToplevelManualDealloc.ipdl @@ -0,0 +1,7 @@ +//error: Toplevel protocols cannot be [ManualDealloc] + +[ManualDealloc, ChildProc=any] +async protocol PToplevelManualDealloc { +child: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PUniquePtrRecursive.ipdl b/ipc/ipdl/test/ipdl/error/PUniquePtrRecursive.ipdl new file mode 100644 index 0000000000..98992f700e --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PUniquePtrRecursive.ipdl @@ -0,0 +1,6 @@ +//error: bad syntax near `UniquePtr' + +[ChildProc=any] +protocol PUniquePtrRecursive { +child: async Msg( UniquePtr< UniquePtr<int> > aa); +}; diff --git a/ipc/ipdl/test/ipdl/error/PUniquePtrSelfRecStruct.ipdl b/ipc/ipdl/test/ipdl/error/PUniquePtrSelfRecStruct.ipdl new file mode 100644 index 0000000000..a0fb3b91c0 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PUniquePtrSelfRecStruct.ipdl @@ -0,0 +1,10 @@ +//error: struct `X' is only partially defined + +struct X { + UniquePtr<X> x; +}; + +[ChildProc=any] +protocol PUniquePtrSelfRecStruct { +child: async Msg(UniquePtr<X> aa); +}; diff --git a/ipc/ipdl/test/ipdl/error/PUniquePtrSelfRecUnion.ipdl b/ipc/ipdl/test/ipdl/error/PUniquePtrSelfRecUnion.ipdl new file mode 100644 index 0000000000..396ffef0e2 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PUniquePtrSelfRecUnion.ipdl @@ -0,0 +1,8 @@ +//error: union `X' is only partially defined + +union X { UniquePtr<X>; }; + +[ChildProc=any] +protocol PUniquePtrSelfRecUnion { +child: async Msg(UniquePtr<X> aa); +}; diff --git a/ipc/ipdl/test/ipdl/error/PUnknownProc.ipdl b/ipc/ipdl/test/ipdl/error/PUnknownProc.ipdl new file mode 100644 index 0000000000..0ec4e3f3c7 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PUnknownProc.ipdl @@ -0,0 +1,7 @@ +//error: invalid value for attribute `ChildProc', expected one of: any, anychild, anydom, compositor, Parent, Content, IPDLUnitTest, GMPlugin, GPU, VR, RDD, Socket, RemoteSandboxBroker, ForkServer, Utility + +[ChildProc=unknowntype] +protocol PUnknownProc { +parent: + async Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/PasyncMessageListed.ipdl b/ipc/ipdl/test/ipdl/error/PasyncMessageListed.ipdl new file mode 100644 index 0000000000..18d6e85ea4 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PasyncMessageListed.ipdl @@ -0,0 +1,7 @@ +//error: IPC message PasyncMessageListed::Msg is async, can be delisted + +[ChildProc=any] +protocol PasyncMessageListed { +parent: + async Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/ReplyPrioWithoutReturns.ipdl b/ipc/ipdl/test/ipdl/error/ReplyPrioWithoutReturns.ipdl new file mode 100644 index 0000000000..be499f6d4c --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/ReplyPrioWithoutReturns.ipdl @@ -0,0 +1,8 @@ +//error: non-returns message `NormalPrio' cannot specify [ReplyPriority] + +[ChildProc=any] +async protocol ReplyPrioWithoutReturns +{ +child: + [ReplyPriority=normal] async NormalPrio(); +}; diff --git a/ipc/ipdl/test/ipdl/error/SyncAsyncManagee.ipdl b/ipc/ipdl/test/ipdl/error/SyncAsyncManagee.ipdl new file mode 100644 index 0000000000..e011e90d79 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/SyncAsyncManagee.ipdl @@ -0,0 +1,10 @@ +//error: protocol `SyncAsyncManagee' requires more powerful send semantics than its manager `SyncAsyncManager' provides + +include protocol SyncAsyncManager; + +[ChildProc=any] +sync protocol SyncAsyncManagee { + manager SyncAsyncManager; +child: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/SyncAsyncManager.ipdl b/ipc/ipdl/test/ipdl/error/SyncAsyncManager.ipdl new file mode 100644 index 0000000000..f189df1cbd --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/SyncAsyncManager.ipdl @@ -0,0 +1,10 @@ +//error: protocol `SyncAsyncManagee' requires more powerful send semantics than its manager `SyncAsyncManager' provides + +include protocol SyncAsyncManagee; + +[ChildProc=any] +async protocol SyncAsyncManager { + manages SyncAsyncManagee; +parent: + async SyncAsyncManagee(); +}; diff --git a/ipc/ipdl/test/ipdl/error/SyncPrio.ipdl b/ipc/ipdl/test/ipdl/error/SyncPrio.ipdl new file mode 100644 index 0000000000..73c0cdfd44 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/SyncPrio.ipdl @@ -0,0 +1,8 @@ +//error: non-async message `NormalPrio' cannot specify [ReplyPriority] + +[ChildProc=any] +sync protocol SyncPrio +{ +child: + [ReplyPriority=normal] sync NormalPrio() returns (bool aValue); +}; diff --git a/ipc/ipdl/test/ipdl/error/array_Recursive.ipdl b/ipc/ipdl/test/ipdl/error/array_Recursive.ipdl new file mode 100644 index 0000000000..d89d4b3cad --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/array_Recursive.ipdl @@ -0,0 +1,6 @@ +//error: bad syntax near `[' + +[ChildProc=any] +protocol array_Recursive { +child: async Msg(int[][] aa); +}; diff --git a/ipc/ipdl/test/ipdl/error/badProtocolInclude.ipdl b/ipc/ipdl/test/ipdl/error/badProtocolInclude.ipdl new file mode 100644 index 0000000000..4ff6db2659 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/badProtocolInclude.ipdl @@ -0,0 +1,10 @@ +//error: can't locate include file `IDONTEXIST.ipdl' + +include protocol IDONTEXIST; + +// error: nonexistent protocol ^^^ + +[ChildProc=any] +protocol badProtocolInclude { +child: async Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/compressCtor.ipdl b/ipc/ipdl/test/ipdl/error/compressCtor.ipdl new file mode 100644 index 0000000000..93c300333d --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/compressCtor.ipdl @@ -0,0 +1,12 @@ +//error: destructor messages can't use compression (here, in protocol `compressCtorManagee') +//error: constructor messages can't use compression (here, in protocol `compressCtor') + +include protocol compressCtorManagee; + +[ChildProc=any] +intr protocol compressCtor { + manages compressCtorManagee; + +parent: + [Compress] async compressCtorManagee(); +}; diff --git a/ipc/ipdl/test/ipdl/error/compressCtorManagee.ipdl b/ipc/ipdl/test/ipdl/error/compressCtorManagee.ipdl new file mode 100644 index 0000000000..52ec2cc1cd --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/compressCtorManagee.ipdl @@ -0,0 +1,11 @@ +//error: constructor messages can't use compression (here, in protocol `compressCtor') +//error: destructor messages can't use compression (here, in protocol `compressCtorManagee') + +include protocol compressCtor; + +intr protocol compressCtorManagee { + manager compressCtor; + +child: + [Compress] async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/conflictProtocolMsg.ipdl b/ipc/ipdl/test/ipdl/error/conflictProtocolMsg.ipdl new file mode 100644 index 0000000000..4756e0c032 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/conflictProtocolMsg.ipdl @@ -0,0 +1,10 @@ +//error: ctor for protocol `conflictProtocolMsg', which is not managed by protocol `conflictProtocolMsg' + +[ChildProc=any] +protocol conflictProtocolMsg { + + // it's an error to re-use the protocol name as a message ID; these + // are reserved +child: async conflictProtocolMsg(); + +}; diff --git a/ipc/ipdl/test/ipdl/error/cyclecheck_Child.ipdl b/ipc/ipdl/test/ipdl/error/cyclecheck_Child.ipdl new file mode 100644 index 0000000000..dd27586d8b --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/cyclecheck_Child.ipdl @@ -0,0 +1,15 @@ +//error: cycle(s) detected in manager/manages hierarchy: `cyclecheck_Parent -> cyclecheck_Child -> cyclecheck_Grandchild -> cyclecheck_Parent' +//error: |manages| declaration in protocol `cyclecheck_Grandchild' does not match any |manager| declaration in protocol `cyclecheck_Parent' + +include protocol cyclecheck_Parent; +include protocol cyclecheck_Grandchild; + +protocol cyclecheck_Child { + manager cyclecheck_Parent; + manages cyclecheck_Grandchild; + +child: + async cyclecheck_Grandchild(); + async __delete__(); +}; + diff --git a/ipc/ipdl/test/ipdl/error/cyclecheck_Grandchild.ipdl b/ipc/ipdl/test/ipdl/error/cyclecheck_Grandchild.ipdl new file mode 100644 index 0000000000..9152a56a16 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/cyclecheck_Grandchild.ipdl @@ -0,0 +1,15 @@ +//error: cycle(s) detected in manager/manages hierarchy: `cyclecheck_Parent -> cyclecheck_Child -> cyclecheck_Grandchild -> cyclecheck_Parent' +//error: |manages| declaration in protocol `cyclecheck_Grandchild' does not match any |manager| declaration in protocol `cyclecheck_Parent' + +include protocol cyclecheck_Child; +include protocol cyclecheck_Parent; + +protocol cyclecheck_Grandchild { + manager cyclecheck_Child; + manages cyclecheck_Parent; + +child: + async cyclecheck_Parent(); + async __delete__(); +}; + diff --git a/ipc/ipdl/test/ipdl/error/cyclecheck_Parent.ipdl b/ipc/ipdl/test/ipdl/error/cyclecheck_Parent.ipdl new file mode 100644 index 0000000000..7b3a135518 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/cyclecheck_Parent.ipdl @@ -0,0 +1,13 @@ +//error: cycle(s) detected in manager/manages hierarchy: `cyclecheck_Parent -> cyclecheck_Child -> cyclecheck_Grandchild -> cyclecheck_Parent' + +include protocol cyclecheck_Child; + +[ChildProc=any] +protocol cyclecheck_Parent { + manages cyclecheck_Child; + +child: + async cyclecheck_Child(); + async __delete__(); +}; + diff --git a/ipc/ipdl/test/ipdl/error/dtorReserved.ipdl b/ipc/ipdl/test/ipdl/error/dtorReserved.ipdl new file mode 100644 index 0000000000..ac5d37c7b6 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/dtorReserved.ipdl @@ -0,0 +1,11 @@ +//error: lexically invalid characters `~SomeMsg(); + +[ChildProc=any] +protocol dtorReserved { + + // it's an error to use old-style dtor syntax + +child: + ~SomeMsg(); + +}; diff --git a/ipc/ipdl/test/ipdl/error/empty.ipdl b/ipc/ipdl/test/ipdl/error/empty.ipdl new file mode 100644 index 0000000000..c6249c280b --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/empty.ipdl @@ -0,0 +1 @@ +//error: bad syntax near `???'
\ No newline at end of file diff --git a/ipc/ipdl/test/ipdl/error/extra/PDouble.ipdl b/ipc/ipdl/test/ipdl/error/extra/PDouble.ipdl new file mode 100644 index 0000000000..2efae8fff4 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/extra/PDouble.ipdl @@ -0,0 +1,5 @@ +// This is a valid file. + +protocol PDouble { +child: async Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/extra/PManagerManualDeallocManaged.ipdl b/ipc/ipdl/test/ipdl/error/extra/PManagerManualDeallocManaged.ipdl new file mode 100644 index 0000000000..65cddccf67 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/extra/PManagerManualDeallocManaged.ipdl @@ -0,0 +1,9 @@ +include protocol PManagerManualDealloc; + +[ManualDealloc] +async protocol PManagerManualDeallocManaged { + manager PManagerManualDealloc; + +child: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/extra/PManagerManualDeallocTop.ipdl b/ipc/ipdl/test/ipdl/error/extra/PManagerManualDeallocTop.ipdl new file mode 100644 index 0000000000..38eb7511f5 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/extra/PManagerManualDeallocTop.ipdl @@ -0,0 +1,9 @@ +include protocol PManagerManualDealloc; + +[ChildProc=any] +async protocol PManagerManualDeallocTop { + manager PManagerManualDealloc; + +child: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/inconsistentRC.ipdl b/ipc/ipdl/test/ipdl/error/inconsistentRC.ipdl new file mode 100644 index 0000000000..a00bca66e4 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/inconsistentRC.ipdl @@ -0,0 +1,10 @@ +//error: inconsistent refcounted status of type `::mozilla::ipc::SomeRefcountedType` + +[RefCounted] using class mozilla::ipc::SomeRefcountedType from "SomeFile.h"; +using class mozilla::ipc::SomeRefcountedType from "SomeFile.h"; + +[ChildProc=any] +protocol inconsistentRC { +child: + async SomeMessage(); +}; diff --git a/ipc/ipdl/test/ipdl/error/intrMessageCompress.ipdl b/ipc/ipdl/test/ipdl/error/intrMessageCompress.ipdl new file mode 100644 index 0000000000..e56cfc5d8c --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/intrMessageCompress.ipdl @@ -0,0 +1,10 @@ +//error: message `foo' in protocol `intrMessageCompress' requests compression but is not async +//error: message `bar' in protocol `intrMessageCompress' requests compression but is not async + +[ChildProc=any] +intr protocol intrMessageCompress { +parent: + [Compress, LegacyIntr] intr foo(); +child: + [Compress, LegacyIntr] intr bar(); +}; diff --git a/ipc/ipdl/test/ipdl/error/lex1.ipdl b/ipc/ipdl/test/ipdl/error/lex1.ipdl new file mode 100644 index 0000000000..a00629cbca --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/lex1.ipdl @@ -0,0 +1,2 @@ +//error: bad syntax near `slkdjfl' +slkdjfl*&^* diff --git a/ipc/ipdl/test/ipdl/error/manageSelfToplevel.ipdl b/ipc/ipdl/test/ipdl/error/manageSelfToplevel.ipdl new file mode 100644 index 0000000000..4540c2c2f6 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/manageSelfToplevel.ipdl @@ -0,0 +1,10 @@ +//error: top-level protocol `manageSelfToplevel' cannot manage itself + +protocol manageSelfToplevel { + manager manageSelfToplevel; + manages manageSelfToplevel; + +child: + async manageSelfToplevel(); + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/managedNoDtor.ipdl b/ipc/ipdl/test/ipdl/error/managedNoDtor.ipdl new file mode 100644 index 0000000000..41bbd76689 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/managedNoDtor.ipdl @@ -0,0 +1,7 @@ +//error: destructor declaration `__delete__(...)' required for managed protocol `managedNoDtor' +include protocol managerNoDtor; + +protocol managedNoDtor { + manager managerNoDtor; + // empty +}; diff --git a/ipc/ipdl/test/ipdl/error/managerNoDtor.ipdl b/ipc/ipdl/test/ipdl/error/managerNoDtor.ipdl new file mode 100644 index 0000000000..0417cc5ace --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/managerNoDtor.ipdl @@ -0,0 +1,11 @@ +//error: destructor declaration `__delete__(...)' required for managed protocol `managedNoDtor' + +include protocol managedNoDtor; + +protocol managerNoDtor { + manages managedNoDtor; + +parent: + async managedNoDtor(); + // error: no ctor defined +}; diff --git a/ipc/ipdl/test/ipdl/error/maybe_Recursive.ipdl b/ipc/ipdl/test/ipdl/error/maybe_Recursive.ipdl new file mode 100644 index 0000000000..2f356b423a --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/maybe_Recursive.ipdl @@ -0,0 +1,6 @@ +//error: bad syntax near `?' + +[ChildProc=any] +protocol maybe_Recursive { +child: async Msg(int?? aa); +}; diff --git a/ipc/ipdl/test/ipdl/error/maybe_SelfRecStruct.ipdl b/ipc/ipdl/test/ipdl/error/maybe_SelfRecStruct.ipdl new file mode 100644 index 0000000000..9dff6a2152 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/maybe_SelfRecStruct.ipdl @@ -0,0 +1,10 @@ +//error: struct `X' is only partially defined + +struct X { + X? x; +}; + +[ChildProc=any] +protocol maybe_SelfRecStruct { +child: async Msg(X? aa); +}; diff --git a/ipc/ipdl/test/ipdl/error/maybe_SelfRecUnion.ipdl b/ipc/ipdl/test/ipdl/error/maybe_SelfRecUnion.ipdl new file mode 100644 index 0000000000..b85497d9c1 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/maybe_SelfRecUnion.ipdl @@ -0,0 +1,8 @@ +//error: union `X' is only partially defined + +union X { X?; }; + +[ChildProc=any] +protocol maybe_SelfRecUnion { +child: async Msg(X? aa); +}; diff --git a/ipc/ipdl/test/ipdl/error/messageNoDirection.ipdl b/ipc/ipdl/test/ipdl/error/messageNoDirection.ipdl new file mode 100644 index 0000000000..5e889933cb --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/messageNoDirection.ipdl @@ -0,0 +1,6 @@ +//error: missing message direction + +[ChildProc=any] +protocol messageNoDirection { + async NoDirection(); +}; diff --git a/ipc/ipdl/test/ipdl/error/multimanDupMgrs.ipdl b/ipc/ipdl/test/ipdl/error/multimanDupMgrs.ipdl new file mode 100644 index 0000000000..805a9f905e --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/multimanDupMgrs.ipdl @@ -0,0 +1,10 @@ +//error: manager `multimanDupMgrsMgr' appears multiple times + +include protocol multimanDupMgrsMgr; + +protocol multimanDupMgrs { + manager multimanDupMgrsMgr or multimanDupMgrsMgr; + +child: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/multimanDupMgrsMgr.ipdl b/ipc/ipdl/test/ipdl/error/multimanDupMgrsMgr.ipdl new file mode 100644 index 0000000000..76e838cc57 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/multimanDupMgrsMgr.ipdl @@ -0,0 +1,12 @@ +//error: manager `multimanDupMgrsMgr' appears multiple times + +include protocol multimanDupMgrs; + +[ChildProc=any] +protocol multimanDupMgrsMgr { + manages multimanDupMgrs; + +child: + async multimanDupMgrs(); + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/multimanNonexistentMgrs.ipdl b/ipc/ipdl/test/ipdl/error/multimanNonexistentMgrs.ipdl new file mode 100644 index 0000000000..24dafb8163 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/multimanNonexistentMgrs.ipdl @@ -0,0 +1,10 @@ +//error: protocol `Starsky' referenced as |manager| of `multimanNonexistentMgrs' has not been declared +//error: protocol `Hutch' referenced as |manager| of `multimanNonexistentMgrs' has not been declared + +protocol multimanNonexistentMgrs { + manager Starsky or Hutch; + +child: + async Dummy(); + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/mutualRecStruct.ipdl b/ipc/ipdl/test/ipdl/error/mutualRecStruct.ipdl new file mode 100644 index 0000000000..3224438e90 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/mutualRecStruct.ipdl @@ -0,0 +1,25 @@ +//error: struct `X' is only partially defined +//error: struct `Y' is only partially defined +//error: struct `Z' is only partially defined + +struct X { + int i; + Y[] y; +}; + +struct Y { + X x; + Z z; +}; + +struct Z { + double d; + X x; +}; + +[ChildProc=any] +protocol mutualRecStruct { +child: + async Test(X x, Y y, Z z); + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/mutualRecStructUnion.ipdl b/ipc/ipdl/test/ipdl/error/mutualRecStructUnion.ipdl new file mode 100644 index 0000000000..65345642a5 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/mutualRecStructUnion.ipdl @@ -0,0 +1,25 @@ +//error: struct `X' is only partially defined +//error: union `Y' is only partially defined +//error: struct `Z' is only partially defined + +struct X { + int i; + Y[] y; +}; + +union Y { + X; + Z; +}; + +struct Z { + double d; + X x; +}; + +[ChildProc=any] +protocol mutualRecStructUnion { +child: + async Test(X x, Y y, Z z); + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/noProtocolInHeader.ipdlh b/ipc/ipdl/test/ipdl/error/noProtocolInHeader.ipdlh new file mode 100644 index 0000000000..1997eb77d9 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/noProtocolInHeader.ipdlh @@ -0,0 +1,7 @@ +//error: can't define a protocol in a header. Do it in a protocol spec instead. + +[ChildProc=any] +protocol noProtocolInHeader { +child: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/oldIncludeSyntax.ipdl b/ipc/ipdl/test/ipdl/error/oldIncludeSyntax.ipdl new file mode 100644 index 0000000000..6f90bc6d5f --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/oldIncludeSyntax.ipdl @@ -0,0 +1,8 @@ +//error: bad syntax near `"Foo.ipdl"' + +include protocol "Foo.ipdl"; + +[ChildProc=any] +protocol oldIncludeSyntax { +child: async __delete__(X x); +}; diff --git a/ipc/ipdl/test/ipdl/error/parser.ipdl b/ipc/ipdl/test/ipdl/error/parser.ipdl new file mode 100644 index 0000000000..8bfd63546a --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/parser.ipdl @@ -0,0 +1,3 @@ +//error: bad syntax near `???' + +protocol parser { diff --git a/ipc/ipdl/test/ipdl/error/redeclMessage.ipdl b/ipc/ipdl/test/ipdl/error/redeclMessage.ipdl new file mode 100644 index 0000000000..63a70d31a6 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/redeclMessage.ipdl @@ -0,0 +1,13 @@ +//error: message name `Msg' already declared as `MessageType' +//error: redeclaration of symbol `Msg', first declared at + +[ChildProc=any] +protocol redeclMessage { + + // can't declare two messages with the same name + +child: + async Msg(); + async Msg(); + +}; diff --git a/ipc/ipdl/test/ipdl/error/redeclParamReturn.ipdl b/ipc/ipdl/test/ipdl/error/redeclParamReturn.ipdl new file mode 100644 index 0000000000..71a1532bb2 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/redeclParamReturn.ipdl @@ -0,0 +1,10 @@ +//error: redeclaration of symbol `f', first declared at + +[ChildProc=any] +sync protocol redeclParamReturn { + + // it's an error to name a parameter with the same id as a return + +parent: async Msg(int f) returns (bool f); + +}; diff --git a/ipc/ipdl/test/ipdl/error/redeclScope.ipdlh b/ipc/ipdl/test/ipdl/error/redeclScope.ipdlh new file mode 100644 index 0000000000..a64439b599 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/redeclScope.ipdlh @@ -0,0 +1,12 @@ +//error: redeclaration of symbol `Foo', first declared at + +struct Foo { + bool b; +}; + +struct Bar { + // This should produce an error saying that Foo is a redeclaration, + // even though the initial declaration was in a different frame of + // the symbol table. + bool Foo; +}; diff --git a/ipc/ipdl/test/ipdl/error/shmem.ipdl b/ipc/ipdl/test/ipdl/error/shmem.ipdl new file mode 100644 index 0000000000..4511ce65dd --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/shmem.ipdl @@ -0,0 +1,9 @@ +//error: redeclaration of symbol `Shmem', first declared at +//error: redeclaration of symbol `::mozilla::ipc::Shmem', first declared at + +using class mozilla::ipc::Shmem from "mozilla/ipc/Shmem.h"; // redeclaration + +[ChildProc=any] +protocol shmem { +child: async Msg(Shmem s); +}; diff --git a/ipc/ipdl/test/ipdl/error/structRedecl.ipdl b/ipc/ipdl/test/ipdl/error/structRedecl.ipdl new file mode 100644 index 0000000000..37d87d6627 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/structRedecl.ipdl @@ -0,0 +1,11 @@ +//error: redeclaration of symbol `a', first declared at + +struct Redecl { + int a; + double a; +}; + +[ChildProc=any] +protocol structRedecl { +child: async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/structUnknownField.ipdl b/ipc/ipdl/test/ipdl/error/structUnknownField.ipdl new file mode 100644 index 0000000000..e8702a9b78 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/structUnknownField.ipdl @@ -0,0 +1,10 @@ +//error: field `i' of struct `S' has unknown type `Foobers' + +struct S { + Foobers i; +}; + +[ChildProc=any] +protocol structUnknownField { +child: async __delete__(S s); +}; diff --git a/ipc/ipdl/test/ipdl/error/syncMessageCompress.ipdl b/ipc/ipdl/test/ipdl/error/syncMessageCompress.ipdl new file mode 100644 index 0000000000..0a3b63be2c --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/syncMessageCompress.ipdl @@ -0,0 +1,7 @@ +//error: message `foo' in protocol `syncMessageCompress' requests compression but is not async + +[ChildProc=any] +sync protocol syncMessageCompress { +parent: + [Compress] sync foo(); +}; diff --git a/ipc/ipdl/test/ipdl/error/syncParentToChild.ipdl b/ipc/ipdl/test/ipdl/error/syncParentToChild.ipdl new file mode 100644 index 0000000000..8ce7c0be47 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/syncParentToChild.ipdl @@ -0,0 +1,9 @@ +//error: sync parent-to-child messages are verboten (here, message `Msg' in protocol `syncParentToChild') + +[ChildProc=any] +intr protocol syncParentToChild { + + // can't declare sync parent-to-child messages +child: sync Msg(); + +}; diff --git a/ipc/ipdl/test/ipdl/error/tooWeakIntrAsync.ipdl b/ipc/ipdl/test/ipdl/error/tooWeakIntrAsync.ipdl new file mode 100644 index 0000000000..7dad5e68ef --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/tooWeakIntrAsync.ipdl @@ -0,0 +1,10 @@ +//error: message `Msg' requires more powerful send semantics than its protocol `tooWeakIntrAsync' provides + +[ChildProc=any] +protocol tooWeakIntrAsync { + + // it's an error to declare an async protocol with an intr message + +parent: [LegacyIntr] intr Msg(); + +}; diff --git a/ipc/ipdl/test/ipdl/error/tooWeakIntrSync.ipdl b/ipc/ipdl/test/ipdl/error/tooWeakIntrSync.ipdl new file mode 100644 index 0000000000..a56e884e73 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/tooWeakIntrSync.ipdl @@ -0,0 +1,9 @@ +//error: message `Msg' requires more powerful send semantics than its protocol `tooWeakIntrSync' provides + +[ChildProc=any] +sync protocol tooWeakIntrSync { + + // it's an error to declare a sync protocol with an interrupt message +parent: + [LegacyIntr] intr Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/tooWeakSyncAsync.ipdl b/ipc/ipdl/test/ipdl/error/tooWeakSyncAsync.ipdl new file mode 100644 index 0000000000..8ebbfd25da --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/tooWeakSyncAsync.ipdl @@ -0,0 +1,10 @@ +//error: message `Msg' requires more powerful send semantics than its protocol `tooWeakSyncAsync' provides + +[ChildProc=any] +protocol tooWeakSyncAsync { + + // it's an error to declare an async protocol with a sync message + +parent: sync Msg(); + +}; diff --git a/ipc/ipdl/test/ipdl/error/twoprotocols.ipdl b/ipc/ipdl/test/ipdl/error/twoprotocols.ipdl new file mode 100644 index 0000000000..93222292a5 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/twoprotocols.ipdl @@ -0,0 +1,13 @@ +// it's an error to define two protocols in the same file + +//error: only one protocol definition per file + +[ChildProc=any] +protocol p1 { +child: async Msg(); +}; + +[ChildProc=any] +protocol p2 { +child: async Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/undeclParamType.ipdl b/ipc/ipdl/test/ipdl/error/undeclParamType.ipdl new file mode 100644 index 0000000000..efc21f0529 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/undeclParamType.ipdl @@ -0,0 +1,8 @@ +//error: argument typename `FARGLEGARGLE' of message `Msg' has not been declared + +[ChildProc=any] +protocol undeclParamType { + +child: async Msg(FARGLEGARGLE p); + +}; diff --git a/ipc/ipdl/test/ipdl/error/undeclProtocol.ipdl b/ipc/ipdl/test/ipdl/error/undeclProtocol.ipdl new file mode 100644 index 0000000000..19532e3b9c --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/undeclProtocol.ipdl @@ -0,0 +1,9 @@ +//error: protocol `undeclared', managed by `undeclProtocol', has not been declared + +[ChildProc=any] +protocol undeclProtocol { + manages undeclared; + +child: + async undeclared(); +}; diff --git a/ipc/ipdl/test/ipdl/error/undeclReturnType.ipdl b/ipc/ipdl/test/ipdl/error/undeclReturnType.ipdl new file mode 100644 index 0000000000..87fe0d6223 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/undeclReturnType.ipdl @@ -0,0 +1,8 @@ +//error: argument typename `FARGLEGARGLE' of message `Msg' has not been declared + +[ChildProc=any] +sync protocol undeclReturnType { + +child: sync Msg() returns (FARGLEGARGLE r); + +}; diff --git a/ipc/ipdl/test/ipdl/error/undefMutualRecStruct.ipdl b/ipc/ipdl/test/ipdl/error/undefMutualRecStruct.ipdl new file mode 100644 index 0000000000..79fa3729cc --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/undefMutualRecStruct.ipdl @@ -0,0 +1,12 @@ +//error: struct `X' is only partially defined +//error: struct `Y' is only partially defined +//error: struct `Z' is only partially defined + +struct X { Y y; }; +struct Y { Z z; }; +struct Z { X x; }; + +[ChildProc=any] +protocol undefMutualRecStruct { +child: async __delete__(X x); +}; diff --git a/ipc/ipdl/test/ipdl/error/undefMutualRecStructUnion.ipdl b/ipc/ipdl/test/ipdl/error/undefMutualRecStructUnion.ipdl new file mode 100644 index 0000000000..09e7116a68 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/undefMutualRecStructUnion.ipdl @@ -0,0 +1,12 @@ +//error: struct `X' is only partially defined +//error: union `Y' is only partially defined +//error: struct `Z' is only partially defined + +struct X { Y y; }; +union Y { Z; }; +struct Z { X x; }; + +[ChildProc=any] +protocol undefMutualRecStructUnion { +child: async __delete__(X x); +}; diff --git a/ipc/ipdl/test/ipdl/error/undefMutualRecUnion.ipdl b/ipc/ipdl/test/ipdl/error/undefMutualRecUnion.ipdl new file mode 100644 index 0000000000..497836ba4f --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/undefMutualRecUnion.ipdl @@ -0,0 +1,12 @@ +//error: union `X' is only partially defined +//error: union `Y' is only partially defined +//error: union `Z' is only partially defined + +union X { Y; }; +union Y { Z; }; +union Z { X; }; + +[ChildProc=any] +protocol undefMutualRecUnion { +child: async __delete__(X x); +}; diff --git a/ipc/ipdl/test/ipdl/error/undefSelfRecStruct.ipdl b/ipc/ipdl/test/ipdl/error/undefSelfRecStruct.ipdl new file mode 100644 index 0000000000..1c23da1a77 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/undefSelfRecStruct.ipdl @@ -0,0 +1,8 @@ +//error: struct `X' is only partially defined + +struct X { X x; }; + +[ChildProc=any] +protocol undefSelfRecStruct { +child: async __delete__(X x); +}; diff --git a/ipc/ipdl/test/ipdl/error/undefSelfRecUnion.ipdl b/ipc/ipdl/test/ipdl/error/undefSelfRecUnion.ipdl new file mode 100644 index 0000000000..2c7572f11d --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/undefSelfRecUnion.ipdl @@ -0,0 +1,8 @@ +//error: union `X' is only partially defined + +union X { X; }; + +[ChildProc=any] +protocol undefSelfRecUnion { +child: async __delete__(X x); +}; diff --git a/ipc/ipdl/test/ipdl/error/unknownIntrMessage.ipdl b/ipc/ipdl/test/ipdl/error/unknownIntrMessage.ipdl new file mode 100644 index 0000000000..7ce415aba0 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/unknownIntrMessage.ipdl @@ -0,0 +1,7 @@ +//error: Unknown sync IPC message unknownIntrMessage::Msg + +[ChildProc=any] +intr protocol unknownIntrMessage { +parent: + [LegacyIntr] intr Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/error/unknownSyncMessage.ipdl b/ipc/ipdl/test/ipdl/error/unknownSyncMessage.ipdl new file mode 100644 index 0000000000..ab1baecd35 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/unknownSyncMessage.ipdl @@ -0,0 +1,7 @@ +//error: Unknown sync IPC message unknownSyncMessage::Msg + +[ChildProc=any] +sync protocol unknownSyncMessage { +parent: + sync Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/message-metadata.ini b/ipc/ipdl/test/ipdl/message-metadata.ini new file mode 100644 index 0000000000..02ec1a992f --- /dev/null +++ b/ipc/ipdl/test/ipdl/message-metadata.ini @@ -0,0 +1,2 @@ +# The IPDL parser expects this file to exist, even though we don't +# need it for parsing tests, so here's an empty file.
\ No newline at end of file diff --git a/ipc/ipdl/test/ipdl/moz.build b/ipc/ipdl/test/ipdl/moz.build new file mode 100644 index 0000000000..572682b594 --- /dev/null +++ b/ipc/ipdl/test/ipdl/moz.build @@ -0,0 +1,8 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +# Copy test files so that they can be referenced in the docs. +SPHINX_TREES["/ipc/_static"] = "ok" diff --git a/ipc/ipdl/test/ipdl/ok/MutRecHeader1.ipdlh b/ipc/ipdl/test/ipdl/ok/MutRecHeader1.ipdlh new file mode 100644 index 0000000000..56135b2197 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/MutRecHeader1.ipdlh @@ -0,0 +1,34 @@ +include MutRecHeader2; + +/* MutRecHeader1 (H1) includes MutRecHeader2 (H2), and uses a struct from H2. + H2 includes MutRecHeader3 (H3). + H3 includes H1. + +When type checking H1, GatherDecls::visitInclude will recursively +cause us to first check H2, which in turn will cause us to first check +H3. + +H3 only includes H1, so when we check it, we do not have any +declarations from H2 in the context. There used to be code in +GatherDecls::visitTranslationUnit that would, as part of the "second +pass", check the validity of all included structures. This would check +Struct1, and fail, because Struct2 is not declared. + +Fundamentally, it doesn't make sense to check anything declared in an +included file in the context of the file that included it. + +Note that this error did not show up when either H2 or H3 was +checked. This is because in those cases we are not in the middle of +checking H1 when we check H3, so we end up fully checking H1 before we +get to the end of checking H3. This means the "visited" tag gets put +on Struct1 before we get to the end of that troublesome block of code +in visitTranslationUnit, and visitStructDecl doesn't do anything if +that tag is set, so we don't end up actually checking H1 in the +context of H3. + +*/ + +struct Struct1 +{ + Struct2 b; +}; diff --git a/ipc/ipdl/test/ipdl/ok/MutRecHeader2.ipdlh b/ipc/ipdl/test/ipdl/ok/MutRecHeader2.ipdlh new file mode 100644 index 0000000000..142979dc45 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/MutRecHeader2.ipdlh @@ -0,0 +1,8 @@ +include MutRecHeader3; + +// See MutRecHeader1.ipdlh for explanation. + +struct Struct2 +{ + bool b; +}; diff --git a/ipc/ipdl/test/ipdl/ok/MutRecHeader3.ipdlh b/ipc/ipdl/test/ipdl/ok/MutRecHeader3.ipdlh new file mode 100644 index 0000000000..2e303ae444 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/MutRecHeader3.ipdlh @@ -0,0 +1,8 @@ +include MutRecHeader1; + +// See MutRecHeader1.ipdlh for explanation. + +struct Struct3 +{ + bool b; +}; diff --git a/ipc/ipdl/test/ipdl/ok/MyTypes.ipdlh b/ipc/ipdl/test/ipdl/ok/MyTypes.ipdlh new file mode 100644 index 0000000000..9e33d71c51 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/MyTypes.ipdlh @@ -0,0 +1,6 @@ +include protocol PMyManaged; + +struct MyActorPair { + PMyManaged actor1; + nullable PMyManaged actor2; +}; diff --git a/ipc/ipdl/test/ipdl/ok/PAsyncReturn.ipdl b/ipc/ipdl/test/ipdl/ok/PAsyncReturn.ipdl new file mode 100644 index 0000000000..5deae9216b --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PAsyncReturn.ipdl @@ -0,0 +1,9 @@ +// Async messages are not allowed to return values. + +//error: asynchronous message `Msg' declares return values + +[ChildProc=any] +protocol PAsyncReturn { +child: + async Msg() returns(int32_t aNumber); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PDelete.ipdl b/ipc/ipdl/test/ipdl/ok/PDelete.ipdl new file mode 100644 index 0000000000..006c73dc0d --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PDelete.ipdl @@ -0,0 +1,9 @@ +include protocol PDeleteSub; + +[ChildProc=any] +sync protocol PDelete { + manages PDeleteSub; + +child: + async PDeleteSub(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PDeleteSub.ipdl b/ipc/ipdl/test/ipdl/ok/PDeleteSub.ipdl new file mode 100644 index 0000000000..12b4c677eb --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PDeleteSub.ipdl @@ -0,0 +1,10 @@ +include protocol PDelete; + +sync protocol PDeleteSub { + manager PDelete; + +parent: + sync __delete__(int x) returns (double d); + +}; + diff --git a/ipc/ipdl/test/ipdl/ok/PEndpointDecl.ipdl b/ipc/ipdl/test/ipdl/ok/PEndpointDecl.ipdl new file mode 100644 index 0000000000..f8fe51864a --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PEndpointDecl.ipdl @@ -0,0 +1,19 @@ + +// Basic test that Endpoint types are declared for protocols, within +// that protocol. + +struct Whatever { + Endpoint<PEndpointDeclParent> par; + Endpoint<PEndpointDeclChild> chi; +}; + +namespace mozilla { + +[ChildProc=any] +protocol PEndpointDecl { + child: + async Message(Endpoint<PEndpointDeclParent> aEndpointParent, + Endpoint<PEndpointDeclChild> aEndpointChild); +}; + +} diff --git a/ipc/ipdl/test/ipdl/ok/PEndpointUse.ipdl b/ipc/ipdl/test/ipdl/ok/PEndpointUse.ipdl new file mode 100644 index 0000000000..8fde19c8e5 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PEndpointUse.ipdl @@ -0,0 +1,10 @@ +include protocol PEndpointDecl; + +// Basic test that Endpoint types are declared for included protocols. + +[ChildProc=any] +protocol PEndpointUse { + child: + async Message(Endpoint<PEndpointDeclParent> aEndpointParent, + Endpoint<PEndpointDeclChild> aEndpointChild); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PExtendedAttrMultipleAttributes.ipdl b/ipc/ipdl/test/ipdl/ok/PExtendedAttrMultipleAttributes.ipdl new file mode 100644 index 0000000000..ce49ed8d2a --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PExtendedAttrMultipleAttributes.ipdl @@ -0,0 +1,5 @@ +[NestedUpTo=inside_sync, NeedsOtherPid, ChildProc=any] +async protocol PExtendedAttrMultipleAttributes { +parent: + async Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PLazySend.ipdl b/ipc/ipdl/test/ipdl/ok/PLazySend.ipdl new file mode 100644 index 0000000000..e67b35a153 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PLazySend.ipdl @@ -0,0 +1,7 @@ +[ChildProc=any] +protocol PLazySend { +child: + [LazySend] async foo(); +parent: + [LazySend] async bar() returns (bool baz); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PManagedEndpointDecl.ipdl b/ipc/ipdl/test/ipdl/ok/PManagedEndpointDecl.ipdl new file mode 100644 index 0000000000..13eb10fcc4 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PManagedEndpointDecl.ipdl @@ -0,0 +1,23 @@ +include protocol PManagedEndpointManager; + +// Basic test that ManagedEndpoint types are declared for protocols, within +// that protocol. + +struct ManagedWhatever { + ManagedEndpoint<PManagedEndpointDeclParent> par; + ManagedEndpoint<PManagedEndpointDeclChild> chi; +}; + +namespace mozilla { + +protocol PManagedEndpointDecl { + manager PManagedEndpointManager; + +child: + async Message(ManagedEndpoint<PManagedEndpointDeclParent> aEndpointParent, + ManagedEndpoint<PManagedEndpointDeclChild> aEndpointChild); + + async __delete__(); +}; + +} diff --git a/ipc/ipdl/test/ipdl/ok/PManagedEndpointManager.ipdl b/ipc/ipdl/test/ipdl/ok/PManagedEndpointManager.ipdl new file mode 100644 index 0000000000..2ae381c72b --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PManagedEndpointManager.ipdl @@ -0,0 +1,15 @@ +include protocol PManagedEndpointDecl; + +namespace mozilla { + +[ChildProc=any] +protocol PManagedEndpointManager { + manages PManagedEndpointDecl; + +child: + async Message(ManagedEndpoint<PManagedEndpointDeclParent> aEndpointParent, + ManagedEndpoint<PManagedEndpointDeclChild> aEndpointChild); +}; + +} + diff --git a/ipc/ipdl/test/ipdl/ok/PManualDealloc.ipdl b/ipc/ipdl/test/ipdl/ok/PManualDealloc.ipdl new file mode 100644 index 0000000000..53660762ad --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PManualDealloc.ipdl @@ -0,0 +1,8 @@ +include protocol PManualDealloc_manager; + +[ManualDealloc] async protocol PManualDealloc { + manager PManualDealloc_manager; + +child: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PManualDealloc_manager.ipdl b/ipc/ipdl/test/ipdl/ok/PManualDealloc_manager.ipdl new file mode 100644 index 0000000000..d425a6781f --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PManualDealloc_manager.ipdl @@ -0,0 +1,8 @@ +include protocol PManualDealloc; + +// [ManualDealloc] types must have a manager, as all toplevel protocols are +// refcounted. +[ChildProc=any] +async protocol PManualDealloc_manager { + manages PManualDealloc; +}; diff --git a/ipc/ipdl/test/ipdl/ok/PMessageTainted.ipdl b/ipc/ipdl/test/ipdl/ok/PMessageTainted.ipdl new file mode 100644 index 0000000000..deb10fb7ac --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PMessageTainted.ipdl @@ -0,0 +1,5 @@ +[ChildProc=any] +intr protocol PMessageTainted { +child: + [Tainted] async foo(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PMessageTaintedWithPassback.ipdl b/ipc/ipdl/test/ipdl/ok/PMessageTaintedWithPassback.ipdl new file mode 100644 index 0000000000..8db2c8b742 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PMessageTaintedWithPassback.ipdl @@ -0,0 +1,5 @@ +[ChildProc=any] +intr protocol PMessageTaintedWithPassback { +child: + [Tainted] async foo([NoTaint=passback] int id); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PMyManaged.ipdl b/ipc/ipdl/test/ipdl/ok/PMyManaged.ipdl new file mode 100644 index 0000000000..d6ddb34bf8 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PMyManaged.ipdl @@ -0,0 +1,13 @@ +include protocol PMyManager; + +namespace mozilla { +namespace myns { + +protocol PMyManaged { + manager PMyManager; + child: + async __delete__(Shmem aShmem); +}; + +} // namespace myns +} // namespace mozilla diff --git a/ipc/ipdl/test/ipdl/ok/PMyManager.ipdl b/ipc/ipdl/test/ipdl/ok/PMyManager.ipdl new file mode 100644 index 0000000000..4ed2706ffd --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PMyManager.ipdl @@ -0,0 +1,31 @@ +include protocol PMyManaged; +include MyTypes; // for MyActorPair + +using MyActorEnum from "mozilla/myns/MyActorUtils.h"; +using mozilla::myns::MyData from "mozilla/MyDataTypes.h"; +[MoveOnly] using class mozilla::myns::MyOtherData from "mozilla/MyDataTypes.h"; +[RefCounted] using class mozilla::myns::MyThirdData from "mozilla/MyDataTypes.h"; + +namespace mozilla { +namespace myns { + +[Comparable] union MyUnion { + float; + MyOtherData; +}; + +[ChildProc=any] +sync protocol PMyManager { + manages PMyManaged; + parent: + async __delete__(nsString aNote); + sync SomeMsg(MyActorPair? aActors, MyData[] aMyData) + returns (int32_t x, int32_t y, MyUnion aUnion); + async PMyManaged(); + both: + [Tainted] async AnotherMsg(MyActorEnum aEnum, int32_t aNumber) + returns (MyOtherData aOtherData); +}; + +} // namespace myns +} // namespace mozilla diff --git a/ipc/ipdl/test/ipdl/ok/PNested.ipdl b/ipc/ipdl/test/ipdl/ok/PNested.ipdl new file mode 100644 index 0000000000..94865bca6b --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PNested.ipdl @@ -0,0 +1,8 @@ +[NestedUpTo=inside_cpow, ChildProc=any] +sync protocol PNested { +parent: + [Nested=not] async NotNested(); + [Nested=inside_sync] sync InsideSync(); + [Nested=inside_cpow] async InsideCpow(); + [Nested=inside_cpow] sync InsideCpowSync(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PNullable.ipdl b/ipc/ipdl/test/ipdl/ok/PNullable.ipdl new file mode 100644 index 0000000000..b7b21ff885 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PNullable.ipdl @@ -0,0 +1,22 @@ +[RefCounted] using class nsIURI from "nsIURI.h"; + +union Union { + nullable PNullable; + nullable PNullable[]; + nullable PNullable?; + nullable nsIURI; + nullable nsIURI[]; + nullable nsIURI?; +}; + +[ChildProc=any] +protocol PNullable { +child: + async Msg(nullable PNullable n); + async Msg2(nullable PNullable[] N); + async Msg3(nullable PNullable? n); + async Msg4(nullable nsIURI u); + async Msg5(nullable nsIURI[] u); + async Msg6(nullable nsIURI? u); + async Msg7(Union u); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PSideImpl.ipdl b/ipc/ipdl/test/ipdl/ok/PSideImpl.ipdl new file mode 100644 index 0000000000..4ebb1b8ec3 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PSideImpl.ipdl @@ -0,0 +1,5 @@ +[ParentImpl=virtual, ChildImpl="mozilla::FooBarImpl", ChildProc=any] +async protocol PSideImpl { + parent: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PStruct.ipdl b/ipc/ipdl/test/ipdl/ok/PStruct.ipdl new file mode 100644 index 0000000000..f76f7db98f --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PStruct.ipdl @@ -0,0 +1,11 @@ +struct S { + int i; + double d; +}; + +[ChildProc=any] +sync protocol PStruct { +parent: + sync test(S s) returns (S ss); + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PStructComparable.ipdl b/ipc/ipdl/test/ipdl/ok/PStructComparable.ipdl new file mode 100644 index 0000000000..89576368ec --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PStructComparable.ipdl @@ -0,0 +1,11 @@ +[Comparable] struct S { + int i; + double d; +}; + +[ChildProc=any] +sync protocol PStructComparable { +parent: + sync test(S s) returns (S ss); + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PSyncSyncManagee.ipdl b/ipc/ipdl/test/ipdl/ok/PSyncSyncManagee.ipdl new file mode 100644 index 0000000000..458f0c83c0 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PSyncSyncManagee.ipdl @@ -0,0 +1,7 @@ +include protocol PSyncSyncManager; + +sync protocol PSyncSyncManagee { + manager PSyncSyncManager; +child: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PSyncSyncManager.ipdl b/ipc/ipdl/test/ipdl/ok/PSyncSyncManager.ipdl new file mode 100644 index 0000000000..d3fc236ff8 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PSyncSyncManager.ipdl @@ -0,0 +1,12 @@ +include protocol PSyncSyncManagee; + +/* The main reason for this test is that it would have caught a bug + * in the Rust IPDL parser that was treating "sync" like "async" in the + * nested case. + */ +[NestedUpTo=not, ChildProc=any] +sync protocol PSyncSyncManager { + manages PSyncSyncManagee; +parent: + async PSyncSyncManagee(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PUniquePtrBasic.ipdl b/ipc/ipdl/test/ipdl/ok/PUniquePtrBasic.ipdl new file mode 100644 index 0000000000..097dd04684 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PUniquePtrBasic.ipdl @@ -0,0 +1,5 @@ +[ChildProc=any] +protocol PUniquePtrBasic { +child: + async Msg(UniquePtr<int> maybe); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PUniquePtrOfActors.ipdl b/ipc/ipdl/test/ipdl/ok/PUniquePtrOfActors.ipdl new file mode 100644 index 0000000000..24631db712 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PUniquePtrOfActors.ipdl @@ -0,0 +1,11 @@ +include protocol PUniquePtrOfActorsSub; + +[ChildProc=any] +protocol PUniquePtrOfActors { + manages PUniquePtrOfActorsSub; + +child: + async Msg(UniquePtr<PUniquePtrOfActorsSub> p); + + async PUniquePtrOfActorsSub(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PUniquePtrOfActorsSub.ipdl b/ipc/ipdl/test/ipdl/ok/PUniquePtrOfActorsSub.ipdl new file mode 100644 index 0000000000..a60c8e475f --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PUniquePtrOfActorsSub.ipdl @@ -0,0 +1,7 @@ +include protocol PUniquePtrOfActors; + +protocol PUniquePtrOfActorsSub { + manager PUniquePtrOfActors; + +child: async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PUniquePtrRecUnion.ipdl b/ipc/ipdl/test/ipdl/ok/PUniquePtrRecUnion.ipdl new file mode 100644 index 0000000000..40ac466b40 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PUniquePtrRecUnion.ipdl @@ -0,0 +1,22 @@ +union X { + int; + Y[]; + UniquePtr<Y>; +}; + +union Y { + X; + Z; +}; + +union Z { + double; + X; +}; + +[ChildProc=any] +protocol PUniquePtrRecUnion { +child: + async Test(X x, Y y, Z z); + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PUniquePtrUnion.ipdl b/ipc/ipdl/test/ipdl/ok/PUniquePtrUnion.ipdl new file mode 100644 index 0000000000..de4529c639 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PUniquePtrUnion.ipdl @@ -0,0 +1,11 @@ +union UniquePtrUnion { + int[]; + int; + double; +}; + +[ChildProc=any] +sync protocol PUniquePtrUnion { +parent: + async Msg(UniquePtrUnion u, UniquePtr<UniquePtrUnion> au) returns (UniquePtrUnion r); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PVirtualSendImpl.ipdl b/ipc/ipdl/test/ipdl/ok/PVirtualSendImpl.ipdl new file mode 100644 index 0000000000..ff09108965 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PVirtualSendImpl.ipdl @@ -0,0 +1,6 @@ +[ChildProc=any] +async protocol PVirtualSendImpl +{ +child: + [VirtualSendImpl] async MockableFoo(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/Pactorparam.ipdl b/ipc/ipdl/test/ipdl/ok/Pactorparam.ipdl new file mode 100644 index 0000000000..bb7bb85518 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pactorparam.ipdl @@ -0,0 +1,6 @@ +[ChildProc=any] +protocol Pactorparam { + +child: async Msg(Pactorparam p); + +}; diff --git a/ipc/ipdl/test/ipdl/ok/Pactorreturn.ipdl b/ipc/ipdl/test/ipdl/ok/Pactorreturn.ipdl new file mode 100644 index 0000000000..4e8e53a9d6 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pactorreturn.ipdl @@ -0,0 +1,7 @@ +[ChildProc=any] +sync protocol Pactorreturn { + +parent: + sync Msg(Pactorreturn p) returns (Pactorreturn r); + +}; diff --git a/ipc/ipdl/test/ipdl/ok/Parray_Basic.ipdl b/ipc/ipdl/test/ipdl/ok/Parray_Basic.ipdl new file mode 100644 index 0000000000..7ce682f154 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Parray_Basic.ipdl @@ -0,0 +1,5 @@ +[ChildProc=any] +protocol Parray_Basic { +child: + async Msg(int[] array); +}; diff --git a/ipc/ipdl/test/ipdl/ok/Parray_OfActors.ipdl b/ipc/ipdl/test/ipdl/ok/Parray_OfActors.ipdl new file mode 100644 index 0000000000..170f4e902a --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Parray_OfActors.ipdl @@ -0,0 +1,11 @@ +include protocol Parray_OfActorsSub; + +[ChildProc=any] +protocol Parray_OfActors { + manages Parray_OfActorsSub; + +child: + async Msg(Parray_OfActorsSub[] p); + + async Parray_OfActorsSub(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/Parray_OfActorsSub.ipdl b/ipc/ipdl/test/ipdl/ok/Parray_OfActorsSub.ipdl new file mode 100644 index 0000000000..6769e98abb --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Parray_OfActorsSub.ipdl @@ -0,0 +1,7 @@ +include protocol Parray_OfActors; + +protocol Parray_OfActorsSub { + manager Parray_OfActors; + +child: async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/Parray_Union.ipdl b/ipc/ipdl/test/ipdl/ok/Parray_Union.ipdl new file mode 100644 index 0000000000..2733d5fc04 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Parray_Union.ipdl @@ -0,0 +1,11 @@ +union Union { + int[]; + int; + double; +}; + +[ChildProc=any] +sync protocol Parray_Union { +parent: + sync Msg(Union u, Union[] au) returns (Union r); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PbasicUsing.ipdl b/ipc/ipdl/test/ipdl/ok/PbasicUsing.ipdl new file mode 100644 index 0000000000..94d57b08d0 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PbasicUsing.ipdl @@ -0,0 +1,51 @@ +using SomeType from "SomeFile.h"; +using class SomeClass from "SomeFile.h"; +using struct SomeStruct from "SomeFile.h"; + +[RefCounted] using SomeRefcountedType from "SomeFile.h"; +[RefCounted] using class SomeRefcountedClass from "SomeFile.h"; +[RefCounted] using struct SomeRefcountedStruct from "SomeFile.h"; + +[MoveOnly] using SomeMoveonlyType from "SomeFile.h"; +[MoveOnly] using class SomeMoveonlyClass from "SomeFile.h"; +[MoveOnly] using struct SomeMoveonlyStruct from "SomeFile.h"; + +[RefCounted, MoveOnly] using SomeRefcountedMoveonlyType from "SomeFile.h"; +[RefCounted, MoveOnly] using class SomeRefcountedMoveonlyClass from "SomeFile.h"; +[RefCounted, MoveOnly] using struct SomeRefcountedMoveonlyStruct from "SomeFile.h"; + +[MoveOnly=data] using SomeMoveonlyDataType from "SomeFile.h"; +[MoveOnly=data] using class SomeMoveonlyDataClass from "SomeFile.h"; +[MoveOnly=data] using struct SomeMoveonlyDataStruct from "SomeFile.h"; + +[MoveOnly=send] using SomeMoveonlySendType from "SomeFile.h"; +[MoveOnly=send] using class SomeMoveonlySendClass from "SomeFile.h"; +[MoveOnly=send] using struct SomeMoveonlySendStruct from "SomeFile.h"; + +union SomeUnion +{ + SomeType; + SomeClass; + SomeStruct; + SomeRefcountedType; + SomeRefcountedClass; + SomeRefcountedStruct; + SomeMoveonlyType; + SomeMoveonlyClass; + SomeMoveonlyStruct; + SomeRefcountedMoveonlyType; + SomeRefcountedMoveonlyClass; + SomeRefcountedMoveonlyStruct; + SomeMoveonlyDataType; + SomeMoveonlyDataClass; + SomeMoveonlyDataStruct; + SomeMoveonlySendType; + SomeMoveonlySendClass; + SomeMoveonlySendStruct; +}; + +[ChildProc=any] +protocol PbasicUsing { +child: + async Msg(SomeUnion foo); +}; diff --git a/ipc/ipdl/test/ipdl/ok/Pbuiltins.ipdl b/ipc/ipdl/test/ipdl/ok/Pbuiltins.ipdl new file mode 100644 index 0000000000..3cd023a0b6 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pbuiltins.ipdl @@ -0,0 +1,22 @@ +[ChildProc=any] +protocol Pbuiltins { + + // sanity-check that "essential" builtins are being declared + +child: async Msg(bool b, + char c, + int i, + long l, + + float f, + double d, + + int8_t i8t, + uint8_t u8t, + int16_t i16t, + uint16_t u16t, + int32_t i32t, + uint32_t u32t, + int64_t i64t, + uint64_t u64t); +}; diff --git a/ipc/ipdl/test/ipdl/ok/Pbytebuf.ipdl b/ipc/ipdl/test/ipdl/ok/Pbytebuf.ipdl new file mode 100644 index 0000000000..a0ceac937f --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pbytebuf.ipdl @@ -0,0 +1,14 @@ +union Foo { + int; + ByteBuf; +}; + +[ChildProc=any] +intr protocol Pbytebuf { +parent: + async Msg(ByteBuf s, Foo f); + sync SyncMsg(ByteBuf s, Foo f) + returns (ByteBuf t, Foo g); + [LegacyIntr] intr InterruptMsg(ByteBuf s, Foo f) + returns (ByteBuf t, Foo g); +}; diff --git a/ipc/ipdl/test/ipdl/ok/Pempty.ipdl b/ipc/ipdl/test/ipdl/ok/Pempty.ipdl new file mode 100644 index 0000000000..4ab603dbc8 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pempty.ipdl @@ -0,0 +1,4 @@ +[ChildProc=any] +protocol Pempty { +child: async Msg(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PemptyStruct.ipdl b/ipc/ipdl/test/ipdl/ok/PemptyStruct.ipdl new file mode 100644 index 0000000000..a3317cb872 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PemptyStruct.ipdl @@ -0,0 +1,4 @@ +struct empty { }; + +[ChildProc=any] +protocol PemptyStruct { child: async __delete__(); }; diff --git a/ipc/ipdl/test/ipdl/ok/PheaderProto.ipdl b/ipc/ipdl/test/ipdl/ok/PheaderProto.ipdl new file mode 100644 index 0000000000..5c9af7c3f9 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PheaderProto.ipdl @@ -0,0 +1,11 @@ +include header; + +namespace c { + +[ChildProc=any] +protocol PheaderProto { +child: + async __delete__(foo a, baz b, Inner1 c, Inner2 d, X x); +}; + +} diff --git a/ipc/ipdl/test/ipdl/ok/PintrProtocol.ipdl b/ipc/ipdl/test/ipdl/ok/PintrProtocol.ipdl new file mode 100644 index 0000000000..4b663327e6 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PintrProtocol.ipdl @@ -0,0 +1,14 @@ +[ChildProc=any] +intr protocol PintrProtocol { + + // sanity check of Interrupt protocols +child: + async AsyncMsg(); + +parent: + sync SyncMsg(int i) returns (int r); + +both: + [LegacyIntr] intr InterruptMsg(int x) returns (int y); + +}; diff --git a/ipc/ipdl/test/ipdl/ok/Pjetpack.ipdl b/ipc/ipdl/test/ipdl/ok/Pjetpack.ipdl new file mode 100644 index 0000000000..7744f59f8f --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pjetpack.ipdl @@ -0,0 +1,6 @@ +[ChildProc=any] +sync protocol Pjetpack { +child: + async __delete__(); + +}; diff --git a/ipc/ipdl/test/ipdl/ok/PmanageSelf.ipdl b/ipc/ipdl/test/ipdl/ok/PmanageSelf.ipdl new file mode 100644 index 0000000000..992f374a58 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmanageSelf.ipdl @@ -0,0 +1,10 @@ +include protocol PmanageSelf_Toplevel; + +protocol PmanageSelf { + manager PmanageSelf_Toplevel or PmanageSelf; + manages PmanageSelf; + +child: + async PmanageSelf(); + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PmanageSelf_Toplevel.ipdl b/ipc/ipdl/test/ipdl/ok/PmanageSelf_Toplevel.ipdl new file mode 100644 index 0000000000..15be35f838 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmanageSelf_Toplevel.ipdl @@ -0,0 +1,10 @@ +include protocol PmanageSelf; + +[ChildProc=any] +protocol PmanageSelf_Toplevel { + manages PmanageSelf; + +child: + async PmanageSelf(); + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PmanagedProtocol.ipdl b/ipc/ipdl/test/ipdl/ok/PmanagedProtocol.ipdl new file mode 100644 index 0000000000..cab07d06e7 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmanagedProtocol.ipdl @@ -0,0 +1,8 @@ +include protocol PmanagerProtocol; + +protocol PmanagedProtocol { + manager PmanagerProtocol; + +child: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PmanagerProtocol.ipdl b/ipc/ipdl/test/ipdl/ok/PmanagerProtocol.ipdl new file mode 100644 index 0000000000..28483426d3 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmanagerProtocol.ipdl @@ -0,0 +1,12 @@ +include protocol PmanagedProtocol; + +// sanity check of managed/manager protocols + +[ChildProc=any] +protocol PmanagerProtocol { + manages PmanagedProtocol; + +parent: + async PmanagedProtocol(int i); + +}; diff --git a/ipc/ipdl/test/ipdl/ok/Pmaybe_Basic.ipdl b/ipc/ipdl/test/ipdl/ok/Pmaybe_Basic.ipdl new file mode 100644 index 0000000000..52243d5ca3 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pmaybe_Basic.ipdl @@ -0,0 +1,5 @@ +[ChildProc=any] +protocol Pmaybe_Basic { +child: + async Msg(int? maybe); +}; diff --git a/ipc/ipdl/test/ipdl/ok/Pmaybe_OfActors.ipdl b/ipc/ipdl/test/ipdl/ok/Pmaybe_OfActors.ipdl new file mode 100644 index 0000000000..2252c32827 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pmaybe_OfActors.ipdl @@ -0,0 +1,11 @@ +include protocol Pmaybe_OfActorsSub; + +[ChildProc=any] +protocol Pmaybe_OfActors { + manages Pmaybe_OfActorsSub; + +child: + async Msg(Pmaybe_OfActorsSub? p); + + async Pmaybe_OfActorsSub(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/Pmaybe_OfActorsSub.ipdl b/ipc/ipdl/test/ipdl/ok/Pmaybe_OfActorsSub.ipdl new file mode 100644 index 0000000000..6a4759953f --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pmaybe_OfActorsSub.ipdl @@ -0,0 +1,7 @@ +include protocol Pmaybe_OfActors; + +protocol Pmaybe_OfActorsSub { + manager Pmaybe_OfActors; + +child: async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/Pmaybe_Union.ipdl b/ipc/ipdl/test/ipdl/ok/Pmaybe_Union.ipdl new file mode 100644 index 0000000000..5701b08fd9 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pmaybe_Union.ipdl @@ -0,0 +1,11 @@ +union MaybeUnion { + int[]; + int; + double; +}; + +[ChildProc=any] +sync protocol Pmaybe_Union { +parent: + async Msg(MaybeUnion u, MaybeUnion? au) returns (MaybeUnion r); +}; diff --git a/ipc/ipdl/test/ipdl/ok/Pmedia.ipdl b/ipc/ipdl/test/ipdl/ok/Pmedia.ipdl new file mode 100644 index 0000000000..e0f95d2a34 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pmedia.ipdl @@ -0,0 +1,6 @@ +[ChildProc=any] +sync protocol Pmedia { +child: + async __delete__(); + +}; diff --git a/ipc/ipdl/test/ipdl/ok/PmessageCompress.ipdl b/ipc/ipdl/test/ipdl/ok/PmessageCompress.ipdl new file mode 100644 index 0000000000..7e14c888dd --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmessageCompress.ipdl @@ -0,0 +1,6 @@ +[ChildProc=any] +intr protocol PmessageCompress { +child: + [Compress] async foo(); + [Compress=all] async bar(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PmultiManaged.ipdl b/ipc/ipdl/test/ipdl/ok/PmultiManaged.ipdl new file mode 100644 index 0000000000..d8c47fc9e3 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmultiManaged.ipdl @@ -0,0 +1,9 @@ +include protocol PmultiManager1; +include protocol PmultiManager2; + +protocol PmultiManaged { + manager PmultiManager1 or PmultiManager2; + +child: + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PmultiManager1.ipdl b/ipc/ipdl/test/ipdl/ok/PmultiManager1.ipdl new file mode 100644 index 0000000000..ec38412422 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmultiManager1.ipdl @@ -0,0 +1,9 @@ +include protocol PmultiManaged; + +[ChildProc=any] +protocol PmultiManager1 { + manages PmultiManaged; + +child: + async PmultiManaged(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PmultiManager2.ipdl b/ipc/ipdl/test/ipdl/ok/PmultiManager2.ipdl new file mode 100644 index 0000000000..b8295fd057 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmultiManager2.ipdl @@ -0,0 +1,9 @@ +include protocol PmultiManaged; + +[ChildProc=any] +protocol PmultiManager2 { + manages PmultiManaged; + +child: + async PmultiManaged(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PmultipleUsingCxxTypes.ipdl b/ipc/ipdl/test/ipdl/ok/PmultipleUsingCxxTypes.ipdl new file mode 100644 index 0000000000..5d5ae5e9a8 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmultipleUsingCxxTypes.ipdl @@ -0,0 +1,8 @@ +using struct mozilla::void_t from "mozilla/ipc/IPCCore.h"; +using struct mozilla::void_t from "mozilla/ipc/IPCCore.h"; + +[ChildProc=any] +protocol PmultipleUsingCxxTypes { +child: + async Msg(void_t foo); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PmutualRecStructUnion.ipdl b/ipc/ipdl/test/ipdl/ok/PmutualRecStructUnion.ipdl new file mode 100644 index 0000000000..b28df7969b --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmutualRecStructUnion.ipdl @@ -0,0 +1,22 @@ +struct X { + int i; + Y[] y; +}; + +union Y { + double; + X; + Z; +}; + +struct Z { + X x; + Y y; +}; + +[ChildProc=any] +protocol PmutualRecStructUnion { +child: + async Test(X x, Y y, Z z); + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PmutualRecUnion.ipdl b/ipc/ipdl/test/ipdl/ok/PmutualRecUnion.ipdl new file mode 100644 index 0000000000..73c869278f --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmutualRecUnion.ipdl @@ -0,0 +1,22 @@ +union X { + int; + Y[]; + Y?; +}; + +union Y { + X; + Z; +}; + +union Z { + double; + X; +}; + +[ChildProc=any] +protocol PmutualRecUnion { +child: + async Test(X x, Y y, Z z); + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/Pnamespace_Basic.ipdl b/ipc/ipdl/test/ipdl/ok/Pnamespace_Basic.ipdl new file mode 100644 index 0000000000..3b2f2fa27f --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pnamespace_Basic.ipdl @@ -0,0 +1,13 @@ +namespace basic { + +// sanity check of namespaced protocols + +[ChildProc=any] +protocol Pnamespace_Basic { + +child: + async Msg(); + +}; + +} // namespace basic diff --git a/ipc/ipdl/test/ipdl/ok/PnoRedeclCrossMessage.ipdl b/ipc/ipdl/test/ipdl/ok/PnoRedeclCrossMessage.ipdl new file mode 100644 index 0000000000..30c7179e8c --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PnoRedeclCrossMessage.ipdl @@ -0,0 +1,10 @@ +[ChildProc=any] +protocol PnoRedeclCrossMessage { + + // each message has its own scope for param/return names + +child: + async Msg1(int f); + async Msg2(int f); + +}; diff --git a/ipc/ipdl/test/ipdl/ok/Pplugin.ipdl b/ipc/ipdl/test/ipdl/ok/Pplugin.ipdl new file mode 100644 index 0000000000..f7d9352a08 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pplugin.ipdl @@ -0,0 +1,6 @@ +[ChildProc=any] +intr protocol Pplugin { +child: + async __delete__(); + +}; diff --git a/ipc/ipdl/test/ipdl/ok/Prio.ipdl b/ipc/ipdl/test/ipdl/ok/Prio.ipdl new file mode 100644 index 0000000000..fdda57f784 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Prio.ipdl @@ -0,0 +1,12 @@ +[ChildProc=any] +async protocol Prio +{ +child: + [Priority=normal] async NormalPrio(); + [Priority=vsync] async VsyncPrio(); + [Priority=input] async InputPrio(); + [Priority=mediumhigh] async MediumHighPrio(); + [Priority=control] async ControlPrio(); + [ReplyPriority=control] async ControlPrioReturns() returns (bool aValue); + [Priority=normal, ReplyPriority=control] async NormalControlPrioReturns() returns (bool aValue); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PselfRecUnion.ipdl b/ipc/ipdl/test/ipdl/ok/PselfRecUnion.ipdl new file mode 100644 index 0000000000..9d5e3de487 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PselfRecUnion.ipdl @@ -0,0 +1,12 @@ +union R { + int; + double; + R; +}; + +[ChildProc=any] +protocol PselfRecUnion { +child: + async Test(R r); + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/ok/Pshmem.ipdl b/ipc/ipdl/test/ipdl/ok/Pshmem.ipdl new file mode 100644 index 0000000000..a46e777d8c --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pshmem.ipdl @@ -0,0 +1,14 @@ +union Foo { + int; + Shmem; +}; + +[ChildProc=any] +intr protocol Pshmem { +parent: + async Msg(Shmem s, Foo f); + sync SyncMsg(Shmem s, Foo f) + returns (Shmem t, Foo g); + [LegacyIntr] intr InterruptMsg(Shmem s, Foo f) + returns (Shmem t, Foo g); +}; diff --git a/ipc/ipdl/test/ipdl/ok/PsyncProtocol.ipdl b/ipc/ipdl/test/ipdl/ok/PsyncProtocol.ipdl new file mode 100644 index 0000000000..f73be554e4 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PsyncProtocol.ipdl @@ -0,0 +1,12 @@ +[ChildProc=any] +sync protocol PsyncProtocol { + + // sanity check of sync protocols + +child: + async AsyncMsg(); + +parent: + sync SyncMsg() returns (int i); + +}; diff --git a/ipc/ipdl/test/ipdl/ok/PthreeDirections.ipdl b/ipc/ipdl/test/ipdl/ok/PthreeDirections.ipdl new file mode 100644 index 0000000000..6474ca5d0d --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PthreeDirections.ipdl @@ -0,0 +1,14 @@ +[ChildProc=any] +protocol PthreeDirections { + + // sanity check that the three direction specifiers are being accepted +child: + async ChildMsg(); + +parent: + async ParentMsg(); + +both: + async BothMsg(); + +}; diff --git a/ipc/ipdl/test/ipdl/ok/Punion_Basic.ipdl b/ipc/ipdl/test/ipdl/ok/Punion_Basic.ipdl new file mode 100644 index 0000000000..a049d52e75 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Punion_Basic.ipdl @@ -0,0 +1,12 @@ +union Basic { + int; + double; +}; + +[ChildProc=any] +sync protocol Punion_Basic { + +parent: + sync Msg(Basic p) returns (Basic r); + +}; diff --git a/ipc/ipdl/test/ipdl/ok/Punion_Comparable.ipdl b/ipc/ipdl/test/ipdl/ok/Punion_Comparable.ipdl new file mode 100644 index 0000000000..05b26f32aa --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Punion_Comparable.ipdl @@ -0,0 +1,12 @@ +[Comparable] union Basic { + int; + double; +}; + +[ChildProc=any] +sync protocol Punion_Comparable { + +parent: + sync Msg(Basic p) returns (Basic r); + +}; diff --git a/ipc/ipdl/test/ipdl/ok/Punion_Namespaced.ipdl b/ipc/ipdl/test/ipdl/ok/Punion_Namespaced.ipdl new file mode 100644 index 0000000000..4108dfd4df --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Punion_Namespaced.ipdl @@ -0,0 +1,19 @@ +namespace kitties { + +union Socks { + int; + double; +}; + +} // namespace kitties + + +namespace puppies { + +[ChildProc=any] +protocol Punion_Namespaced { +child: + async Msg(Socks s); +}; + +} // namespace puppies diff --git a/ipc/ipdl/test/ipdl/ok/header.ipdlh b/ipc/ipdl/test/ipdl/ok/header.ipdlh new file mode 100644 index 0000000000..fc3f8c8279 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/header.ipdlh @@ -0,0 +1,15 @@ +using foo from "foo.h"; +using bar::baz from "foo.h"; + +struct Outer { }; + +namespace a { struct Inner1 { }; } + +namespace b { struct Inner2 { }; } + +namespace c { +union X { + int32_t; + float; +}; +} diff --git a/ipc/ipdl/test/ipdl/runtests.py b/ipc/ipdl/test/ipdl/runtests.py new file mode 100644 index 0000000000..4296eab65c --- /dev/null +++ b/ipc/ipdl/test/ipdl/runtests.py @@ -0,0 +1,119 @@ +import os +import unittest + +from IPDLCompile import IPDLCompile + + +class IPDLTestCase(unittest.TestCase): + def __init__(self, ipdlargv, filename): + unittest.TestCase.__init__(self, "test") + self.filename = filename + self.compile = IPDLCompile(filename, ipdlargv) + + def test(self): + self.compile.run() + self.assertFalse(self.compile.exception(), self.mkFailMsg()) + self.checkPassed() + + def mkCustomMsg(self, msg): + return """ +### Command: %s +### %s +### stderr: +%s""" % ( + " ".join(self.compile.argv), + msg, + self.compile.stderr, + ) + + def mkFailMsg(self): + return """ +### Command: %s +### stderr: +%s""" % ( + " ".join(self.compile.argv), + self.compile.stderr, + ) + + def shortDescription(self): + return '%s test of "%s"' % (self.__class__.__name__, self.filename) + + +class OkTestCase(IPDLTestCase): + """An invocation of the IPDL compiler on a valid specification. + The IPDL compiler should not produce errors or exceptions.""" + + def __init__(self, ipdlargv, filename): + IPDLTestCase.__init__(self, ipdlargv, filename) + + def checkPassed(self): + self.assertTrue(self.compile.ok(), self.mkFailMsg()) + + +class ErrorTestCase(IPDLTestCase): + """An invocation of the IPDL compiler on an *invalid* specification. + The IPDL compiler *should* produce errors but not exceptions.""" + + def __init__(self, ipdlargv, filename): + IPDLTestCase.__init__(self, ipdlargv, filename) + + # Look for expected errors in the input file. + f = open(filename, "r") + self.expectedErrorMessage = [] + for l in f: + if l.startswith("//error:"): + self.expectedErrorMessage.append(l[2:-1]) + f.close() + + def checkPassed(self): + self.assertNotEqual( + self.expectedErrorMessage, + [], + self.mkCustomMsg( + "Error test should contain at least " + + "one line starting with //error: " + + "that indicates the expected failure." + ), + ) + + for e in self.expectedErrorMessage: + self.assertTrue( + self.compile.error(e), + self.mkCustomMsg('Did not see expected error "' + e + '"'), + ) + + +if __name__ == "__main__": + import sys + + okdir = sys.argv[1] + assert os.path.isdir(okdir) + errordir = sys.argv[2] + assert os.path.isdir(errordir) + + ipdlargv = [] + oksuite = unittest.TestSuite() + errorsuite = unittest.TestSuite() + + oktests, errortests = False, False + for arg in sys.argv[3:]: + if errortests: + # The extra subdirectory is used for non-failing files we want + # to include from failing files. + errorIncludes = ["-I", os.path.join(errordir, "extra"), "-I", errordir] + errorsuite.addTest(ErrorTestCase(ipdlargv + errorIncludes, arg)) + elif oktests: + if "ERRORTESTS" == arg: + errortests = True + continue + oksuite.addTest(OkTestCase(ipdlargv + ["-I", okdir], arg)) + else: + if "OKTESTS" == arg: + oktests = True + continue + ipdlargv.append(arg) + + test_result = (unittest.TextTestRunner()).run( + unittest.TestSuite([oksuite, errorsuite]) + ) + sys.exit(not test_result.wasSuccessful()) diff --git a/ipc/ipdl/test/ipdl/sync-messages.ini b/ipc/ipdl/test/ipdl/sync-messages.ini new file mode 100644 index 0000000000..989964f0dd --- /dev/null +++ b/ipc/ipdl/test/ipdl/sync-messages.ini @@ -0,0 +1,50 @@ +[Pactorreturn::Msg] +description = test only +[Parray_Union::Msg] +description = test only +[Punion_Basic::Msg] +description = test only +[PStruct::test] +description = test only +[PStructComparable::test] +description = test only +[Punion_Comparable::Msg] +description = test only +[PintrProtocol::SyncMsg] +description = test only +[PintrProtocol::InterruptMsg] +description = test only +[Pshmem::SyncMsg] +description = test only +[Pshmem::InterruptMsg] +description = test only +[Pbytebuf::SyncMsg] +description = test only +[Pbytebuf::InterruptMsg] +description = test only +[PsyncProtocol::SyncMsg] +description = test only +[PDeleteSub::__delete__] +description = test only +[PintrMessageCompress::foo] +description = test only +[PintrMessageCompress::bar] +description = test only +[PsyncMessageCompress::foo] +description = test only +[PsyncParentToChild::Msg] +description = test only +[PtooWeakIntrSync::Msg] +description = test only +[PtooWeakSyncAsync::Msg] +description = test only +[PundeclReturnType::Msg] +description = test only +[PasyncMessageListed::Msg] +description = test only +[PNested::InsideSync] +description = test only +[PNested::InsideCpowSync] +description = test only +[PMyManager::SomeMsg] +description = test and docs only |