mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 08:05:21 +00:00
test a few more things about getrrsetbyname()
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: lwtest.c,v 1.18 2000/11/02 02:05:01 bwelling Exp $ */
|
/* $Id: lwtest.c,v 1.19 2000/12/20 03:42:01 bwelling Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -597,17 +597,23 @@ test_getnameinfo(const char *address, int af, const char *name) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
test_getrrsetbyname(const char *name, int rdclass, int rdtype,
|
test_getrrsetbyname(const char *name, int rdclass, int rdtype,
|
||||||
unsigned int nrdatas, unsigned int nsigs)
|
unsigned int nrdatas, unsigned int nsigs,
|
||||||
|
int should_pass)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct rrsetinfo *rrinfo = NULL;
|
struct rrsetinfo *rrinfo = NULL;
|
||||||
ret = getrrsetbyname(name, rdclass, rdtype, 0, &rrinfo);
|
ret = getrrsetbyname(name, rdclass, rdtype, 0, &rrinfo);
|
||||||
if (ret != 0) {
|
if (ret != 0 && should_pass == 1) {
|
||||||
printf("I:getrrsetbyname(%s, %d) returned %d, expected %d\n",
|
printf("I:getrrsetbyname(%s, %d) failed\n", name, rdtype);
|
||||||
name, rdtype, ret, 0);
|
|
||||||
fails++;
|
fails++;
|
||||||
return;
|
return;
|
||||||
}
|
} else if (ret == 0 && should_pass == 0) {
|
||||||
|
printf("I:getrrsetbyname(%s, %d) unexpectedly succeeded\n",
|
||||||
|
name, rdtype);
|
||||||
|
fails++;
|
||||||
|
return;
|
||||||
|
} else if (ret != 0)
|
||||||
|
return;
|
||||||
if (rrinfo->rri_nrdatas != nrdatas) {
|
if (rrinfo->rri_nrdatas != nrdatas) {
|
||||||
printf("I:getrrsetbyname(%s, %d): got %d rr, expected %d\n",
|
printf("I:getrrsetbyname(%s, %d): got %d rr, expected %d\n",
|
||||||
name, rdtype, rrinfo->rri_nrdatas, nrdatas);
|
name, rdtype, rrinfo->rri_nrdatas, nrdatas);
|
||||||
@@ -743,9 +749,11 @@ main(void) {
|
|||||||
test_getnameinfo("1122:3344:5566:7788:99aa:bbcc:ddee:ff00",
|
test_getnameinfo("1122:3344:5566:7788:99aa:bbcc:ddee:ff00",
|
||||||
AF_INET6, "dname.example1");
|
AF_INET6, "dname.example1");
|
||||||
|
|
||||||
test_getrrsetbyname("a", 1, 1, 1, 0);
|
test_getrrsetbyname("a", 1, 1, 1, 0, 1);
|
||||||
test_getrrsetbyname("a.example1.", 1, 1, 1, 0);
|
test_getrrsetbyname("a.example1.", 1, 1, 1, 0, 1);
|
||||||
test_getrrsetbyname("e.example1.", 1, 1, 1, 1);
|
test_getrrsetbyname("e.example1.", 1, 1, 1, 1, 1);
|
||||||
|
test_getrrsetbyname("e.example1.", 1, 255, 1, 1, 0);
|
||||||
|
test_getrrsetbyname("e.example1.", 1, 24, 1, 0, 1);
|
||||||
|
|
||||||
if (fails == 0)
|
if (fails == 0)
|
||||||
printf("I:ok\n");
|
printf("I:ok\n");
|
||||||
|
Reference in New Issue
Block a user