tenfourfox/ipc/ipdl/test/cxx
Cameron Kaiser c9b2922b70 hello FPR
2017-04-19 00:56:45 -07:00
..
app hello FPR 2017-04-19 00:56:45 -07:00
genIPDLUnitTests.py hello FPR 2017-04-19 00:56:45 -07:00
IPDLUnitTestProcessChild.cpp hello FPR 2017-04-19 00:56:45 -07:00
IPDLUnitTestProcessChild.h hello FPR 2017-04-19 00:56:45 -07:00
IPDLUnitTests.h hello FPR 2017-04-19 00:56:45 -07:00
IPDLUnitTests.template.cpp hello FPR 2017-04-19 00:56:45 -07:00
IPDLUnitTestSubprocess.cpp hello FPR 2017-04-19 00:56:45 -07:00
IPDLUnitTestSubprocess.h hello FPR 2017-04-19 00:56:45 -07:00
IPDLUnitTestTypes.h hello FPR 2017-04-19 00:56:45 -07:00
IPDLUnitTestUtils.h hello FPR 2017-04-19 00:56:45 -07:00
Makefile.in hello FPR 2017-04-19 00:56:45 -07:00
moz.build hello FPR 2017-04-19 00:56:45 -07:00
PTestActorPunning.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestActorPunningPunned.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestActorPunningSub.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestBadActor.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestBadActorSub.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestBridgeMain.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestBridgeMainSub.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestBridgeSub.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestCancel.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestCrashCleanup.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestDataStructures.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestDataStructuresCommon.ipdlh hello FPR 2017-04-19 00:56:45 -07:00
PTestDataStructuresSub.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestDesc.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestDescSub.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestDescSubsub.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestFailedCtor.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestFailedCtorSub.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestFailedCtorSubsub.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestHandle.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestHangs.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestHighestPrio.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestIndirectProtocolParam.ipdlh hello FPR 2017-04-19 00:56:45 -07:00
PTestIndirectProtocolParamFirst.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestIndirectProtocolParamManage.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestIndirectProtocolParamSecond.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestInterruptErrorCleanup.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestInterruptRaces.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestInterruptShutdownRace.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestJSON.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestLatency.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestManyChildAllocs.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestManyChildAllocsSub.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestMultiMgrs.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestMultiMgrsBottom.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestMultiMgrsLeft.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestMultiMgrsRight.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestNestedLoops.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestOpens.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestOpensOpened.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestRaceDeadlock.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestRaceDeferral.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestRacyInterruptReplies.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestRacyReentry.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestRacyUndefer.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestRPC.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestSanity.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestSelfManage.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestSelfManageRoot.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestShmem.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestShutdown.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestShutdownSub.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestShutdownSubsub.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestStackHooks.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestSyncError.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestSyncHang.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestSyncWakeup.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestSysVShmem.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestUrgency.ipdl hello FPR 2017-04-19 00:56:45 -07:00
PTestUrgentHangs.ipdl hello FPR 2017-04-19 00:56:45 -07:00
README.txt hello FPR 2017-04-19 00:56:45 -07:00
TestActorPunning.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestActorPunning.h hello FPR 2017-04-19 00:56:45 -07:00
TestBadActor.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestBadActor.h hello FPR 2017-04-19 00:56:45 -07:00
TestBridgeMain.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestBridgeMain.h hello FPR 2017-04-19 00:56:45 -07:00
TestCancel.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestCancel.h hello FPR 2017-04-19 00:56:45 -07:00
TestCrashCleanup.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestCrashCleanup.h hello FPR 2017-04-19 00:56:45 -07:00
TestDataStructures.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestDataStructures.h hello FPR 2017-04-19 00:56:45 -07:00
TestDesc.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestDesc.h hello FPR 2017-04-19 00:56:45 -07:00
TestFailedCtor.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestFailedCtor.h hello FPR 2017-04-19 00:56:45 -07:00
TestHangs.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestHangs.h hello FPR 2017-04-19 00:56:45 -07:00
TestHighestPrio.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestHighestPrio.h hello FPR 2017-04-19 00:56:45 -07:00
TestInterruptErrorCleanup.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestInterruptErrorCleanup.h hello FPR 2017-04-19 00:56:45 -07:00
TestInterruptRaces.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestInterruptRaces.h hello FPR 2017-04-19 00:56:45 -07:00
TestInterruptShutdownRace.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestInterruptShutdownRace.h hello FPR 2017-04-19 00:56:45 -07:00
TestJSON.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestJSON.h hello FPR 2017-04-19 00:56:45 -07:00
TestLatency.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestLatency.h hello FPR 2017-04-19 00:56:45 -07:00
TestManyChildAllocs.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestManyChildAllocs.h hello FPR 2017-04-19 00:56:45 -07:00
TestMultiMgrs.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestMultiMgrs.h hello FPR 2017-04-19 00:56:45 -07:00
TestNestedLoops.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestNestedLoops.h hello FPR 2017-04-19 00:56:45 -07:00
TestOpens.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestOpens.h hello FPR 2017-04-19 00:56:45 -07:00
TestRaceDeadlock.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestRaceDeadlock.h hello FPR 2017-04-19 00:56:45 -07:00
TestRaceDeferral.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestRaceDeferral.h hello FPR 2017-04-19 00:56:45 -07:00
TestRacyInterruptReplies.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestRacyInterruptReplies.h hello FPR 2017-04-19 00:56:45 -07:00
TestRacyReentry.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestRacyReentry.h hello FPR 2017-04-19 00:56:45 -07:00
TestRacyUndefer.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestRacyUndefer.h hello FPR 2017-04-19 00:56:45 -07:00
TestRPC.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestRPC.h hello FPR 2017-04-19 00:56:45 -07:00
TestSanity.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestSanity.h hello FPR 2017-04-19 00:56:45 -07:00
TestSelfManageRoot.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestSelfManageRoot.h hello FPR 2017-04-19 00:56:45 -07:00
TestShmem.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestShmem.h hello FPR 2017-04-19 00:56:45 -07:00
TestShutdown.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestShutdown.h hello FPR 2017-04-19 00:56:45 -07:00
TestStackHooks.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestStackHooks.h hello FPR 2017-04-19 00:56:45 -07:00
TestSyncError.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestSyncError.h hello FPR 2017-04-19 00:56:45 -07:00
TestSyncHang.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestSyncHang.h hello FPR 2017-04-19 00:56:45 -07:00
TestSyncWakeup.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestSyncWakeup.h hello FPR 2017-04-19 00:56:45 -07:00
TestSysVShmem.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestSysVShmem.h hello FPR 2017-04-19 00:56:45 -07:00
TestUrgency.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestUrgency.h hello FPR 2017-04-19 00:56:45 -07:00
TestUrgentHangs.cpp hello FPR 2017-04-19 00:56:45 -07:00
TestUrgentHangs.h hello FPR 2017-04-19 00:56:45 -07:00

