mirror of https://github.com/getdnsapi/getdns.git
make test and a testscript and output comparisons.
This commit is contained in:
parent
69c6d0694b
commit
b392679ce4
|
@ -31,6 +31,9 @@ uninstall:
|
||||||
doc:
|
doc:
|
||||||
cd doc && $(MAKE) $@
|
cd doc && $(MAKE) $@
|
||||||
|
|
||||||
|
test:
|
||||||
|
cd src && $(MAKE) $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
cd src && $(MAKE) $@
|
cd src && $(MAKE) $@
|
||||||
cd doc && $(MAKE) $@
|
cd doc && $(MAKE) $@
|
||||||
|
@ -95,4 +98,4 @@ Makefile: Makefile.in config.status
|
||||||
configure.status: configure
|
configure.status: configure
|
||||||
./config.status --recheck
|
./config.status --recheck
|
||||||
|
|
||||||
.PHONY: all distclean clean default doc
|
.PHONY: all distclean clean default doc test
|
||||||
|
|
|
@ -64,6 +64,9 @@ uninstall:
|
||||||
libgetdns.la: $(GETDNS_OBJ)
|
libgetdns.la: $(GETDNS_OBJ)
|
||||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ $(GETDNS_OBJ) $(LDFLAGS) -rpath $(libdir) -version-info $(libversion) -no-undefined
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ $(GETDNS_OBJ) $(LDFLAGS) -rpath $(libdir) -version-info $(libversion) -no-undefined
|
||||||
|
|
||||||
|
test: libgetdns.la
|
||||||
|
cd test && $(MAKE) $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
cd test && $(MAKE) $@
|
cd test && $(MAKE) $@
|
||||||
cd example && $(MAKE) $@
|
cd example && $(MAKE) $@
|
||||||
|
@ -105,4 +108,4 @@ Makefile: Makefile.in ../config.status
|
||||||
configure.status: configure
|
configure.status: configure
|
||||||
cd .. && ./config.status --recheck
|
cd .. && ./config.status --recheck
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean test
|
||||||
|
|
|
@ -42,6 +42,10 @@ tests_stub_async: tests_stub_async.o testmessages.o
|
||||||
tests_stub_sync: tests_stub_sync.o
|
tests_stub_sync: tests_stub_sync.o
|
||||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_stub_sync.o
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_stub_sync.o
|
||||||
|
|
||||||
|
test:
|
||||||
|
./testscript.sh
|
||||||
|
@echo "All tests OK"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o $(PROGRAMS)
|
rm -f *.o $(PROGRAMS)
|
||||||
rm -rf .libs
|
rm -rf .libs
|
||||||
|
@ -79,4 +83,4 @@ Makefile: Makefile.in ../../config.status
|
||||||
configure.status: configure
|
configure.status: configure
|
||||||
cd ../.. && ./config.status --recheck
|
cd ../.. && ./config.status --recheck
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean test
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
TESTPROG tests_dict START
|
||||||
|
TESTCASE tests_dict:tst_create BEGIN
|
||||||
|
tests_dict:tst_create: getdns_dict_create
|
||||||
|
tests_dict:tst_create: getdns_dict_destroy(dict)
|
||||||
|
tests_dict:tst_create: getdns_dict_destroy(NULL)
|
||||||
|
TESTCASE tests_dict:tst_create END
|
||||||
|
TESTCASE tests_dict:tst_bindatasetget BEGIN
|
||||||
|
tests_dict:tst_bindatasetget: getdns_dict_get_bindata() empty dict
|
||||||
|
tests_dict:tst_bindatasetget: line 63: getdns_dict_get_bindata(NULL, key, &ans_bdata),retval = 305
|
||||||
|
tests_dict:tst_bindatasetget: line 69: getdns_dict_get_bindata(dict, key, NULL),retval = 305
|
||||||
|
tests_dict:tst_bindatasetget: getdns_dict_get_bindata(dict, NULL, &ans_bindata)
|
||||||
|
tests_dict:tst_bindatasetget: line 74: getdns_dict_get_bindata,retval = 305
|
||||||
|
tests_dict:tst_bindatasetget: getdns_dict_get_bindata(dict, key, &ans_bdata)
|
||||||
|
tests_dict:tst_bindatasetget: line 80: getdns_list_get_bindata,retval = 306
|
||||||
|
tests_dict:tst_bindatasetget: getdns_dict_set_bindata(dict, key, bindata)
|
||||||
|
tests_dict:tst_bindatasetget: line 101: getdns_dict_set_bindata,retval=0,key=foo
|
||||||
|
tests_dict:tst_bindatasetget: getdns_dict_get_bindata(dict, key, &ans_bdata)
|
||||||
|
tests_dict:tst_bindatasetget: line 108: getdns_dict_get_bindata,retval=0,key=foo,data=foobar
|
||||||
|
TESTCASE tests_dict:tst_bindatasetget END
|
||||||
|
TESTCASE tests_dict:tst_dictsetget BEGIN
|
||||||
|
tests_dict:tst_dictsetget: getdns_dict_get_dict() empty dict
|
||||||
|
tests_dict:tst_dictsetget: line 148: getdns_dict_get_dict(NULL, key, &ansdict),retval = 305
|
||||||
|
tests_dict:tst_dictsetget: line 154: getdns_dict_get_dict(dict, key, NULL),retval = 305
|
||||||
|
tests_dict:tst_dictsetget: getdns_dict_get_dict(dict, NULL, &ansdict)
|
||||||
|
tests_dict:tst_dictsetget: line 159: getdns_dict_get_dict,retval = 305
|
||||||
|
tests_dict:tst_dictsetget: getdns_dict_get_dict(dict, key, &ansdict)
|
||||||
|
tests_dict:tst_dictsetget: line 165: getdns_list_get_dict,retval = 305
|
||||||
|
tests_dict:tst_dictsetget: getdns_dict_set_dict(dict, key, newdict)
|
||||||
|
tests_dict:tst_dictsetget: line 185: getdns_dict_set_dict,retval=0,key=foo
|
||||||
|
tests_dict:tst_dictsetget: getdns_dict_get_dict(dict, key, &ansdict)
|
||||||
|
tests_dict:tst_dictsetget: line 195: getdns_dict_get_dict,retval=0,key=foo,int1=42,int2=52
|
||||||
|
TESTCASE tests_dict:tst_dictsetget END
|
||||||
|
TESTCASE tests_dict:tst_intsetget BEGIN
|
||||||
|
tests_dict:tst_intsetget: getdns_dict_get_int() empty dict
|
||||||
|
tests_dict:tst_intsetget: line 410: getdns_dict_get_int(NULL, key, &ans_int),retval = 305
|
||||||
|
tests_dict:tst_intsetget: line 416: getdns_dict_get_int(dict, key, NULL),retval = 305
|
||||||
|
tests_dict:tst_intsetget: getdns_dict_get_int(dict, NULL, &ans_int)
|
||||||
|
tests_dict:tst_intsetget: line 421: getdns_dict_get_int,retval = 305
|
||||||
|
tests_dict:tst_intsetget: getdns_dict_get_int(dict, key, &ans_int)
|
||||||
|
tests_dict:tst_intsetget: line 427: getdns_list_get_int,retval = 306
|
||||||
|
tests_dict:tst_intsetget: getdns_dict_set_int(dict, key, newint)
|
||||||
|
tests_dict:tst_intsetget: line 445: getdns_dict_set_int,retval=0,key=foo,int=42
|
||||||
|
tests_dict:tst_intsetget: getdns_dict_get_int(dict, key, &ans_int)
|
||||||
|
tests_dict:tst_intsetget: line 451: getdns_dict_get_int,retval=0,key=foo,int=42
|
||||||
|
tests_dict:tst_intsetget: getdns_dict_set_int(dict, key, newint)
|
||||||
|
tests_dict:tst_intsetget: line 459: getdns_dict_set_int,retval=0,key=bar,int=52
|
||||||
|
tests_dict:tst_intsetget: getdns_dict_get_int(dict, key, &ans_int)
|
||||||
|
tests_dict:tst_intsetget: line 465: getdns_dict_get_int,retval=0,key=bar,int=52
|
||||||
|
tests_dict:tst_intsetget: getdns_dict_get_data_type(dict, key, &dtype)
|
||||||
|
tests_dict:tst_intsetget: line 472: getdns_dict_get_data_type,retval=0,key=bar,dtype=2
|
||||||
|
TESTCASE tests_dict:tst_intsetget END
|
||||||
|
TESTCASE tests_dict:tst_listsetget BEGIN
|
||||||
|
tests_dict:tst_listsetget: getdns_dict_get_list() empty dict
|
||||||
|
tests_dict:tst_listsetget: line 324: getdns_dict_get_list(NULL, key, &anslist),retval = 305
|
||||||
|
tests_dict:tst_listsetget: line 330: getdns_dict_get_list(dict, key, NULL),retval = 305
|
||||||
|
tests_dict:tst_listsetget: getdns_dict_get_list(dict, NULL, &anslist)
|
||||||
|
tests_dict:tst_listsetget: line 335: getdns_dict_get_list,retval = 305
|
||||||
|
tests_dict:tst_listsetget: getdns_dict_get_list(dict, key, &anslist)
|
||||||
|
tests_dict:tst_listsetget: line 341: getdns_list_get_list,retval = 306
|
||||||
|
tests_dict:tst_listsetget: getdns_dict_set_list(dict, key, newlist)
|
||||||
|
tests_dict:tst_listsetget: line 363: getdns_dict_set_list,retval=0,key=foo
|
||||||
|
tests_dict:tst_listsetget: getdns_dict_get_list(dict, key, &anslist)
|
||||||
|
tests_dict:tst_listsetget: line 373: getdns_dict_get_list,retval=0,key=foo,int1=42,int2=52
|
||||||
|
TESTCASE tests_dict:tst_listsetget END
|
||||||
|
TESTCASE tests_dict:tst_getnames BEGIN
|
||||||
|
tests_dict:tst_getnames: getdns_dict_get_names(NULL, &list)
|
||||||
|
tests_dict:tst_getnames: getdns_dict_get_names(dict, NULL)
|
||||||
|
tests_dict:tst_getnames: getdns_dict_get_names(dict, &list), empty dictionary
|
||||||
|
list item 0: NOTIMPLEMENTED list item 1: NOTIMPLEMENTED list item 2: NOTIMPLEMENTED list item 3: NOTIMPLEMENTEDTESTCASE tests_dict:tst_getnames END
|
||||||
|
TESTCASE tests_dict:tst_copy BEGIN
|
||||||
|
tests_dict:tst_copy: empty list cases
|
||||||
|
tests_dict:tst_copy: dict1 populate
|
||||||
|
{
|
||||||
|
"bar": 52,
|
||||||
|
"foo": 42,
|
||||||
|
"quz": 62
|
||||||
|
}
|
||||||
|
tests_dict:tst_copy: getdns_dict_copy(dict1, &dict2)
|
||||||
|
{
|
||||||
|
"bar": 52,
|
||||||
|
"foo": 42,
|
||||||
|
"quz": 62
|
||||||
|
}
|
||||||
|
TESTCASE tests_dict:tst_copy END
|
||||||
|
TESTPROG tests_dict END
|
|
@ -0,0 +1,78 @@
|
||||||
|
TESTPROG tests_list START
|
||||||
|
TESTCASE tests_list:tst_create BEGIN
|
||||||
|
tests_list:tst_create: getdns_list_create
|
||||||
|
tests_list:tst_create: getdns_list_destroy(list)
|
||||||
|
tests_list:tst_create: getdns_list_destroy(NULL)
|
||||||
|
tests_list:tst_create: getdns_add_item(list) past block size
|
||||||
|
tests_list:tst_create: getdns_list_get_length(list)
|
||||||
|
tests_list:tst_create: list length = 12
|
||||||
|
tests_list:tst_create: getdns_list_get_length()
|
||||||
|
tests_list:tst_create: NUll, 12, retval = 304
|
||||||
|
tests_list:tst_create: NUll, NULL, retval = 304
|
||||||
|
tests_list:tst_create: list, NULL, retval = 304
|
||||||
|
TESTCASE tests_list:tst_create END
|
||||||
|
TESTCASE tests_list:tst_bindatasetget BEGIN
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_get_bindata() empty list
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_get_bindata(NULL, index, &ans_bindata),retval = 304
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_get_bindata(list, index, NULL),retval = 304
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_get_bindata(list, 0, &ans_bindata)
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_get_bindata,retval = 304
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_get_bindata(list, 1, &ans_bindata)
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_get_bindata,retval = 304
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_set_bindata() empty list
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_set_bindata(NULL, index, ans_bindata),retval = 304
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_set_bindata(list, 0, ans_bindata)
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_set_bindata,retval = 304
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_set_bindata(list, 1, ans_bindata)
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_set_bindata,retval = 304
|
||||||
|
tests_list:tst_bindatasetget: getdns_list_set/get_bindata,retval = 0, bindata->data = 7,foobar
|
||||||
|
TESTCASE tests_list:tst_bindatasetget END
|
||||||
|
TESTCASE tests_list:tst_dictsetget BEGIN
|
||||||
|
tests_list:tst_dictsetget: getdns_list_get_dict() empty list
|
||||||
|
tests_list:tst_dictsetget: getdns_list_get_dict(NULL, index, &dict),retval = 304
|
||||||
|
tests_list:tst_dictsetget: getdns_list_get_dict(list, index, NULL),retval = 304
|
||||||
|
tests_list:tst_dictsetget: getdns_list_get_dict(list, 0, &dict)
|
||||||
|
tests_list:tst_dictsetget: getdns_list_get_dict,retval = 304
|
||||||
|
tests_list:tst_dictsetget: getdns_list_get_dict(list, 1, &dict)
|
||||||
|
tests_list:tst_dictsetget: getdns_list_get_dict,retval = 304
|
||||||
|
tests_list:tst_dictsetget: getdns_list_set_dict() empty list
|
||||||
|
tests_list:tst_dictsetget: getdns_list_set_dict(NULL, index, dict),retval = 304
|
||||||
|
tests_list:tst_dictsetget: getdns_list_set_dict(list, 0, dict)
|
||||||
|
tests_list:tst_dictsetget: getdns_list_set_dict,retval = 304
|
||||||
|
tests_list:tst_dictsetget: getdns_list_set_dict(list, 1, dict)
|
||||||
|
tests_list:tst_dictsetget: getdns_list_set_dict,retval = 304
|
||||||
|
tests_list:tst_dictsetget: getdns_list_set/get_dict,retval=0, ans=42
|
||||||
|
TESTCASE tests_list:tst_dictsetget END
|
||||||
|
TESTCASE tests_list:tst_intsetget BEGIN
|
||||||
|
tests_list:tst_intsetget: getdns_list_get_int() empty list
|
||||||
|
tests_list:tst_intsetget: getdns_list_get_int(NULL, index, &ans_int),retval = 304
|
||||||
|
tests_list:tst_intsetget: getdns_list_get_int(list, index, NULL),retval = 304
|
||||||
|
tests_list:tst_intsetget: getdns_list_get_int(list, 0, &ans_int)
|
||||||
|
tests_list:tst_intsetget: getdns_list_get_int,retval = 304
|
||||||
|
tests_list:tst_intsetget: getdns_list_get_int(list, 1, &ans_int)
|
||||||
|
tests_list:tst_intsetget: getdns_list_get_int,retval = 304
|
||||||
|
tests_list:tst_intsetget: getdns_list_set_int() empty list
|
||||||
|
tests_list:tst_intsetget: getdns_list_set_int(NULL, index, ans_int),retval = 304
|
||||||
|
tests_list:tst_intsetget: getdns_list_set_int(list, 0, ans_int)
|
||||||
|
tests_list:tst_intsetget: getdns_list_set_int,retval = 304
|
||||||
|
tests_list:tst_intsetget: getdns_list_set_int(list, 1, ans_int)
|
||||||
|
tests_list:tst_intsetget: getdns_list_set_int,retval = 304
|
||||||
|
tests_list:tst_intsetget: getdns_list_set/get_int,retval = 0, ans = 42
|
||||||
|
TESTCASE tests_list:tst_intsetget END
|
||||||
|
TESTCASE tests_list:tst_listsetget BEGIN
|
||||||
|
tests_list:tst_listsetget: getdns_list_get_list() empty list
|
||||||
|
tests_list:tst_listsetget: getdns_list_get_list(NULL, index, &ans_list),retval = 304
|
||||||
|
tests_list:tst_listsetget: getdns_list_get_list(list, index, NULL),retval = 304
|
||||||
|
tests_list:tst_listsetget: getdns_list_get_list(list, 0, &ans_list)
|
||||||
|
tests_list:tst_listsetget: getdns_list_get_list,retval = 304
|
||||||
|
tests_list:tst_listsetget: getdns_list_get_list(list, 1, &ans_list)
|
||||||
|
tests_list:tst_listsetget: getdns_list_get_list,retval = 304
|
||||||
|
tests_list:tst_listsetget: getdns_list_set_list() empty list
|
||||||
|
tests_list:tst_listsetget: getdns_list_set_list(NULL, index, ans_list),retval = 304
|
||||||
|
tests_list:tst_listsetget: getdns_list_set_list(list, 0, ans_list)
|
||||||
|
tests_list:tst_listsetget: getdns_list_set_list,retval = 304
|
||||||
|
tests_list:tst_listsetget: getdns_list_set_list(list, 1, ans_list)
|
||||||
|
tests_list:tst_listsetget: getdns_list_set_list,retval = 304
|
||||||
|
tests_list:tst_listsetget: getdns_list_set/get_list,retval = 0, ans[0] = 42
|
||||||
|
TESTCASE tests_list:tst_listsetget END
|
||||||
|
TESTPROG tests_list END
|
|
@ -42,7 +42,7 @@ this_callbackfn(struct getdns_context_t *this_context,
|
||||||
{
|
{
|
||||||
if (this_callback_type == GETDNS_CALLBACK_COMPLETE) { /* This is a callback with data */
|
if (this_callback_type == GETDNS_CALLBACK_COMPLETE) { /* This is a callback with data */
|
||||||
char *res = getdns_pretty_print_dict(this_response);
|
char *res = getdns_pretty_print_dict(this_response);
|
||||||
fprintf(stdout, "%s", res);
|
fprintf(stdout, "%s\n", res);
|
||||||
getdns_dict_destroy(this_response);
|
getdns_dict_destroy(this_response);
|
||||||
free(res);
|
free(res);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
{
|
||||||
|
"answer_type": 800,
|
||||||
|
"canonical_name": <bindata for "www.google.com.">,
|
||||||
|
"just_address_answers":
|
||||||
|
[
|
||||||
|
<bindata of 0x4a7de413>,
|
||||||
|
<bindata of 0x4a7de412>,
|
||||||
|
<bindata of 0x4a7de410>
|
||||||
|
],
|
||||||
|
"replies_full":
|
||||||
|
[
|
||||||
|
<bindata of 0x00008180000100050000000103777777...>
|
||||||
|
],
|
||||||
|
"replies_tree":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"additional": [],
|
||||||
|
"answer":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"class": 1,
|
||||||
|
"name": <bindata for "www.google.com.">,
|
||||||
|
"rdata":
|
||||||
|
{
|
||||||
|
"ipv4_address": <bindata of 0x4a7de413>,
|
||||||
|
"rdata_raw": <bindata of 0x4a7de413>
|
||||||
|
},
|
||||||
|
"ttl": 300,
|
||||||
|
"type": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"class": 1,
|
||||||
|
"name": <bindata for "www.google.com.">,
|
||||||
|
"rdata":
|
||||||
|
{
|
||||||
|
"ipv4_address": <bindata of 0x4a7de412>,
|
||||||
|
"rdata_raw": <bindata of 0x4a7de412>
|
||||||
|
},
|
||||||
|
"ttl": 300,
|
||||||
|
"type": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"class": 1,
|
||||||
|
"name": <bindata for "www.google.com.">,
|
||||||
|
"rdata":
|
||||||
|
{
|
||||||
|
"ipv4_address": <bindata of 0x4a7de410>,
|
||||||
|
"rdata_raw": <bindata of 0x4a7de410>
|
||||||
|
},
|
||||||
|
"ttl": 300,
|
||||||
|
"type": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"answer_type": 800,
|
||||||
|
"authority": [],
|
||||||
|
"canonical_name": <bindata for "www.google.com.">,
|
||||||
|
"header":
|
||||||
|
{
|
||||||
|
"id": 0,
|
||||||
|
"opcode": 0,
|
||||||
|
"qr": 1
|
||||||
|
},
|
||||||
|
"question":
|
||||||
|
{
|
||||||
|
"qclass": 1,
|
||||||
|
"qname": <bindata for "www.google.com.">,
|
||||||
|
"qtype": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"status": 900
|
||||||
|
}
|
|
@ -0,0 +1,116 @@
|
||||||
|
The packet {
|
||||||
|
"answer_type": 800,
|
||||||
|
"canonical_name": <bindata for "www.google.com.">,
|
||||||
|
"just_address_answers":
|
||||||
|
[
|
||||||
|
<bindata of 0x4a7de473>,
|
||||||
|
<bindata of 0x4a7de470>,
|
||||||
|
<bindata of 0x4a7de474>
|
||||||
|
],
|
||||||
|
"replies_full":
|
||||||
|
[
|
||||||
|
<bindata of 0x00008180000100050000000103777777...>
|
||||||
|
],
|
||||||
|
"replies_tree":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"additional": [],
|
||||||
|
"answer":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"class": 1,
|
||||||
|
"name": <bindata for "www.google.com.">,
|
||||||
|
"rdata":
|
||||||
|
{
|
||||||
|
"ipv4_address": <bindata of 0x4a7de473>,
|
||||||
|
"rdata_raw": <bindata of 0x4a7de473>
|
||||||
|
},
|
||||||
|
"ttl": 264,
|
||||||
|
"type": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"class": 1,
|
||||||
|
"name": <bindata for "www.google.com.">,
|
||||||
|
"rdata":
|
||||||
|
{
|
||||||
|
"ipv4_address": <bindata of 0x4a7de470>,
|
||||||
|
"rdata_raw": <bindata of 0x4a7de470>
|
||||||
|
},
|
||||||
|
"ttl": 264,
|
||||||
|
"type": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"class": 1,
|
||||||
|
"name": <bindata for "www.google.com.">,
|
||||||
|
"rdata":
|
||||||
|
{
|
||||||
|
"ipv4_address": <bindata of 0x4a7de474>,
|
||||||
|
"rdata_raw": <bindata of 0x4a7de474>
|
||||||
|
},
|
||||||
|
"ttl": 264,
|
||||||
|
"type": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"answer_type": 800,
|
||||||
|
"authority": [],
|
||||||
|
"canonical_name": <bindata for "www.google.com.">,
|
||||||
|
"header":
|
||||||
|
{
|
||||||
|
"id": 0,
|
||||||
|
"opcode": 0,
|
||||||
|
"qr": 1
|
||||||
|
},
|
||||||
|
"question":
|
||||||
|
{
|
||||||
|
"qclass": 1,
|
||||||
|
"qname": <bindata for "www.google.com.">,
|
||||||
|
"qtype": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"status": 900
|
||||||
|
}
|
||||||
|
The packet {
|
||||||
|
"answer_type": 800,
|
||||||
|
"canonical_name": <bindata for "www.google.com.">,
|
||||||
|
"just_address_answers": [],
|
||||||
|
"replies_full":
|
||||||
|
[
|
||||||
|
<bindata of 0x00008180000100000001000103777777...>
|
||||||
|
],
|
||||||
|
"replies_tree":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"additional": [],
|
||||||
|
"answer": [],
|
||||||
|
"answer_type": 800,
|
||||||
|
"authority":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"class": 1,
|
||||||
|
"name": <bindata for "google.com.">,
|
||||||
|
"rdata":
|
||||||
|
{
|
||||||
|
"rdata_raw": <bindata of 0x036e733106676f6f676c6503636f6d00>
|
||||||
|
},
|
||||||
|
"ttl": 40,
|
||||||
|
"type": 6
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"canonical_name": <bindata for "www.google.com.">,
|
||||||
|
"header":
|
||||||
|
{
|
||||||
|
"id": 0,
|
||||||
|
"opcode": 0,
|
||||||
|
"qr": 1
|
||||||
|
},
|
||||||
|
"question":
|
||||||
|
{
|
||||||
|
"qclass": 1,
|
||||||
|
"qname": <bindata for "www.google.com.">,
|
||||||
|
"qtype": 33
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"status": 900
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# run $1 > $2 and exit on failure to execute
|
||||||
|
function runit () {
|
||||||
|
echo -n "Test $1:"
|
||||||
|
./$1 > $2
|
||||||
|
if test $? -ne 0; then
|
||||||
|
echo " failed (execution failed)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# check output files $1 and $2, exit on failure
|
||||||
|
function diffit () {
|
||||||
|
if diff $1 $2; then
|
||||||
|
echo " OK"
|
||||||
|
else
|
||||||
|
echo " failed (differences above)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# check output of program $1, known_good must be in $1.good
|
||||||
|
function checkoutput () {
|
||||||
|
runit $1 output
|
||||||
|
diffit output $1.good
|
||||||
|
}
|
||||||
|
|
||||||
|
# filter out TTL and bindata stuff from $1 to $2
|
||||||
|
function filterout() {
|
||||||
|
sed -e '/"ttl"/d' -e '/"ipv4_address"/d' -e '/"ipv6_address"/d' -e '/"rdata_raw"/d' -e '/<bindata/d' <$1 >$2
|
||||||
|
}
|
||||||
|
|
||||||
|
# like checkoutput but removes addresses and TTLs and bindata
|
||||||
|
# this makes the test almost useless, but it tests runtime lookup
|
||||||
|
# and the structure of the answer format, against the live internet.
|
||||||
|
function checkpacket () {
|
||||||
|
runit $1 output
|
||||||
|
cp $1.good output.good
|
||||||
|
filterout output output2
|
||||||
|
filterout output.good output2.good
|
||||||
|
diffit output2 output2.good
|
||||||
|
}
|
||||||
|
|
||||||
|
checkoutput tests_dict
|
||||||
|
checkoutput tests_list
|
||||||
|
checkpacket tests_stub_async
|
||||||
|
checkpacket tests_stub_sync
|
||||||
|
|
||||||
|
rm -f output output.good output2 output2.good
|
||||||
|
exit 0
|
Loading…
Reference in New Issue