mirror of https://github.com/getdnsapi/getdns.git
A little cleanup to eliminate some compile warnings.
This commit is contained in:
parent
181111fa69
commit
b35f533ce3
|
@ -5,10 +5,11 @@
|
|||
#include <inttypes.h>
|
||||
#include <check.h>
|
||||
#include <getdns/getdns.h>
|
||||
#include "check_getdns_libevent.h"
|
||||
#include "check_getdns_common.h"
|
||||
#include "check_getdns_address_sync.h"
|
||||
#include "check_getdns_general_sync.h"
|
||||
#include "check_getdns_general.h"
|
||||
#include "check_getdns_general_sync.h"
|
||||
#include "check_getdns_address_sync.h"
|
||||
|
||||
int
|
||||
main (void)
|
||||
|
@ -20,9 +21,9 @@ main (void)
|
|||
Suite *getdns_general_sync_suite (void);
|
||||
Suite *getdns_general_suite (void);
|
||||
|
||||
sr = srunner_create (getdns_address_sync_suite());
|
||||
srunner_add_suite (sr, getdns_general_sync_suite ());
|
||||
srunner_add_suite (sr, getdns_general_suite());
|
||||
sr = srunner_create(getdns_general_suite());
|
||||
srunner_add_suite(sr, getdns_general_sync_suite());
|
||||
srunner_add_suite(sr, getdns_address_sync_suite());
|
||||
|
||||
srunner_set_log(sr, "check_getdns.log");
|
||||
srunner_run_all(sr, CK_NORMAL);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* context = NULL
|
||||
* expect: GETDNS_RETURN_BAD_CONTEXT
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
ASSERT_RC(getdns_address_sync(context, "google.com", NULL, &response),
|
||||
GETDNS_RETURN_BAD_CONTEXT, "Return code from getdns_address_sync()");
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
|||
* name = NULL
|
||||
* expect: GETDNS_RETURN_GENERIC_ERROR
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_address_sync(context, NULL, NULL, &response),
|
||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_address_sync()");
|
||||
|
@ -33,7 +33,7 @@
|
|||
* name = invalid domain (too many octets)
|
||||
* expect: GETDNS_RETURN_BAD_DOMAIN_NAME
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
const char *name = "oh.my.gosh.and.for.petes.sake.are.you.fricking.crazy.man.because.this.spectacular.and.elaborately.thought.out.domain.name.of.very.significant.length.is.just.too.darn.long.because.you.know.the rfc.states.that.two.hundred.fifty.five.characters.is.the.max.com";
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_address_sync(context, name, NULL, &response),
|
||||
|
@ -47,7 +47,7 @@
|
|||
* name = invalid domain (label too long)
|
||||
* expect: GETDNS_RETURN_BAD_DOMAIN_NAME
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
const char *name = "this.domain.hasalabelwhichexceedsthemaximumdnslabelsizeofsixtythreecharacters.com";
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_address_sync(context, name, NULL, &response),
|
||||
|
@ -61,7 +61,7 @@
|
|||
* response = NULL
|
||||
* expect: GETDNS_RETURN_GENERIC_ERROR
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_address_sync(context, "google.com", NULL, NULL),
|
||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_address_sync()");
|
||||
|
@ -78,7 +78,7 @@
|
|||
todo: create zonefile with exact count
|
||||
* ancount = tbd (number of records in ANSWER section)
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_address_sync(context, "google.com", NULL, &response),
|
||||
|
@ -99,7 +99,7 @@
|
|||
todo: create zonefile with exact count
|
||||
* ancount = tbd (number of records in ANSWER section)
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_address_sync(context, "localhost", NULL, &response),
|
||||
|
@ -121,7 +121,7 @@
|
|||
* ancount >= 1 (number of records in ANSWER section)
|
||||
* and one SOA record ("type": 6) in "answer" list
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_address_sync(context, "google.joe", NULL, &response),
|
||||
|
@ -145,7 +145,7 @@
|
|||
* rcode = 0
|
||||
* ancount = 0 (number of records in ANSWER section)
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_address_sync(context, "hampster.com", NULL, &response),
|
||||
|
@ -164,7 +164,7 @@
|
|||
* rcode = 0
|
||||
* ancount >= 11 (number of records in ANSWER section)
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_address_sync(context, "google.com", NULL, &response),
|
||||
|
@ -185,7 +185,7 @@
|
|||
* ancount >= 1 (number of records in ANSWER section)
|
||||
* and one SOA record ("type": 6) in "answer" list
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_address_sync(context, "75.101.146.66", NULL, &response),
|
||||
|
@ -207,7 +207,7 @@
|
|||
* ancount >= 1 (number of records in ANSWER section)
|
||||
* and one SOA record ("type": 6) in "answer" list
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_address_sync(context, "2607:f8b0:4006:802::1007", NULL, &response),
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
#include <check.h>
|
||||
#include <getdns/getdns.h>
|
||||
#include "check_getdns_common.h"
|
||||
#include <example/getdns_libevent.h>
|
||||
|
||||
|
||||
/*
|
||||
* extract_response extracts all of the various information
|
||||
|
@ -15,7 +13,6 @@
|
|||
*/
|
||||
void extract_response(struct getdns_dict *response, struct extracted_response *ex_response)
|
||||
{
|
||||
|
||||
ck_assert_msg(response != NULL, "Response should not be NULL");
|
||||
|
||||
ASSERT_RC(getdns_dict_get_int(response, "answer_type", &ex_response->top_answer_type),
|
||||
|
@ -115,7 +112,6 @@ void assert_address_in_answer(struct extracted_response *ex_response, int a, int
|
|||
uint32_t address_records = 0;
|
||||
size_t i;
|
||||
|
||||
|
||||
ASSERT_RC(getdns_dict_get_int(ex_response->header, "ancount", &ancount),
|
||||
GETDNS_RETURN_GOOD, "Failed to extract \"ancount\"");
|
||||
ck_assert_msg(ancount >= 1, "Expected ancount >= 1, got %d", ancount);
|
||||
|
|
|
@ -23,30 +23,39 @@
|
|||
};
|
||||
|
||||
/*
|
||||
* The STANDARD_TEST_DECLARATIONS macro defines
|
||||
* the standard variable definitions most tests
|
||||
* will need.
|
||||
* The SYNCHRONOUS_TEST_DECLARATIONS macro
|
||||
* defines the standard variable definitions
|
||||
* that synchronous will need.
|
||||
*
|
||||
*/
|
||||
#define STANDARD_TEST_DECLARATIONS \
|
||||
#define SYNCHRONOUS_TEST_DECLARATIONS \
|
||||
struct getdns_context *context = NULL; \
|
||||
struct getdns_dict *response = NULL; \
|
||||
struct event_base *event_base; \
|
||||
getdns_transaction_t transaction_id = 0; \
|
||||
struct getdns_dict *response = NULL;
|
||||
|
||||
/*
|
||||
* The ASYNCHRONOUS_TEST_DECLARATIONS macro
|
||||
* defines the standard variable definitions
|
||||
* that asynchronous tests will will need.
|
||||
*
|
||||
*/
|
||||
#define ASYNCHRONOUS_TEST_DECLARATIONS \
|
||||
struct getdns_context *context = NULL; \
|
||||
struct event_base *event_base = NULL; \
|
||||
getdns_transaction_t transaction_id = 0;
|
||||
|
||||
/*
|
||||
* The ASSERT_RC macro is used to assert
|
||||
* whether the return code from the last
|
||||
* getdns API call is what was expected.
|
||||
*/
|
||||
#define ASSERT_RC(rc, expected_rc, prefix) \
|
||||
{ \
|
||||
size_t buflen = MAXLEN; \
|
||||
char error_string[MAXLEN]; \
|
||||
#define ASSERT_RC(rc, expected_rc, prefix) \
|
||||
{ \
|
||||
size_t buflen = MAXLEN; \
|
||||
char error_string[MAXLEN]; \
|
||||
getdns_strerror(rc, error_string, buflen); \
|
||||
ck_assert_msg(rc == expected_rc, \
|
||||
"%s: expecting %s: %d, but received: %d: %s", \
|
||||
prefix, #expected_rc, expected_rc, rc, error_string); \
|
||||
ck_assert_msg(rc == expected_rc, \
|
||||
"%s: expecting %s: %d, but received: %d: %s", \
|
||||
prefix, #expected_rc, expected_rc, rc, error_string); \
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -55,8 +64,8 @@
|
|||
* return code is returned.
|
||||
*/
|
||||
#define CONTEXT_CREATE \
|
||||
ASSERT_RC(getdns_context_create(&context, TRUE), \
|
||||
GETDNS_RETURN_GOOD, \
|
||||
ASSERT_RC(getdns_context_create(&context, TRUE), \
|
||||
GETDNS_RETURN_GOOD, \
|
||||
"Return code from getdns_context_create()");
|
||||
|
||||
/*
|
||||
|
@ -64,26 +73,25 @@
|
|||
* create an event base and put it in the
|
||||
* context.
|
||||
*/
|
||||
#define EVENT_BASE_CREATE \
|
||||
event_base = event_base_new(); \
|
||||
ck_assert_msg(event_base != NULL, "Event base creation failed"); \
|
||||
#define EVENT_BASE_CREATE \
|
||||
event_base = event_base_new(); \
|
||||
ck_assert_msg(event_base != NULL, "Event base creation failed"); \
|
||||
ASSERT_RC(getdns_extension_set_libevent_base(context, event_base), \
|
||||
GETDNS_RETURN_GOOD, \
|
||||
"Return code from getdns_extension_set_libevent_base()");
|
||||
|
||||
/*
|
||||
* The EVENT_LOOP macro calls the event loop.
|
||||
* The RUN_EVENT_LOOP macro calls the event loop.
|
||||
*/
|
||||
#define EVENT_LOOP \
|
||||
int dispatch_return = event_base_dispatch(event_base);
|
||||
#define RUN_EVENT_LOOP event_base_dispatch(event_base);
|
||||
|
||||
/*
|
||||
* The process_response macro declares the
|
||||
* variables needed to house the response and
|
||||
* calls the function that extracts it.
|
||||
*/
|
||||
#define EXTRACT_RESPONSE \
|
||||
struct extracted_response ex_response; \
|
||||
#define EXTRACT_RESPONSE \
|
||||
struct extracted_response ex_response; \
|
||||
extract_response(response, &ex_response);
|
||||
|
||||
void extract_response(struct getdns_dict *response, struct extracted_response *ex_response);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* context = NULL
|
||||
* expect: GETDNS_RETURN_BAD_CONTEXT
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
ASYNCHRONOUS_TEST_DECLARATIONS;
|
||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
||||
"getdns_general_1", &transaction_id, negative_callbackfn),
|
||||
GETDNS_RETURN_BAD_CONTEXT, "Return code from getdns_general()");
|
||||
|
@ -20,13 +20,13 @@
|
|||
* name = NULL
|
||||
* expect: GETDNS_RETURN_GENERIC_ERROR
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
ASYNCHRONOUS_TEST_DECLARATIONS;
|
||||
CONTEXT_CREATE;
|
||||
EVENT_BASE_CREATE;
|
||||
ASSERT_RC(getdns_general(context, NULL, GETDNS_RRTYPE_A, NULL,
|
||||
"getdns_general_2", &transaction_id, negative_callbackfn),
|
||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_general()");
|
||||
EVENT_LOOP;
|
||||
RUN_EVENT_LOOP;
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
@ -36,14 +36,14 @@
|
|||
* name = invalid domain (too many octets)
|
||||
* expect: GETDNS_RETURN_BAD_DOMAIN_NAME
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
ASYNCHRONOUS_TEST_DECLARATIONS;
|
||||
const char *name = "oh.my.gosh.and.for.petes.sake.are.you.fricking.crazy.man.because.this.spectacular.and.elaborately.thought.out.domain.name.of.very.significant.length.is.just.too.darn.long.because.you.know.the rfc.states.that.two.hundred.fifty.five.characters.is.the.max.com";
|
||||
CONTEXT_CREATE;
|
||||
EVENT_BASE_CREATE;
|
||||
ASSERT_RC(getdns_general(context, name, GETDNS_RRTYPE_A, NULL,
|
||||
"getdns_general_3", &transaction_id, negative_callbackfn),
|
||||
GETDNS_RETURN_BAD_DOMAIN_NAME, "Return code from getdns_general()");
|
||||
EVENT_LOOP;
|
||||
RUN_EVENT_LOOP;
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
@ -53,14 +53,14 @@
|
|||
* name = invalid domain (label too long)
|
||||
* expect: GETDNS_RETURN_BAD_DOMAIN_NAME
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
ASYNCHRONOUS_TEST_DECLARATIONS;
|
||||
const char *name = "this.domain.hasalabelwhichexceedsthemaximumdnslabelsizeofsixtythreecharacters.com";
|
||||
CONTEXT_CREATE;
|
||||
EVENT_BASE_CREATE;
|
||||
ASSERT_RC(getdns_general(context, name, GETDNS_RRTYPE_A, NULL,
|
||||
"getdns_general_4", &transaction_id, negative_callbackfn),
|
||||
GETDNS_RETURN_BAD_DOMAIN_NAME, "Return code from getdns_general()");
|
||||
EVENT_LOOP;
|
||||
RUN_EVENT_LOOP;
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
@ -70,13 +70,13 @@
|
|||
* callbackfn = NULL
|
||||
* expect: GETDNS_RETURN_GENERIC_ERROR
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
ASYNCHRONOUS_TEST_DECLARATIONS;
|
||||
CONTEXT_CREATE;
|
||||
EVENT_BASE_CREATE;
|
||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
||||
"getdns_general_5", &transaction_id, NULL),
|
||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_general()");
|
||||
EVENT_LOOP;
|
||||
RUN_EVENT_LOOP;
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
@ -90,14 +90,14 @@
|
|||
* rcode = 0
|
||||
* ancount = 0 (number of records in ANSWER section)
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
ASYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
EVENT_BASE_CREATE;
|
||||
ASSERT_RC(getdns_general(context, "google.com", 0, NULL,
|
||||
"getdns_general_6", &transaction_id, positive_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
EVENT_LOOP;
|
||||
RUN_EVENT_LOOP;
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
@ -111,14 +111,14 @@
|
|||
* rcode = 0
|
||||
* ancount = 0 (number of records in ANSWER section)
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
ASYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
EVENT_BASE_CREATE;
|
||||
ASSERT_RC(getdns_general(context, "google.com", 65279, NULL,
|
||||
"getdns_general_7", &transaction_id, positive_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
EVENT_LOOP;
|
||||
RUN_EVENT_LOOP;
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
@ -133,14 +133,14 @@
|
|||
* ancount >= 1 (number of records in ANSWER section)
|
||||
* and equals number of A records ("type": 1) in "answer" list
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
ASYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
EVENT_BASE_CREATE;
|
||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
||||
"getdns_general_8", &transaction_id, positive_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
EVENT_LOOP;
|
||||
RUN_EVENT_LOOP;
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
@ -155,14 +155,14 @@
|
|||
* ancount >= 1 (number of records in ANSWER section)
|
||||
* and equals number of AAAA records ("type": 28) in "answer" list
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
ASYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
EVENT_BASE_CREATE;
|
||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_AAAA, NULL,
|
||||
"getdns_general_9", &transaction_id, positive_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
EVENT_LOOP;
|
||||
RUN_EVENT_LOOP;
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
@ -178,7 +178,7 @@
|
|||
* nscount = 1 (number of records in AUTHORITY section)
|
||||
* and SOA record ("type": 6) present in "authority" list
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
ASYNCHRONOUS_TEST_DECLARATIONS;
|
||||
const char *name = "thisdomainsurelydoesntexist.com";
|
||||
|
||||
CONTEXT_CREATE;
|
||||
|
@ -186,7 +186,7 @@
|
|||
ASSERT_RC(getdns_general(context, name, GETDNS_RRTYPE_TXT, NULL,
|
||||
"getdns_general_10", &transaction_id, positive_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
EVENT_LOOP;
|
||||
RUN_EVENT_LOOP;
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
@ -200,14 +200,14 @@
|
|||
* rcode = 0
|
||||
* ancount = 0 (number of records in ANSWER section)
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
ASYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
EVENT_BASE_CREATE;
|
||||
ASSERT_RC(getdns_general(context, "hampster.com", GETDNS_RRTYPE_MX, NULL,
|
||||
"getdns_general_11", &transaction_id, positive_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
EVENT_LOOP;
|
||||
RUN_EVENT_LOOP;
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
@ -222,14 +222,14 @@
|
|||
* ancount >= 1 (number of records in ANSWER section)
|
||||
* and equals number of A records ("type": 1) in "answer" list
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
ASYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
EVENT_BASE_CREATE;
|
||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
||||
"getdns_general_12", &transaction_id, positive_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
EVENT_LOOP;
|
||||
RUN_EVENT_LOOP;
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
@ -244,14 +244,14 @@
|
|||
* ancount == 1 (number of records in ANSWER section)
|
||||
* and PTR record found ("type": 12) in "answer" list
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
ASYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
EVENT_BASE_CREATE;
|
||||
ASSERT_RC(getdns_general(context, "75.101.146.66", GETDNS_RRTYPE_PTR, NULL,
|
||||
"getdns_general_13", &transaction_id, positive_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
EVENT_LOOP;
|
||||
RUN_EVENT_LOOP;
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
@ -266,14 +266,14 @@
|
|||
* ancount == 1 (number of records in ANSWER section)
|
||||
* and PTR record found ("type": 12) in "answer" list
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
ASYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
EVENT_BASE_CREATE;
|
||||
ASSERT_RC(getdns_general(context, "2607:f8b0:4006:802::1007", GETDNS_RRTYPE_PTR, NULL,
|
||||
"getdns_general_14", &transaction_id, positive_callbackfn),
|
||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||
EVENT_LOOP;
|
||||
RUN_EVENT_LOOP;
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* context = NULL
|
||||
* expect: GETDNS_RETURN_BAD_CONTEXT
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
ASSERT_RC(getdns_general_sync(context, "google.com", GETDNS_RRTYPE_A, NULL, &response),
|
||||
GETDNS_RETURN_BAD_CONTEXT, "Return code from getdns_general_sync()");
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
|||
* name = NULL
|
||||
* expect: GETDNS_RETURN_GENERIC_ERROR
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_general_sync(context, NULL, GETDNS_RRTYPE_A, NULL, &response),
|
||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_general_sync()");
|
||||
|
@ -32,7 +32,7 @@
|
|||
* name = invalid domain (too many octets)
|
||||
* expect: GETDNS_RETURN_BAD_DOMAIN_NAME
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
const char *name = "oh.my.gosh.and.for.petes.sake.are.you.fricking.crazy.man.because.this.spectacular.and.elaborately.thought.out.domain.name.of.very.significant.length.is.just.too.darn.long.because.you.know.the rfc.states.that.two.hundred.fifty.five.characters.is.the.max.com";
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_general_sync(context, name, GETDNS_RRTYPE_A, NULL, &response),
|
||||
|
@ -46,7 +46,7 @@
|
|||
* name = invalid domain (label too long)
|
||||
* expect: GETDNS_RETURN_BAD_DOMAIN_NAME
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
const char *name = "this.domain.hasalabelwhichexceedsthemaximumdnslabelsizeofsixtythreecharacters.com";
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_general_sync(context, name, GETDNS_RRTYPE_A, NULL, &response),
|
||||
|
@ -60,7 +60,7 @@
|
|||
* response = NULL
|
||||
* expect: GETDNS_RETURN_GENERIC_ERROR
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_general_sync(context, "google.com", GETDNS_RRTYPE_A, NULL, NULL),
|
||||
GETDNS_RETURN_GENERIC_ERROR, "Return code from getdns_general_sync()");
|
||||
|
@ -77,7 +77,7 @@
|
|||
* rcode = 0
|
||||
* ancount = 0 (number of records in ANSWER section)
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_general_sync(context, "google.com", 0, NULL, &response),
|
||||
|
@ -98,7 +98,7 @@
|
|||
* rcode = 0
|
||||
* ancount = 0 (number of records in ANSWER section)
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_general_sync(context, "google.com", 65279, NULL, &response),
|
||||
|
@ -120,7 +120,7 @@
|
|||
* ancount >= 1 (number of records in ANSWER section)
|
||||
* and equals number of A records ("type": 1) in "answer" list
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_general_sync(context, "google.com", GETDNS_RRTYPE_A, NULL, &response),
|
||||
|
@ -142,7 +142,7 @@
|
|||
* ancount >= 1 (number of records in ANSWER section)
|
||||
* and equals number of AAAA records ("type": 28) in "answer" list
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_general_sync(context, "google.com", GETDNS_RRTYPE_AAAA, NULL, &response),
|
||||
|
@ -165,7 +165,7 @@
|
|||
* nscount = 1 (number of records in AUTHORITY section)
|
||||
* and SOA record ("type": 6) present in "authority" list
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
const char *name = "thisdomainsurelydoesntexist.com";
|
||||
|
||||
CONTEXT_CREATE;
|
||||
|
@ -188,7 +188,7 @@
|
|||
* rcode = 0
|
||||
* ancount = 0 (number of records in ANSWER section)
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_general_sync(context, "hampster.com", GETDNS_RRTYPE_MX, NULL, &response),
|
||||
|
@ -210,7 +210,7 @@
|
|||
* ancount >= 1 (number of records in ANSWER section)
|
||||
* and equals number of A records ("type": 1) in "answer" list
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_general_sync(context, "google.com", GETDNS_RRTYPE_A, NULL, &response),
|
||||
|
@ -232,7 +232,7 @@
|
|||
* ancount == 1 (number of records in ANSWER section)
|
||||
* and PTR record found ("type": 12) in "answer" list
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_general_sync(context, "75.101.146.66", GETDNS_RRTYPE_PTR, NULL, &response),
|
||||
|
@ -254,7 +254,7 @@
|
|||
* ancount == 1 (number of records in ANSWER section)
|
||||
* and PTR record found ("type": 12) in "answer" list
|
||||
*/
|
||||
STANDARD_TEST_DECLARATIONS;
|
||||
SYNCHRONOUS_TEST_DECLARATIONS;
|
||||
|
||||
CONTEXT_CREATE;
|
||||
ASSERT_RC(getdns_general_sync(context, "2607:f8b0:4006:802::1007", GETDNS_RRTYPE_PTR, NULL, &response),
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
#ifdef HAVE_EVENT2_EVENT_H
|
||||
#include <event2/event.h>
|
||||
#else
|
||||
#include <event.h>
|
||||
#endif
|
Loading…
Reference in New Issue