name_test.c revision 574176a88d7fc412312e11a274d74cd2f122a0f4
/*
* Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $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();
}
}
size_t i;
struct {
const char *name;
} data[] = {
{ ".", ISC_FALSE },
{ "_ta-", ISC_FALSE },
{ "_ta-1234", ISC_TRUE },
{ "_TA-1234", ISC_TRUE },
{ "+TA-1234", ISC_FALSE },
{ "_fa-1234", ISC_FALSE },
{ "_td-1234", ISC_FALSE },
{ "_ta_1234", ISC_FALSE },
{ "_ta-g234", ISC_FALSE },
{ "_ta-1h34", ISC_FALSE },
{ "_ta-12i4", ISC_FALSE },
{ "_ta-123j", ISC_FALSE },
{ "_ta-1234-abcf", ISC_TRUE },
{ "_ta-1234-abcf-ED89", ISC_TRUE },
{ "_ta-12345-abcf-ED89", ISC_FALSE },
{ "_ta-.example", ISC_FALSE },
{ "_ta-1234.example", ISC_TRUE },
{ "_ta-1234-abcf.example", ISC_TRUE },
{ "_ta-1234-abcf-ED89.example", ISC_TRUE },
{ "_ta-12345-abcf-ED89.example", ISC_FALSE },
{ "_ta-1234-abcfe-ED89.example", ISC_FALSE },
{ "_ta-1234-abcf-EcD89.example", ISC_FALSE }
};
}
}
#ifdef ISC_PLATFORM_USETHREADS
#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;
isc_uint8_t data[] = {
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 */
#endif /* ISC_PLATFORM_USETHREADS */
/*
* Main
*/
ATF_TP_ADD_TCS(tp) {
#ifdef ISC_PLATFORM_USETHREADS
#ifdef DNS_BENCHMARK_TESTS
#endif /* DNS_BENCHMARK_TESTS */
#endif /* ISC_PLATFORM_USETHREADS */
return (atf_no_error());
}