rbt_serialize_test.c File Reference

#include <config.h>
#include <atf-c.h>
#include <isc/mem.h>
#include <isc/random.h>
#include <isc/string.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <dns/rbt.h>
#include <dns/fixedname.h>
#include <dns/result.h>
#include <dns/compress.h>
#include "dnstest.h"
#include <isc/app.h>
#include <isc/buffer.h>
#include <isc/entropy.h>
#include <isc/file.h>
#include <isc/hash.h>
#include <isc/os.h>
#include <isc/socket.h>
#include <isc/stdio.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dst/dst.h>

Go to the source code of this file.

Data Structures

struct  data_holder
struct  rbt_testdata

Defines

#define MAP_FILE   0
#define DATA_ITEM(name)   { (name), sizeof(name) - 1, { sizeof(name), (name) } }

Typedefs

typedef struct data_holder data_holder_t
typedef struct rbt_testdata rbt_testdata_t

Functions

static void delete_data (void *data, void *arg)
static isc_result_t write_data (FILE *file, unsigned char *datap, void *arg, isc_uint64_t *crc)
static isc_result_t fix_data (dns_rbtnode_t *p, void *base, size_t max, void *arg, isc_uint64_t *crc)
static void add_test_data (isc_mem_t *mymctx, dns_rbt_t *rbt)
static void check_test_data (dns_rbt_t *rbt)
static void data_printer (FILE *out, void *datap)
 ATF_TC (serialize)
 ATF_TC_HEAD (serialize, tc)
 ATF_TC_BODY (serialize, tc)
 ATF_TC (deserialize_corrupt)
 ATF_TC_HEAD (deserialize_corrupt, tc)
 ATF_TC_BODY (deserialize_corrupt, tc)
 ATF_TC (serialize_align)
 ATF_TC_HEAD (serialize_align, tc)
 ATF_TC_BODY (serialize_align, tc)
 ATF_TP_ADD_TCS (tp)

Variables

rbt_testdata_t testdata []


Define Documentation

#define MAP_FILE   0

Definition at line 61 of file rbt_serialize_test.c.

Referenced by ATF_TC_BODY(), and deserialize32().

#define DATA_ITEM ( name   )     { (name), sizeof(name) - 1, { sizeof(name), (name) } }

Definition at line 75 of file rbt_serialize_test.c.


Typedef Documentation

typedef struct data_holder data_holder_t

typedef struct rbt_testdata rbt_testdata_t


Function Documentation

static void delete_data ( void *  data,
void *  arg 
) [static]

Definition at line 104 of file rbt_serialize_test.c.

References UNUSED.

Referenced by ATF_TC_BODY(), and test_context_setup().

static isc_result_t write_data ( FILE *  file,
unsigned char *  datap,
void *  arg,
isc_uint64_t crc 
) [static]

Definition at line 110 of file rbt_serialize_test.c.

References data_holder::data, isc_crc64_update(), ISC_R_FAILURE, ISC_R_SUCCESS, isc_stdio_tell(), data_holder::len, REQUIRE, and UNUSED.

Referenced by ATF_TC_BODY().

static isc_result_t fix_data ( dns_rbtnode_t p,
void *  base,
size_t  max,
void *  arg,
isc_uint64_t crc 
) [static]

Definition at line 149 of file rbt_serialize_test.c.

References data_holder::data, dns_rbtnode::data, isc_crc64_update(), ISC_R_INVALIDFILE, ISC_R_SUCCESS, data_holder::len, REQUIRE, and UNUSED.

Referenced by ATF_TC_BODY().

static void add_test_data ( isc_mem_t mymctx,
dns_rbt_t rbt 
) [static]

Definition at line 196 of file rbt_serialize_test.c.

References buffer, data_holder::data, rbt_testdata::data, dns_compress_init(), dns_compress_invalidate(), dns_fixedname_init, dns_fixedname_name, dns_name_fromtext(), dns_rbt_addname(), dns_result_totext(), dns_rootname, isc_buffer_add, isc_buffer_init, ISC_R_SUCCESS, rbt_testdata::name, name, and rbt_testdata::name_len.

Referenced by ATF_TC_BODY().

