[Dnsmasq-discuss] unittests

Dominik Derigs dl6er at dl6er.de
Tue Oct 5 18:35:15 UTC 2021


Hey Petr and others,

On Tue, 2021-10-05 at 17:13 +0200, Petr Menšík wrote:
> It would be beneficial to have also behavior tests.

it may be the time to mention that we do exactly this for Pi-hole
FTL which embeds the full dnsmasq for the DNS part. On every
commit, a virtual machine is started which firstly compiles our
project (including dnsmasq) and secondly runs it with standard
parameters and starts a full test bench with more than a hundred
individual tests. While the majority of tests are for extensions
we made to dnsmasq (regular expressions, database integration,
CNAME inspection, etc), we also have some standard DNS tests
sending some A, AAAA, PTR, CNAME, SRV, SOA, ANY, TXT, NAPTR, MX,
DS, RRSIG, etc. queries to specific domains and checking the
answers. We then also check the logs and if anything is still
working.

For instance, our tests complained when merging my patch adding
all the known DNS RR types because "query[type=5]" changes to
"query[CNAME]". This was not a bug but you see the tests have
noticed it.

Even when this isn't directly applicable to the dnsmasq core
project, it is still something that tests dnsmasq, even when
embedded in another project. There is no unittest library
whatsoever involved. The tests simply run on a compiled binary.

You can find everything here if you're curious:
https://github.com/pi-hole/FTL/tree/master/test

Best,
Dominik




More information about the Dnsmasq-discuss mailing list