master_test.c revision c110d61b173a68420d19858abb80285be0dc1120
/*
* Copyright (C) 2011-2013, 2015 Internet Systems Consortium, Inc. ("ISC")
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id$ */
/*! \file */
#include <config.h>
#include <atf-c.h>
#include <stdio.h>
#include <unistd.h>
#include <dns/callbacks.h>
#include <dns/masterdump.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include "dnstest.h"
/*
* Helper functions
*/
#define BUFLEN 255
#define TEST_ORIGIN "test"
static dns_masterrawheader_t header;
static isc_boolean_t headerset;
char origin[sizeof(TEST_ORIGIN)];
char *include_file = NULL;
static isc_result_t
static void
static isc_result_t
&target);
return(result);
}
static void
header = *h;
}
static isc_result_t
void (*error)(struct dns_rdatacallbacks *, const char *, ...))
{
int len;
0, &target);
if (result != ISC_R_SUCCESS)
return(result);
return (result);
}
static isc_result_t
void (*warn)(struct dns_rdatacallbacks *, const char *, ...),
void (*error)(struct dns_rdatacallbacks *, const char *, ...))
{
if (result != ISC_R_SUCCESS)
return(result);
return (result);
}
static void
}
/*
* Individual unit tests
*/
/* Successful load test */
"valid master file and returns success");
}
dns_test_end();
}
/* Unepxected end of file test */
"DNS_R_UNEXPECTED when file ends "
"too soon");
}
dns_test_end();
}
/* No owner test */
"zones with no TTL for first record "
"if it is an SOA");
}
dns_test_end();
}
/* No TTL test */
"DNS_R_NOOWNER when no owner name "
"is specified");
}
dns_test_end();
}
/* Bad class test */
"DNS_R_BADCLASS when record class "
"doesn't match zone class");
}
dns_test_end();
}
/* Too big rdata test */
"ISC_R_NOSPACE when record is too big");
}
dns_test_end();
}
/* Maximum rdata test */
"ISC_R_SUCCESS when record is maximum "
"size");
}
dns_test_end();
}
/* DNSKEY test */
"DNSKEY with key material");
}
dns_test_end();
}
/* DNSKEY with no key material test */
"DNSKEY with no key material");
}
dns_test_end();
}
/* Include test */
ATF_TC(include);
ATF_TC_HEAD(include, tc) {
"$INCLUDE");
}
ATF_TC_BODY(include, tc) {
dns_test_end();
}
/* Include file list test */
"names of included file");
}
&dns_origin, &dns_origin,
}
dns_test_end();
}
/* Include failure test */
"$INCLUDE failures");
}
dns_test_end();
}
/* Non-empty blank lines test */
"non-empty blank lines");
}
dns_test_end();
}
/* SOA leading zeroes test */
"leading zeroes in SOA");
}
dns_test_end();
}
}
/* First, test with an empty rdataset */
&target);
/*
* XXX: We will also need to add tests for dumping various
* rdata types, classes, etc, and comparing the results against
* known-good output.
*/
dns_test_end();
}
/* Raw load */
"valid raw file and returns success");
}
/* Raw format version 0 */
/* Raw format version 1, no source serial */
/* Raw format version 1, source serial == 2011120101 */
dns_test_end();
}
/* Raw dump*/
"dump valid raw files");
}
char myorigin[sizeof(TEST_ORIGIN)];
int len;
0, &target);
&dns_master_style_default, "test.dump",
unlink("test.dump");
&dns_master_style_default, "test.dump",
unlink("test.dump");
dns_db_detach(&db);
dns_test_end();
}
static const char *warn_expect_value;
static isc_boolean_t warn_expect_result;
static void
char buf[4096];
}
/* Origin change test */
"zones with inherited name following "
"$ORIGIN");
}
warn_expect_value = "record with inherited owner";
dns_test_end();
}
/*
* Main
*/
ATF_TP_ADD_TCS(tp) {
ATF_TP_ADD_TC(tp, include);
return (atf_no_error());
}