tests: Add basic test framework for GResolver DNS parsing

Split out from https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2134
by Philip Withnall so it can be used in advance of HTTPS DNS record
support landing.

Reworked to no longer use test fixtures, as it’s simple enough to build
the response header in each test.

The tests are built on Unix only, as they test the parsing code in
`g_resolver_records_from_res_query()`, which is Unix-specific. The
Windows DNS APIs provide much more structured results which don’t need
parsing.
This commit is contained in:
Patrick Griffis
2022-03-18 14:22:38 +00:00
committed by Philip Withnall
parent 96efd662c9
commit 5cdacced3f
3 changed files with 125 additions and 0 deletions

View File

@@ -74,6 +74,14 @@ if host_system != 'windows'
endif
endif
# dn_comp()
if cc.links('''#include <resolv.h>
int main (int argc, char ** argv) {
return dn_comp(NULL, NULL, 0, NULL, NULL) == -1;
} ''', args : network_args, name : 'dn_comp()')
glib_conf.set('HAVE_DN_COMP', 1)
endif
# res_nclose()
if cc.links('''#include <sys/types.h>
#include <netinet/in.h>