projects
/
userspace-rcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rculfhash tests: add missing check
[userspace-rcu.git]
/
tests
/
test_urcu_hash.c
diff --git
a/tests/test_urcu_hash.c
b/tests/test_urcu_hash.c
index be632ee70a178e7573a47fffa835bfd5a23d06e0..2223413c8067506ba1441ea91b3298da0340c2e2 100644
(file)
--- a/
tests/test_urcu_hash.c
+++ b/
tests/test_urcu_hash.c
@@
-25,6
+25,7
@@
enum test_hash {
TEST_HASH_RW,
enum test_hash {
TEST_HASH_RW,
+ TEST_HASH_UNIQUE,
};
struct test_hash_cb {
};
struct test_hash_cb {
@@
-44,6
+45,14
@@
struct test_hash_cb test_hash_cb[] = {
test_hash_rw_thr_writer,
test_hash_rw_populate_hash,
},
test_hash_rw_thr_writer,
test_hash_rw_populate_hash,
},
+ [TEST_HASH_UNIQUE] = {
+ test_hash_unique_sigusr1_handler,
+ test_hash_unique_sigusr2_handler,
+ test_hash_unique_thr_reader,
+ test_hash_unique_thr_writer,
+ test_hash_unique_populate_hash,
+ },
+
};
static enum test_hash test_choice = TEST_HASH_RW;
};
static enum test_hash test_choice = TEST_HASH_RW;
@@
-105,6
+114,7
@@
unsigned long init_pool_size = DEFAULT_RAND_POOL,
lookup_pool_size = DEFAULT_RAND_POOL,
write_pool_size = DEFAULT_RAND_POOL;
int validate_lookup;
lookup_pool_size = DEFAULT_RAND_POOL,
write_pool_size = DEFAULT_RAND_POOL;
int validate_lookup;
+unsigned long nr_hash_chains; /* 0: normal table, other: number of hash chains */
int count_pipe[2];
int count_pipe[2];
@@
-280,6
+290,8
@@
printf(" [not -u nor -s] Add entries (supports redundant keys).\n");
printf(" [-N size] Write pool size.\n");
printf(" [-O size] Init pool size.\n");
printf(" [-V] Validate lookups of init values (use with filled init pool, same lookup range, with different write range).\n");
printf(" [-N size] Write pool size.\n");
printf(" [-O size] Init pool size.\n");
printf(" [-V] Validate lookups of init values (use with filled init pool, same lookup range, with different write range).\n");
+ printf(" [-U] Uniqueness test.\n");
+ printf(" [-C] Number of hash chains.\n");
printf("\n\n");
}
printf("\n\n");
}
@@
-443,7
+455,12
@@
int main(int argc, char **argv)
case 'V':
validate_lookup = 1;
break;
case 'V':
validate_lookup = 1;
break;
-
+ case 'U':
+ test_choice = TEST_HASH_UNIQUE;
+ break;
+ case 'C':
+ nr_hash_chains = atol(argv[++i]);
+ break;
}
}
}
}
@@
-516,6
+533,8
@@
int main(int argc, char **argv)
lookup_pool_offset, lookup_pool_size);
printf_verbose("Update pool size offset %lu size %lu.\n",
write_pool_offset, write_pool_size);
lookup_pool_offset, lookup_pool_size);
printf_verbose("Update pool size offset %lu size %lu.\n",
write_pool_offset, write_pool_size);
+ printf_verbose("Number of hash chains: %lu.\n",
+ nr_hash_chains);
printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
"main", pthread_self(), (unsigned long)gettid());
printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
"main", pthread_self(), (unsigned long)gettid());
@@
-541,6
+560,10
@@
int main(int argc, char **argv)
(opt_auto_resize ? CDS_LFHT_AUTO_RESIZE : 0) |
CDS_LFHT_ACCOUNTING, NULL);
}
(opt_auto_resize ? CDS_LFHT_AUTO_RESIZE : 0) |
CDS_LFHT_ACCOUNTING, NULL);
}
+ if (!test_ht) {
+ printf("Error allocating hash table.\n");
+ return -1;
+ }
/*
* Hash Population needs to be seen as a RCU reader
/*
* Hash Population needs to be seen as a RCU reader
This page took
0.024384 seconds
and
4
git commands to generate.