IPDL/Unit test generation: Difference between revisions
(Created page with 'Placeholder.') |
(Update to reflect that make script must run from it's folder, requires mozmake as Windows msys make is not supported, and that run-mozilla.sh no longer exists. New process confirmed to work on Windows.) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{bug|506303}} | |||
cjones will update when possible. | |||
robin_bb to implement. | |||
==README== | |||
Contents of ipc/ipdl/test/cxx/README.txt: | |||
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 | |||
The IPDL test harness will try to execute |testFooParentActor->Main()| | |||
to kick off your test. Make sure you define |TestFooParent::Main()|. | |||
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 | |||
cd $OBJDIR/ipc/ipdl/test/cxx | |||
mozmake | |||
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 (from the $OBJDIR/ipc/ipdl/test/cxx folder) | |||
mozmake check | |||
If you want to launch only your test, run | |||
cd $OBJDIR/dist/bin | |||
./ipdlunittest TestFoo | |||
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. | |||
==Notes== | |||
For IPDL tests to be built, you need '''--enable-ipdl-tests''' in your build options (mozconfig). |
Latest revision as of 11:05, 12 September 2018
cjones will update when possible.
robin_bb to implement.
README
Contents of ipc/ipdl/test/cxx/README.txt:
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
The IPDL test harness will try to execute |testFooParentActor->Main()| to kick off your test. Make sure you define |TestFooParent::Main()|.
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
cd $OBJDIR/ipc/ipdl/test/cxx mozmake
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 (from the $OBJDIR/ipc/ipdl/test/cxx folder)
mozmake check
If you want to launch only your test, run
cd $OBJDIR/dist/bin ./ipdlunittest TestFoo
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.
Notes
For IPDL tests to be built, you need --enable-ipdl-tests in your build options (mozconfig).