add cmocka support to remaining unit test makefiles
- also cleaned up some existing test code
This commit is contained in:
@@ -115,8 +115,10 @@ dns_test_begin(FILE *logfile, bool start_managers) {
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
|
||||
CHECK(isc_mem_create(0, 0, &mctx));
|
||||
|
||||
CHECK(dst_lib_init(mctx, NULL));
|
||||
dst_active = true;
|
||||
if (!dst_active) {
|
||||
CHECK(dst_lib_init(mctx, NULL));
|
||||
dst_active = true;
|
||||
}
|
||||
|
||||
if (logfile != NULL) {
|
||||
isc_logdestination_t destination;
|
||||
@@ -145,12 +147,13 @@ dns_test_begin(FILE *logfile, bool start_managers) {
|
||||
CHECK(create_managers());
|
||||
|
||||
/*
|
||||
* atf-run changes us to a /tmp directory, so tests
|
||||
* The caller might run from another directory, so tests
|
||||
* that access test data files must first chdir to the proper
|
||||
* location.
|
||||
*/
|
||||
if (chdir(TESTS) == -1)
|
||||
if (chdir(TESTS) == -1) {
|
||||
CHECK(ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
|
||||
@@ -102,44 +102,37 @@ dns_tkeyctx_destroy_test(void **state) {
|
||||
dns_tkeyctx_destroy(&tctx);
|
||||
}
|
||||
|
||||
#else /* LD_WRAP */
|
||||
|
||||
#define _setup NULL
|
||||
#define _teardown NULL
|
||||
|
||||
static void
|
||||
dns_tkeyctx_create_test(void **state __attribute__ ((unused))) {
|
||||
skip();
|
||||
}
|
||||
|
||||
static void
|
||||
dns_tkeyctx_destroy_test(void **state __attribute__ ((unused))) {
|
||||
skip();
|
||||
}
|
||||
|
||||
#endif /* LD_WRAP */
|
||||
|
||||
int main(void) {
|
||||
int
|
||||
main(void) {
|
||||
#if LD_WRAP
|
||||
const struct CMUnitTest tkey_tests[] = {
|
||||
cmocka_unit_test_teardown(dns_tkeyctx_create_test, _teardown),
|
||||
/* cmocka_unit_test(dns_tkey_processquery_test), */
|
||||
/* cmocka_unit_test(dns_tkey_builddhquery_test), */
|
||||
/* cmocka_unit_test(dns_tkey_buildgssquery_test), */
|
||||
/* cmocka_unit_test(dns_tkey_builddeletequery_test), */
|
||||
/* cmocka_unit_test(dns_tkey_processdhresponse_test), */
|
||||
/* cmocka_unit_test(dns_tkey_processgssresponse_test), */
|
||||
/* cmocka_unit_test(dns_tkey_processdeleteresponse_test), */
|
||||
/* cmocka_unit_test(dns_tkey_gssnegotiate_test), */
|
||||
cmocka_unit_test_setup(dns_tkeyctx_destroy_test, _setup),
|
||||
#if 0 /* not yet */
|
||||
cmocka_unit_test(dns_tkey_processquery_test),
|
||||
cmocka_unit_test(dns_tkey_builddhquery_test),
|
||||
cmocka_unit_test(dns_tkey_buildgssquery_test),
|
||||
cmocka_unit_test(dns_tkey_builddeletequery_test),
|
||||
cmocka_unit_test(dns_tkey_processdhresponse_test),
|
||||
cmocka_unit_test(dns_tkey_processgssresponse_test),
|
||||
cmocka_unit_test(dns_tkey_processdeleteresponse_test),
|
||||
cmocka_unit_test(dns_tkey_gssnegotiate_test),
|
||||
#endif
|
||||
};
|
||||
return (cmocka_run_group_tests(tkey_tests, NULL, NULL));
|
||||
#else
|
||||
print_message("1..0 # Skip tkey_test requires LD_WRAP");
|
||||
#endif /* LD_WRAP */
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int
|
||||
main(void) {
|
||||
printf("1..0 # Skipped: cmocka not available\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user