static void check_test_data ( dns_rbt_t rbt  )  [static]

Definition at line 234 of file rbt_serialize_test.c.

References arg, buffer, data_holder::data, rbt_testdata::data, dns_fixedname_init, dns_fixedname_name, dns_name_fromtext(), dns_rbt_findname(), dns_result_totext(), dns_rootname, fixed, isc_buffer_add, isc_buffer_init, ISC_R_SUCCESS, rbt_testdata::name, name, and rbt_testdata::name_len.

Referenced by ATF_TC_BODY().

static void data_printer ( FILE *  out,
void *  datap 
) [static]

Definition at line 273 of file rbt_serialize_test.c.

References data_holder::data, and data_holder::len.

Referenced by ATF_TC_BODY(), dns_rbt_printtext(), and print_text_helper().

ATF_TC ( serialize   ) 

ATF_TC_HEAD ( serialize  ,
tc   
)

Definition at line 281 of file rbt_serialize_test.c.

ATF_TC_BODY ( serialize  ,
tc   
)

Definition at line 284 of file rbt_serialize_test.c.

References add_test_data(), check_test_data(), data_printer(), delete_data(), dns_rbt_create(), dns_rbt_deserialize_tree(), dns_rbt_destroy(), dns_rbt_printtext(), dns_rbt_serialize_tree(), dns_result_totext(), dns_test_begin(), dns_test_end(), fix_data(), isc_file_getsizefd(), isc_mem_debugging, ISC_MEM_DEBUGRECORD, ISC_R_SUCCESS, ISC_TRUE, MAP_FILE, mctx, UNUSED, and write_data().

ATF_TC ( deserialize_corrupt   ) 

ATF_TC_HEAD ( deserialize_corrupt  ,
tc   
)

Definition at line 354 of file rbt_serialize_test.c.

ATF_TC_BODY ( deserialize_corrupt  ,
tc   
)

Definition at line 357 of file rbt_serialize_test.c.

References add_test_data(), delete_data(), dns_rbt_create(), dns_rbt_deserialize_tree(), dns_rbt_destroy(), dns_rbt_serialize_tree(), dns_test_begin(), dns_test_end(), fix_data(), isc_file_getsizefd(), isc_mem_debugging, ISC_MEM_DEBUGRECORD, ISC_R_INVALIDFILE, ISC_R_SUCCESS, isc_random_get(), isc_result_totext(), ISC_TRUE, MAP_FILE, mctx, r, UNUSED, and write_data().

ATF_TC ( serialize_align   ) 

ATF_TC_HEAD ( serialize_align  ,
tc   
)

Definition at line 434 of file rbt_serialize_test.c.

ATF_TC_BODY ( serialize_align  ,
tc   
)

Definition at line 438 of file rbt_serialize_test.c.

References dns_rbt_serialize_align(), and UNUSED.

ATF_TP_ADD_TCS ( tp   ) 

Definition at line 458 of file rbt_serialize_test.c.

References serialize().


Variable Documentation

rbt_testdata_t testdata[]

Initial value:

 {
        DATA_ITEM("first.com."),
        DATA_ITEM("one.net."),
        DATA_ITEM("two.com."),
        DATA_ITEM("three.org."),
        DATA_ITEM("asdf.com."),
        DATA_ITEM("ghjkl.com."),
        DATA_ITEM("1.edu."),
        DATA_ITEM("2.edu."),
        DATA_ITEM("3.edu."),
        DATA_ITEM("123.edu."),
        DATA_ITEM("1236.com."),
        DATA_ITEM("and_so_forth.com."),
        DATA_ITEM("thisisalongname.com."),
        DATA_ITEM("a.b."),
        DATA_ITEM("test.net."),
        DATA_ITEM("whoknows.org."),
        DATA_ITEM("blargh.com."),
        DATA_ITEM("www.joe.com."),
        DATA_ITEM("test.com."),
        DATA_ITEM("isc.org."),
        DATA_ITEM("uiop.mil."),
        DATA_ITEM("last.fm."),
        { NULL, 0, { 0, NULL } }
}

Definition at line 77 of file rbt_serialize_test.c.


Generated on Tue Apr 28 17:41:13 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha