Click to view at full resolution.
The system structure diagram describes how the various modules of cmail interact with eachother as well as remote systems.
help wanted
and good first issue
on the issue tracking system
At the most basic level, this means cmail is regularly built and checked for compile-time warnings using a variety of compilers, and operating systems, including
Code quality is regularly being analyzed by
valgrind
to check for access violations and memory leaks
at run-time (invoked via make run
)
cppcheck
to gather a quick list of warnings from the source (via make cppcheck
)
scan-build
static analyzer to generate warnings from the source (invoked via scan-build make
)
Coverage information can be extracted by running the test suite against a build with the gcov coverage analyzer enabled and thereafter analyzing the output with lcov. As these steps need to assume a lot about the environment they are run in, there is as of yet no completely automated way of running the test suite.
The cmail main makefile contains a special target named rtldumps
which
generates GCC rtldump files into the rtldumps/
folder. These can be used to easily create call graphs
for all the cmail daemons with the help of rtl2dot and
GraphViz.
For example, to create a graph of the call hierarchy of cmail-smtpd, perform the following steps:
make rtldumps
.
This will create a folder named rtldumps
, containing the raw data for the graph.
rtldumps
folder, locate the file containing the smtpd data. It will
usually be named something like smtpd.c.170r.expand
.
rtl2dot.py smtpd.c.170r.expand > smtpd.dot
. This will create smtpd.dot
.
dot -Tsvg smtpd.dot > smtpd.svg
.
This will create an SVG image of the call graph. Note that dot
is also able to
create raster images in formats like PNG and JPG by supplying the appropriate -T<type> parameters.
rtl2dot.py smtpd.c.170r.expand | dot -Tsvg > smtpd.svg
The previous steps generate a full callgraph, containing all functions called via any one possible path from main
.
This includes common functions such as logprintf
, which are called from almost every function, eg. to print
messages to the log files, as well as library functions which are not directly part of the project.
In order to create a clearer visualisation of interesting code paths, it is necessary to exclude some functions from the graph.
rtl2dot.py
supports exclusion of functions by their name with the --ignore
argument,
as well as exclusion of library calls with the --local
argument. A beautified callgraph can thus be
created by running rtl2dot.py smtpd.c.170r.expand --root core_loop --ignore "client_send|logprintf|common_*"
--local | dot -Tsvg > smtpd.svg
This also sets the root function of the graph to core_loop
,
which is where the main processing functions are called in the cmail daemons.