To add a new IPDL C++ unit test, you need to create (at least) the
following files (for a test "TestFoo"):

  - PTestFoo.ipdl, specifying the top-level protocol used for the test

  - TestFoo.h, declaring the top-level parent/child actors used for
    the test

  - TestFoo.cpp, defining the top-level actors

  - (make sure all are in the namespace mozilla::_ipdltest)

Next

  - add PTestFoo.ipdl to ipdl.mk

  - append TestFoo to the variable IPDLTESTS in Makefile.in

You must define three methods in your |TestFooParent| class:

  - static methods |bool RunTestInProcesses()| and
    |bool RunTestInThreads()|.  These methods control whether
    to execute the test using actors in separate processes and
    threads respectively.  Generally, both should return true.

  - an instance method |void Main()|.  The test harness wil first
    initialize the processes or threads, create and open both actors,
    and then kick off the test using |Main()|.  Make sure you define
    it.

If your test passes its criteria, please call
|MOZ_IPDL_TESTPASS("msg")| and "exit gracefully".

If your tests fails, please call |MOZ_IPDL_TESTFAIL("msg")| and "exit
ungracefully", preferably by abort()ing.


If all goes well, running

  make -C $OBJDIR/ipc/ipdl/test/cxx

will update the file IPDLUnitTests.cpp (the test launcher), and your
new code will be built automatically.


You can launch your new test by invoking one of

  make -C $OBJDIR/ipc/ipdl/test/cxx check-proc     (test process-based tests)
  make -C $OBJDIR/ipc/ipdl/test/cxx check-threads  (test thread-based tests)
  make -C $OBJDIR/ipc/ipdl/test/cxx check          (tests both)

If you want to launch only your test, run

  cd $OBJDIR/dist/bin
  ./run-mozilla.sh ./ipdlunittest TestFoo          (test in two processes, if appl.)
  ./run-mozilla.sh ./ipdlunittest thread:TestFoo   (test in two threads, if appl.)


For a bare-bones example of adding a test, take a look at
PTestSanity.ipdl, TestSanity.h, TestSanity.cpp, and how "TestSanity"
is included in ipdl.mk and Makefile.in.