mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +00:00
shorten ht_test and random_test
This commit is contained in:
@@ -298,12 +298,12 @@ static void test_ht_iterator() {
|
|||||||
|
|
||||||
ATF_TC(isc_ht_20);
|
ATF_TC(isc_ht_20);
|
||||||
ATF_TC_HEAD(isc_ht_20, tc) {
|
ATF_TC_HEAD(isc_ht_20, tc) {
|
||||||
atf_tc_set_md_var(tc, "descr", "20 bit, 2M elements test");
|
atf_tc_set_md_var(tc, "descr", "20 bit, 200K elements test");
|
||||||
}
|
}
|
||||||
|
|
||||||
ATF_TC_BODY(isc_ht_20, tc) {
|
ATF_TC_BODY(isc_ht_20, tc) {
|
||||||
UNUSED(tc);
|
UNUSED(tc);
|
||||||
test_ht_full(20, 2000000);
|
test_ht_full(20, 200000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -9,6 +9,13 @@
|
|||||||
* information regarding copyright ownership.
|
* information regarding copyright ownership.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IMPORTANT NOTE:
|
||||||
|
* These tests work by generating a large number of pseudo-random numbers
|
||||||
|
* and then statistically analyzing them to determine whether they seem
|
||||||
|
* random. The test is expected to fail on occasion by random happenstance.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <isc/random.h>
|
#include <isc/random.h>
|
||||||
@@ -23,6 +30,8 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#define REPS 25000
|
||||||
|
|
||||||
typedef double (pvalue_func_t)(isc_mem_t *mctx,
|
typedef double (pvalue_func_t)(isc_mem_t *mctx,
|
||||||
isc_uint16_t *values, size_t length);
|
isc_uint16_t *values, size_t length);
|
||||||
|
|
||||||
@@ -272,18 +281,18 @@ random_test(pvalue_func_t *func, isc_boolean_t word_sized) {
|
|||||||
|
|
||||||
for (j = 0; j < m; j++) {
|
for (j = 0; j < m; j++) {
|
||||||
isc_uint32_t i;
|
isc_uint32_t i;
|
||||||
isc_uint16_t values[128000];
|
isc_uint16_t values[REPS];
|
||||||
double p_value;
|
double p_value;
|
||||||
|
|
||||||
if (word_sized) {
|
if (word_sized) {
|
||||||
for (i = 0; i < 128000; i++)
|
for (i = 0; i < REPS; i++)
|
||||||
isc_rng_randombytes(rng, &values[i],
|
isc_rng_randombytes(rng, &values[i],
|
||||||
sizeof(values[i]));
|
sizeof(values[i]));
|
||||||
} else {
|
} else {
|
||||||
isc_rng_randombytes(rng, values, sizeof(values));
|
isc_rng_randombytes(rng, values, sizeof(values));
|
||||||
}
|
}
|
||||||
|
|
||||||
p_value = (*func)(mctx, values, 128000);
|
p_value = (*func)(mctx, values, REPS);
|
||||||
if (p_value >= 0.01)
|
if (p_value >= 0.01)
|
||||||
passed++;
|
passed++;
|
||||||
|
|
||||||
@@ -402,7 +411,7 @@ runs(isc_mem_t *mctx, isc_uint16_t *values, size_t length) {
|
|||||||
numbits = length * 16;
|
numbits = length * 16;
|
||||||
bcount = 0;
|
bcount = 0;
|
||||||
|
|
||||||
for (i = 0; i < 128000; i++)
|
for (i = 0; i < REPS; i++)
|
||||||
bcount += bitcounts_table[values[i]];
|
bcount += bitcounts_table[values[i]];
|
||||||
|
|
||||||
/* Debug message, not displayed when running via atf-run */
|
/* Debug message, not displayed when running via atf-run */
|
||||||
|
Reference in New Issue
Block a user