name_test.c revision 051197362ba480595c075c95b20e160b980a05c7
/*
* Copyright (C) 2014, 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 <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <atf-c.h>
#include <isc/commandline.h>
#include <dns/compress.h>
#include <dns/fixedname.h>
#include "dnstest.h"
/*
* Individual unit tests
*/
}
int i;
struct {
const char *name1;
const char *name2;
int order;
unsigned int nlabels;
} data[] = {
/* relative */
4, 1 },
/* absolute */
4, 2 },
};
int order = 3000;
unsigned int nlabels = 3000;
} else {
}
} else {
}
ATF_REQUIRE_EQ(order, 0);
/* Some random initializer */
order = 3001;
nlabels = 3001;
}
}
static void
{
unsigned char buf1[1024];
unsigned char buf2[1024];
&target) == ISC_R_SUCCESS);
&target) == ISC_R_SUCCESS);
&target) == ISC_R_SUCCESS);
&target) == ISC_R_SUCCESS);
}
}
unsigned int allowed;
isc_region_t r;
unsigned char plain1[] = "\003yyy\003foo";
unsigned char plain2[] = "\003bar\003yyy\003foo";
unsigned char plain3[] = "\003xxx\003bar\003foo";
unsigned char plain[] = "\003yyy\003foo\0\003bar\003yyy\003foo\0\003"
"bar\003yyy\003foo\0\003xxx\003bar\003foo";
dns_name_fromregion(&name1, &r);
dns_name_fromregion(&name2, &r);
dns_name_fromregion(&name3, &r);
/* Test 1: NONE */
dns_compress_rollback(&cctx, 0);
/* Test2: GLOBAL14 */
dns_compress_rollback(&cctx, 0);
/* Test3: ALL */
dns_compress_rollback(&cctx, 0);
/* Test4: NONE disabled */
dns_compress_rollback(&cctx, 0);
/* Test5: GLOBAL14 disabled */
dns_compress_rollback(&cctx, 0);
/* Test6: ALL disabled */
dns_compress_rollback(&cctx, 0);
dns_test_end();
}
#ifdef DNS_BENCHMARK_TESTS
/*
* XXXMUKS: Don't delete this code. It is useful in benchmarking the
* name parser, but we don't require it as part of the unit test runs.
*/
"Benchmark dns_name_fromwire() implementation");
}
static void *
fromwire_thread(void *arg) {
unsigned int maxval = 32000000;
3, 'w', 'w', 'w',
7, 'e', 'x', 'a', 'm', 'p', 'l', 'e',
7, 'i', 'n', 'v', 'a', 'l', 'i', 'd',
0
};
unsigned char output_data[DNS_NAME_MAXWIRE];
unsigned int i;
/* Parse 32 million names in each thread */
for (i = 0; i < maxval; i++) {
}
return (NULL);
}
unsigned int i;
double t;
unsigned int nthreads;
for (i = 0; i < nthreads; i++) {
}
for (i = 0; i < nthreads; i++) {
}
dns_test_end();
}
#endif /* DNS_BENCHMARK_TESTS */
/*
* Main
*/
ATF_TP_ADD_TCS(tp) {
#ifdef DNS_BENCHMARK_TESTS
#endif /* DNS_BENCHMARK_TESTS */
return (atf_no_error());
}