Testing IPC Internals¶
:(¶
Here’s the deal. Most IPDL testing is not currently run in automation and is very rarely run “manually”, for a number of reasons. As the prioritization of automated testing in Gecko continues to increase, we hope that this will change, but as of right now, there is no timeline for this. There are still a number of IPC components that are actively tested in automation and, of course, Gecko testing pretty much always involves use of IPDL actors. But that is not good enough.
We will begin by detailing the tests that are run in automation and conclude by noting how users can write IPDL tests and run them locally.
XPC TestShell¶
Basic IPDL behavior is lightly tested with the XPCShell module in the testshell directory. That C++ code there is the backbone of the XPCShell sendCommand function, which uses a couple of actors to send JS commands from the main process to a content process and checks the results. At the time of this writing, there is only one nontrivial test here – test_ipcshell.js
, which makes sure that it runs in the main process and sendCommand
runs in a content process. It just checks that the JS function localeCompare
behaves the same in both processes.
Note
Tests that use sendCommand
, and hence the TestShell, exist throughout the codebase.
GTests¶
Found here:
TestLogging.cpp
: Tests the IPC logging filter function used by the environment variableMOZ_IPC_MESSAGE_LOG
, which lists actors to include in IPDL logging.TestSharedMemory.cpp
: Tests the shared memory implementation.
IPDL Tests¶
These tests cover a large portion of the features in IPDL. They are not run in automation. They are found in two directories:
ipdl: Run with
runtests.py
. These tests ensure that the valid IPDL files in theok
directory compile successfully and the invalid files in theerror
directory do not.cxx: Built by normal
mach build
behavior when themozconfig
setsMOZ_IPDL_TESTS
, which it does not by default. Check the README for instructions on running and improving.
Error
TODO: Update the README
because make -C
should be changed to mach build
, run-mozilla.sh
is no longer relevant and it does not mention setting MOZ_IPDL_TESTS=1
.