diff options
Diffstat (limited to 'ipc/ipdl/test/ipdl')
179 files changed, 1910 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..831d4d1159 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/AsyncCtorReturns.ipdl @@ -0,0 +1,10 @@ +//error: asynchronous ctor/dtor message `AsyncCtorReturnsManageeConstructor' declares return values + +include protocol AsyncCtorReturnsManagee; + +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..f38e2bd0ea --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/AsyncCtorReturnsManagee.ipdl @@ -0,0 +1,10 @@ +//error: asynchronous ctor/dtor message `AsyncCtorReturnsManageeConstructor' declares return values + +include protocol AsyncCtorReturns; + +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..d2fa481e7f --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/AsyncInsideSync.ipdl @@ -0,0 +1,9 @@ +// 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 + +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..e58d5d5533 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/ExtendedAttrInvalidNestedValue.ipdl @@ -0,0 +1,6 @@ +//error: invalid value for attribute `Nested', expected one of: not, inside_sync, inside_cpow + +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..7625a85e13 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/ExtendedAttrInvalidPriorityValue.ipdl @@ -0,0 +1,6 @@ +//error: invalid value for attribute `Priority', expected one of: normal, input, vsync, mediumhigh, control + +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..4335dc8dc7 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/ForgottenManager.ipdl @@ -0,0 +1,11 @@ +//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. + +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..4338555952 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/InsideCpowToChild.ipdl @@ -0,0 +1,9 @@ +// 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 + +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..7bf413ef61 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/IntrAsyncManager.ipdl @@ -0,0 +1,9 @@ +//error: protocol `IntrAsyncManagee' requires more powerful send semantics than its manager `IntrAsyncManager' provides + +include protocol IntrAsyncManagee; + +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..80a82ab6d8 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/IntrSyncManager.ipdl @@ -0,0 +1,9 @@ +//error: protocol `IntrSyncManagee' requires more powerful send semantics than its manager `IntrSyncManager' provides + +include protocol IntrSyncManagee; + +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..babe2f0658 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/ManageeForgot.ipdl @@ -0,0 +1,11 @@ +//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. + +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..00c08ebe87 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/ManagerForgot.ipdl @@ -0,0 +1,11 @@ +//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. + +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..7761f73646 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/Nullable.ipdl @@ -0,0 +1,6 @@ +//error: `nullable' qualifier for type `int' is unsupported + +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..8248b7cb7c --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/Nullable2.ipdl @@ -0,0 +1,10 @@ +//error: `nullable' qualifier for type `int' is unsupported + +union Union { + nullable int; +}; + +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..4afdcb4c8e --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PBadArrayBase.ipdl @@ -0,0 +1,7 @@ +//error: argument typename `X' of message `Test' has not been declared + +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..eca24e00d4 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PBadNestedManagee.ipdl @@ -0,0 +1,9 @@ +//error: protocol `PBadNestedManagee' requires more powerful send semantics than its manager `PBadNestedManager' provides + +include protocol PBadNestedManager; + +[NestedUpTo=inside_sync] 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..9fc744f13a --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PBadNestedManager.ipdl @@ -0,0 +1,9 @@ +//error: protocol `PBadNestedManagee' requires more powerful send semantics than its manager `PBadNestedManager' provides + +include protocol PBadNestedManagee; + +[NestedUpTo=not] 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..75aebd4670 --- /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] +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..b93b20742d --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PBadUniquePtrBase.ipdl @@ -0,0 +1,7 @@ +//error: argument typename `UndeclaredType' of message `Test' has not been declared + +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..5ceaaad9ac --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PCompressInvalid.ipdl @@ -0,0 +1,8 @@ +//error: invalid value for attribute `Compress', expected one of: None, all + +include protocol compressCtor; + +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..e08ff1d063 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PDouble.ipdl @@ -0,0 +1,11 @@ +//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; + +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..9720acdd41 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PExtendedAttrInvalidValue.ipdl @@ -0,0 +1,6 @@ +//error: invalid value for attribute `NestedUpTo', expected one of: not, inside_sync, inside_cpow + +[NestedUpTo=invalid] 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..e33411a877 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PExtendedAttrRepeated.ipdl @@ -0,0 +1,6 @@ +//error: Repeated extended attribute `RefCounted' + +[RefCounted, RefCounted] 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..de1d81c0eb --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PExtendedAttrUnexpectedValue.ipdl @@ -0,0 +1,6 @@ +//error: unexpected value for valueless attribute `ManualDealloc' + +[ManualDealloc=invalid] 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..414763efdd --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PExtendedAttrUnknownAttribute.ipdl @@ -0,0 +1,6 @@ +//error: unknown attribute `InvalidAttr' + +[InvalidAttr] 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..4e88a82050 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PInconsistentMoveOnly.ipdl @@ -0,0 +1,13 @@ +//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"; + +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..948cdc1118 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PIntrNested.ipdl @@ -0,0 +1,6 @@ +//error: intr message `Msg' cannot specify [Nested] + +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..4267bf7a84 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PIntrNestedProtocol.ipdl @@ -0,0 +1,6 @@ +//error: intr protocol `PIntrNestedProtocol' cannot specify [NestedUpTo] + +[NestedUpTo=inside_sync] 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..5bc539983a --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PIntrPriority.ipdl @@ -0,0 +1,6 @@ +//error: intr message `Msg' cannot specify [Priority] + +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..282a007add --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PLazySendInvalid.ipdl @@ -0,0 +1,6 @@ +//error: unexpected value for valueless attribute `LazySend' + +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..308b734fe5 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PLazySendSync.ipdl @@ -0,0 +1,6 @@ +//error: non-async message `Message' cannot specify [LazySend] + +sync protocol PLazySendSync { +child: + [LazySend] sync Message() returns (bool ok); +}; diff --git a/ipc/ipdl/test/ipdl/error/PNoTaintWithoutTainted.ipdl b/ipc/ipdl/test/ipdl/error/PNoTaintWithoutTainted.ipdl new file mode 100644 index 0000000000..cfdde1f02c --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PNoTaintWithoutTainted.ipdl @@ -0,0 +1,6 @@ +//error: argument typename `int' of message `foo' has a NoTaint attribute, but the message lacks the Tainted attribute + +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..97822b65bd --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PToplevelManualDealloc.ipdl @@ -0,0 +1,6 @@ +//error: Toplevel protocols cannot be [ManualDealloc] + +[ManualDealloc] 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..83c9459ec6 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PUniquePtrRecursive.ipdl @@ -0,0 +1,5 @@ +//error: bad syntax near `UniquePtr' + +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..c9a54b22b2 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PUniquePtrSelfRecStruct.ipdl @@ -0,0 +1,9 @@ +//error: struct `X' is only partially defined + +struct X { + UniquePtr<X> x; +}; + +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..5dba38263f --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PUniquePtrSelfRecUnion.ipdl @@ -0,0 +1,7 @@ +//error: union `X' is only partially defined + +union X { UniquePtr<X>; }; + +protocol PUniquePtrSelfRecUnion { +child: async Msg(UniquePtr<X> aa); +}; diff --git a/ipc/ipdl/test/ipdl/error/PasyncMessageListed.ipdl b/ipc/ipdl/test/ipdl/error/PasyncMessageListed.ipdl new file mode 100644 index 0000000000..6a3cdad0ee --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/PasyncMessageListed.ipdl @@ -0,0 +1,6 @@ +//error: IPC message PasyncMessageListed::Msg is async, can be delisted + +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..0d1cd51217 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/ReplyPrioWithoutReturns.ipdl @@ -0,0 +1,6 @@ +//error: non-returns message `NormalPrio' cannot specify [ReplyPriority] +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..166881ae1e --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/SyncAsyncManagee.ipdl @@ -0,0 +1,9 @@ +//error: protocol `SyncAsyncManagee' requires more powerful send semantics than its manager `SyncAsyncManager' provides + +include protocol SyncAsyncManager; + +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..9dbc7a6318 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/SyncAsyncManager.ipdl @@ -0,0 +1,9 @@ +//error: protocol `SyncAsyncManagee' requires more powerful send semantics than its manager `SyncAsyncManager' provides + +include protocol SyncAsyncManagee; + +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..cbf833b620 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/SyncPrio.ipdl @@ -0,0 +1,6 @@ +//error: non-async message `NormalPrio' cannot specify [ReplyPriority] +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..f5027e2299 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/array_Recursive.ipdl @@ -0,0 +1,5 @@ +//error: bad syntax near `[' + +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..3f82bef9b2 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/badProtocolInclude.ipdl @@ -0,0 +1,9 @@ +//error: can't locate include file `IDONTEXIST.ipdl' + +include protocol IDONTEXIST; + +// error: nonexistent protocol ^^^ + +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..9db05d495d --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/compressCtor.ipdl @@ -0,0 +1,11 @@ +//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; + +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..b223dab783 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/conflictProtocolMsg.ipdl @@ -0,0 +1,9 @@ +//error: ctor for protocol `conflictProtocolMsg', which is not managed by protocol `conflictProtocolMsg' + +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..f2eb060641 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/cyclecheck_Parent.ipdl @@ -0,0 +1,12 @@ +//error: cycle(s) detected in manager/manages hierarchy: `cyclecheck_Parent -> cyclecheck_Child -> cyclecheck_Grandchild -> cyclecheck_Parent' + +include protocol cyclecheck_Child; + +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..51833489be --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/dtorReserved.ipdl @@ -0,0 +1,10 @@ +//error: lexically invalid characters `~SomeMsg(); + +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/inconsistentRC.ipdl b/ipc/ipdl/test/ipdl/error/inconsistentRC.ipdl new file mode 100644 index 0000000000..ee1375c312 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/inconsistentRC.ipdl @@ -0,0 +1,9 @@ +//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"; + +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..49bd5d4721 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/intrMessageCompress.ipdl @@ -0,0 +1,9 @@ +//error: message `foo' in protocol `intrMessageCompress' requests compression but is not async +//error: message `bar' in protocol `intrMessageCompress' requests compression but is not async + +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..b039924199 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/maybe_Recursive.ipdl @@ -0,0 +1,5 @@ +//error: bad syntax near `?' + +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..a13cdc3647 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/maybe_SelfRecStruct.ipdl @@ -0,0 +1,9 @@ +//error: struct `X' is only partially defined + +struct X { + X? x; +}; + +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..3cd5cde22a --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/maybe_SelfRecUnion.ipdl @@ -0,0 +1,7 @@ +//error: union `X' is only partially defined + +union X { X?; }; + +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..199bb089c3 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/messageNoDirection.ipdl @@ -0,0 +1,5 @@ +//error: missing message direction + +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..ff96fe91a3 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/multimanDupMgrsMgr.ipdl @@ -0,0 +1,11 @@ +//error: manager `multimanDupMgrsMgr' appears multiple times + +include protocol multimanDupMgrs; + +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..9df16543bf --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/mutualRecStruct.ipdl @@ -0,0 +1,24 @@ +//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; +}; + +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..cd193f9f29 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/mutualRecStructUnion.ipdl @@ -0,0 +1,24 @@ +//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; +}; + +protocol mutualRecStructUnion { +child: + async Test(X x, Y y, Z z); + async __delete__(); +}; diff --git a/ipc/ipdl/test/ipdl/error/noEmptyToplevel.ipdl b/ipc/ipdl/test/ipdl/error/noEmptyToplevel.ipdl new file mode 100644 index 0000000000..bc36cead42 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/noEmptyToplevel.ipdl @@ -0,0 +1,7 @@ +//error: top-level protocol `noEmptyToplevel' cannot be empty + +protocol noEmptyToplevel { + + // it's an error for top-level protocols to be empty + +}; diff --git a/ipc/ipdl/test/ipdl/error/noProtocolInHeader.ipdlh b/ipc/ipdl/test/ipdl/error/noProtocolInHeader.ipdlh new file mode 100644 index 0000000000..8351adf4cc --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/noProtocolInHeader.ipdlh @@ -0,0 +1,6 @@ +//error: can't define a protocol in a header. Do it in a protocol spec instead. + +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..d13659a8e7 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/oldIncludeSyntax.ipdl @@ -0,0 +1,7 @@ +//error: bad syntax near `"Foo.ipdl"' + +include protocol "Foo.ipdl"; + +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..1247aa41cf --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/redeclMessage.ipdl @@ -0,0 +1,12 @@ +//error: message name `Msg' already declared as `MessageType' +//error: redeclaration of symbol `Msg', first declared at + +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..ccdcbbe0d1 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/redeclParamReturn.ipdl @@ -0,0 +1,9 @@ +//error: redeclaration of symbol `f', first declared at + +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..7f4326ccf5 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/shmem.ipdl @@ -0,0 +1,8 @@ +//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 + +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..03a5557877 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/structRedecl.ipdl @@ -0,0 +1,10 @@ +//error: redeclaration of symbol `a', first declared at + +struct Redecl { + int a; + double a; +}; + +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..ac92edee23 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/structUnknownField.ipdl @@ -0,0 +1,9 @@ +//error: field `i' of struct `S' has unknown type `Foobers' + +struct S { + Foobers i; +}; + +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..376f2ae2dd --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/syncMessageCompress.ipdl @@ -0,0 +1,6 @@ +//error: message `foo' in protocol `syncMessageCompress' requests compression but is not async + +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..bd6c8bc5b1 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/syncParentToChild.ipdl @@ -0,0 +1,8 @@ +//error: sync parent-to-child messages are verboten (here, message `Msg' in protocol `syncParentToChild') + +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..220e4c3c28 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/tooWeakIntrAsync.ipdl @@ -0,0 +1,9 @@ +//error: message `Msg' requires more powerful send semantics than its protocol `tooWeakIntrAsync' provides + +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..4c3b61d0d9 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/tooWeakIntrSync.ipdl @@ -0,0 +1,8 @@ +//error: message `Msg' requires more powerful send semantics than its protocol `tooWeakIntrSync' provides + +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..49e4d3b75b --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/tooWeakSyncAsync.ipdl @@ -0,0 +1,9 @@ +//error: message `Msg' requires more powerful send semantics than its protocol `tooWeakSyncAsync' provides + +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..7e2a51a61a --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/twoprotocols.ipdl @@ -0,0 +1,11 @@ +// it's an error to define two protocols in the same file + +//error: only one protocol definition per file + +protocol p1 { +child: async Msg(); +}; + +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..3f93e747e1 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/undeclParamType.ipdl @@ -0,0 +1,7 @@ +//error: argument typename `FARGLEGARGLE' of message `Msg' has not been declared + +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..cddf57267f --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/undeclProtocol.ipdl @@ -0,0 +1,8 @@ +//error: protocol `undeclared', managed by `undeclProtocol', has not been declared + +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..2f353a1957 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/undeclReturnType.ipdl @@ -0,0 +1,7 @@ +//error: argument typename `FARGLEGARGLE' of message `Msg' has not been declared + +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..5ede1d8299 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/undefMutualRecStruct.ipdl @@ -0,0 +1,11 @@ +//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; }; + +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..0e88c126e0 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/undefMutualRecStructUnion.ipdl @@ -0,0 +1,11 @@ +//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; }; + +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..3fc99bbb95 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/undefMutualRecUnion.ipdl @@ -0,0 +1,11 @@ +//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; }; + +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..15fc45abcd --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/undefSelfRecStruct.ipdl @@ -0,0 +1,7 @@ +//error: struct `X' is only partially defined + +struct X { X x; }; + +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..951f916c57 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/undefSelfRecUnion.ipdl @@ -0,0 +1,7 @@ +//error: union `X' is only partially defined + +union X { X; }; + +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..4790232685 --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/unknownIntrMessage.ipdl @@ -0,0 +1,6 @@ +//error: Unknown sync IPC message unknownIntrMessage::Msg + +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..be2cfad0cc --- /dev/null +++ b/ipc/ipdl/test/ipdl/error/unknownSyncMessage.ipdl @@ -0,0 +1,6 @@ +//error: Unknown sync IPC message unknownSyncMessage::Msg + +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..89c2a7c647 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PAsyncReturn.ipdl @@ -0,0 +1,8 @@ +// Async messages are not allowed to return values. + +//error: asynchronous message `Msg' declares return values + +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..f2f85fd7fa --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PDelete.ipdl @@ -0,0 +1,8 @@ +include protocol PDeleteSub; + +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..25f58f3f63 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PEndpointDecl.ipdl @@ -0,0 +1,18 @@ + +// Basic test that Endpoint types are declared for protocols, within +// that protocol. + +struct Whatever { + Endpoint<PEndpointDeclParent> par; + Endpoint<PEndpointDeclChild> chi; +}; + +namespace mozilla { + +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..0c776b359c --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PEndpointUse.ipdl @@ -0,0 +1,9 @@ +include protocol PEndpointDecl; + +// Basic test that Endpoint types are declared for included protocols. + +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..4b1c9085b7 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PExtendedAttrMultipleAttributes.ipdl @@ -0,0 +1,4 @@ +[NestedUpTo=inside_sync, NeedsOtherPid] 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..1bc56a3c6f --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PLazySend.ipdl @@ -0,0 +1,6 @@ +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..4c95b7880c --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PManagedEndpointManager.ipdl @@ -0,0 +1,14 @@ +include protocol PManagedEndpointDecl; + +namespace mozilla { + +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..224c7a5e46 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PManualDealloc_manager.ipdl @@ -0,0 +1,7 @@ +include protocol PManualDealloc; + +// [ManualDealloc] types must have a manager, as all toplevel protocols are +// refcounted. +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..0733117be9 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PMessageTainted.ipdl @@ -0,0 +1,4 @@ +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..1d03e97e73 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PMessageTaintedWithPassback.ipdl @@ -0,0 +1,4 @@ +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..5e82f53cca --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PMyManager.ipdl @@ -0,0 +1,30 @@ +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; +}; + +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..4368f2a1ab --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PNested.ipdl @@ -0,0 +1,7 @@ +[NestedUpTo=inside_cpow] 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..51601d59f1 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PNullable.ipdl @@ -0,0 +1,21 @@ +[RefCounted] using class nsIURI from "nsIURI.h"; + +union Union { + nullable PNullable; + nullable PNullable[]; + nullable PNullable?; + nullable nsIURI; + nullable nsIURI[]; + nullable nsIURI?; +}; + +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..0858734c74 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PSideImpl.ipdl @@ -0,0 +1,5 @@ +[ParentImpl=virtual, ChildImpl="mozilla::FooBarImpl"] +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..c670a83b0b --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PStruct.ipdl @@ -0,0 +1,10 @@ +struct S { + int i; + double d; +}; + +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..ca1f654bb5 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PStructComparable.ipdl @@ -0,0 +1,10 @@ +[Comparable] struct S { + int i; + double d; +}; + +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..00f9dead47 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PSyncSyncManager.ipdl @@ -0,0 +1,11 @@ +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] 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..caffd0dbbc --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PUniquePtrBasic.ipdl @@ -0,0 +1,4 @@ +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..ce67f23c68 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PUniquePtrOfActors.ipdl @@ -0,0 +1,10 @@ +include protocol PUniquePtrOfActorsSub; + +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..4a0b9e7299 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PUniquePtrRecUnion.ipdl @@ -0,0 +1,21 @@ +union X { + int; + Y[]; + UniquePtr<Y>; +}; + +union Y { + X; + Z; +}; + +union Z { + double; + X; +}; + +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..d756339980 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PUniquePtrUnion.ipdl @@ -0,0 +1,10 @@ +union UniquePtrUnion { + int[]; + int; + double; +}; + +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..042e762475 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PVirtualSendImpl.ipdl @@ -0,0 +1,5 @@ +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..0cba299cf5 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pactorparam.ipdl @@ -0,0 +1,5 @@ +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..99d0d36225 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pactorreturn.ipdl @@ -0,0 +1,6 @@ +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..811c01f324 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Parray_Basic.ipdl @@ -0,0 +1,4 @@ +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..b084c2c464 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Parray_OfActors.ipdl @@ -0,0 +1,10 @@ +include protocol Parray_OfActorsSub; + +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..33c94e7ae5 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Parray_Union.ipdl @@ -0,0 +1,10 @@ +union Union { + int[]; + int; + double; +}; + +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..ac4df3a258 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PbasicUsing.ipdl @@ -0,0 +1,50 @@ +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; +}; + +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..4085dc6d95 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pbuiltins.ipdl @@ -0,0 +1,21 @@ +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..016702053e --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pbytebuf.ipdl @@ -0,0 +1,13 @@ +union Foo { + int; + ByteBuf; +}; + +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..61b511bec6 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pempty.ipdl @@ -0,0 +1,3 @@ +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..a067bf71da --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PemptyStruct.ipdl @@ -0,0 +1,3 @@ +struct empty { }; + +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..7ae285042e --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PheaderProto.ipdl @@ -0,0 +1,10 @@ +include header; + +namespace c { + +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..a931a7eb9a --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PintrProtocol.ipdl @@ -0,0 +1,13 @@ +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..190732485d --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pjetpack.ipdl @@ -0,0 +1,5 @@ +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..70b5fe8a9b --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmanageSelf_Toplevel.ipdl @@ -0,0 +1,9 @@ +include protocol PmanageSelf; + +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..40d1de31b0 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmanagerProtocol.ipdl @@ -0,0 +1,11 @@ +include protocol PmanagedProtocol; + +// sanity check of managed/manager protocols + +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..a0bbccd874 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pmaybe_Basic.ipdl @@ -0,0 +1,4 @@ +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..430faa9ae7 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pmaybe_OfActors.ipdl @@ -0,0 +1,10 @@ +include protocol Pmaybe_OfActorsSub; + +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..67f24cb794 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pmaybe_Union.ipdl @@ -0,0 +1,10 @@ +union MaybeUnion { + int[]; + int; + double; +}; + +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..0a8076a433 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pmedia.ipdl @@ -0,0 +1,5 @@ +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..53dfe9098f --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmessageCompress.ipdl @@ -0,0 +1,5 @@ +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..b0654a8c4f --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmultiManager1.ipdl @@ -0,0 +1,8 @@ +include protocol PmultiManaged; + +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..c03f05a173 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmultiManager2.ipdl @@ -0,0 +1,8 @@ +include protocol PmultiManaged; + +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..fa63b5b4b0 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmultipleUsingCxxTypes.ipdl @@ -0,0 +1,7 @@ +using struct mozilla::void_t from "mozilla/ipc/IPCCore.h"; +using struct mozilla::void_t from "mozilla/ipc/IPCCore.h"; + +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..0fe5501a09 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmutualRecStructUnion.ipdl @@ -0,0 +1,21 @@ +struct X { + int i; + Y[] y; +}; + +union Y { + double; + X; + Z; +}; + +struct Z { + X x; + Y y; +}; + +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..304847e003 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PmutualRecUnion.ipdl @@ -0,0 +1,21 @@ +union X { + int; + Y[]; + Y?; +}; + +union Y { + X; + Z; +}; + +union Z { + double; + X; +}; + +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..4f996d9744 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pnamespace_Basic.ipdl @@ -0,0 +1,12 @@ +namespace basic { + +// sanity check of namespaced protocols + +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..d353a8c07c --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PnoRedeclCrossMessage.ipdl @@ -0,0 +1,9 @@ +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..29c001e67b --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pplugin.ipdl @@ -0,0 +1,5 @@ +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..515b3fd68d --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Prio.ipdl @@ -0,0 +1,11 @@ +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..7d76c34542 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PselfRecUnion.ipdl @@ -0,0 +1,11 @@ +union R { + int; + double; + R; +}; + +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..0894e95652 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Pshmem.ipdl @@ -0,0 +1,13 @@ +union Foo { + int; + Shmem; +}; + +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..377671b2d6 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PsyncProtocol.ipdl @@ -0,0 +1,11 @@ +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..81c8cf6041 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/PthreeDirections.ipdl @@ -0,0 +1,13 @@ +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..697b86e088 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Punion_Basic.ipdl @@ -0,0 +1,11 @@ +union Basic { + int; + double; +}; + +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..c69ac07cc2 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Punion_Comparable.ipdl @@ -0,0 +1,11 @@ +[Comparable] union Basic { + int; + double; +}; + +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..9453a561c8 --- /dev/null +++ b/ipc/ipdl/test/ipdl/ok/Punion_Namespaced.ipdl @@ -0,0 +1,18 @@ +namespace kitties { + +union Socks { + int; + double; +}; + +} // namespace kitties + + +namespace puppies { + +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 |