|
@@ -68,7 +68,7 @@ void big_gang_check(bool long_run)
|
|
|
|
|
|
for (i = 0; i < (long_run ? 1000 : 3); i++) {
|
|
for (i = 0; i < (long_run ? 1000 : 3); i++) {
|
|
__big_gang_check();
|
|
__big_gang_check();
|
|
- printf("%d ", i);
|
|
|
|
|
|
+ printv(2, "%d ", i);
|
|
fflush(stdout);
|
|
fflush(stdout);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -129,14 +129,19 @@ void check_copied_tags(struct radix_tree_root *tree, unsigned long start, unsign
|
|
putchar('.'); */
|
|
putchar('.'); */
|
|
if (idx[i] < start || idx[i] > end) {
|
|
if (idx[i] < start || idx[i] > end) {
|
|
if (item_tag_get(tree, idx[i], totag)) {
|
|
if (item_tag_get(tree, idx[i], totag)) {
|
|
- printf("%lu-%lu: %lu, tags %d-%d\n", start, end, idx[i], item_tag_get(tree, idx[i], fromtag), item_tag_get(tree, idx[i], totag));
|
|
|
|
|
|
+ printv(2, "%lu-%lu: %lu, tags %d-%d\n", start,
|
|
|
|
+ end, idx[i], item_tag_get(tree, idx[i],
|
|
|
|
+ fromtag),
|
|
|
|
+ item_tag_get(tree, idx[i], totag));
|
|
}
|
|
}
|
|
assert(!item_tag_get(tree, idx[i], totag));
|
|
assert(!item_tag_get(tree, idx[i], totag));
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
if (item_tag_get(tree, idx[i], fromtag) ^
|
|
if (item_tag_get(tree, idx[i], fromtag) ^
|
|
item_tag_get(tree, idx[i], totag)) {
|
|
item_tag_get(tree, idx[i], totag)) {
|
|
- printf("%lu-%lu: %lu, tags %d-%d\n", start, end, idx[i], item_tag_get(tree, idx[i], fromtag), item_tag_get(tree, idx[i], totag));
|
|
|
|
|
|
+ printv(2, "%lu-%lu: %lu, tags %d-%d\n", start, end,
|
|
|
|
+ idx[i], item_tag_get(tree, idx[i], fromtag),
|
|
|
|
+ item_tag_get(tree, idx[i], totag));
|
|
}
|
|
}
|
|
assert(!(item_tag_get(tree, idx[i], fromtag) ^
|
|
assert(!(item_tag_get(tree, idx[i], fromtag) ^
|
|
item_tag_get(tree, idx[i], totag)));
|
|
item_tag_get(tree, idx[i], totag)));
|
|
@@ -238,7 +243,7 @@ static void __locate_check(struct radix_tree_root *tree, unsigned long index,
|
|
item = item_lookup(tree, index);
|
|
item = item_lookup(tree, index);
|
|
index2 = find_item(tree, item);
|
|
index2 = find_item(tree, item);
|
|
if (index != index2) {
|
|
if (index != index2) {
|
|
- printf("index %ld order %d inserted; found %ld\n",
|
|
|
|
|
|
+ printv(2, "index %ld order %d inserted; found %ld\n",
|
|
index, order, index2);
|
|
index, order, index2);
|
|
abort();
|
|
abort();
|
|
}
|
|
}
|
|
@@ -289,48 +294,48 @@ static void single_thread_tests(bool long_run)
|
|
{
|
|
{
|
|
int i;
|
|
int i;
|
|
|
|
|
|
- printf("starting single_thread_tests: %d allocated, preempt %d\n",
|
|
|
|
|
|
+ printv(1, "starting single_thread_tests: %d allocated, preempt %d\n",
|
|
nr_allocated, preempt_count);
|
|
nr_allocated, preempt_count);
|
|
multiorder_checks();
|
|
multiorder_checks();
|
|
rcu_barrier();
|
|
rcu_barrier();
|
|
- printf("after multiorder_check: %d allocated, preempt %d\n",
|
|
|
|
|
|
+ printv(2, "after multiorder_check: %d allocated, preempt %d\n",
|
|
nr_allocated, preempt_count);
|
|
nr_allocated, preempt_count);
|
|
locate_check();
|
|
locate_check();
|
|
rcu_barrier();
|
|
rcu_barrier();
|
|
- printf("after locate_check: %d allocated, preempt %d\n",
|
|
|
|
|
|
+ printv(2, "after locate_check: %d allocated, preempt %d\n",
|
|
nr_allocated, preempt_count);
|
|
nr_allocated, preempt_count);
|
|
tag_check();
|
|
tag_check();
|
|
rcu_barrier();
|
|
rcu_barrier();
|
|
- printf("after tag_check: %d allocated, preempt %d\n",
|
|
|
|
|
|
+ printv(2, "after tag_check: %d allocated, preempt %d\n",
|
|
nr_allocated, preempt_count);
|
|
nr_allocated, preempt_count);
|
|
gang_check();
|
|
gang_check();
|
|
rcu_barrier();
|
|
rcu_barrier();
|
|
- printf("after gang_check: %d allocated, preempt %d\n",
|
|
|
|
|
|
+ printv(2, "after gang_check: %d allocated, preempt %d\n",
|
|
nr_allocated, preempt_count);
|
|
nr_allocated, preempt_count);
|
|
add_and_check();
|
|
add_and_check();
|
|
rcu_barrier();
|
|
rcu_barrier();
|
|
- printf("after add_and_check: %d allocated, preempt %d\n",
|
|
|
|
|
|
+ printv(2, "after add_and_check: %d allocated, preempt %d\n",
|
|
nr_allocated, preempt_count);
|
|
nr_allocated, preempt_count);
|
|
dynamic_height_check();
|
|
dynamic_height_check();
|
|
rcu_barrier();
|
|
rcu_barrier();
|
|
- printf("after dynamic_height_check: %d allocated, preempt %d\n",
|
|
|
|
|
|
+ printv(2, "after dynamic_height_check: %d allocated, preempt %d\n",
|
|
nr_allocated, preempt_count);
|
|
nr_allocated, preempt_count);
|
|
idr_checks();
|
|
idr_checks();
|
|
ida_checks();
|
|
ida_checks();
|
|
rcu_barrier();
|
|
rcu_barrier();
|
|
- printf("after idr_checks: %d allocated, preempt %d\n",
|
|
|
|
|
|
+ printv(2, "after idr_checks: %d allocated, preempt %d\n",
|
|
nr_allocated, preempt_count);
|
|
nr_allocated, preempt_count);
|
|
big_gang_check(long_run);
|
|
big_gang_check(long_run);
|
|
rcu_barrier();
|
|
rcu_barrier();
|
|
- printf("after big_gang_check: %d allocated, preempt %d\n",
|
|
|
|
|
|
+ printv(2, "after big_gang_check: %d allocated, preempt %d\n",
|
|
nr_allocated, preempt_count);
|
|
nr_allocated, preempt_count);
|
|
for (i = 0; i < (long_run ? 2000 : 3); i++) {
|
|
for (i = 0; i < (long_run ? 2000 : 3); i++) {
|
|
copy_tag_check();
|
|
copy_tag_check();
|
|
- printf("%d ", i);
|
|
|
|
|
|
+ printv(2, "%d ", i);
|
|
fflush(stdout);
|
|
fflush(stdout);
|
|
}
|
|
}
|
|
rcu_barrier();
|
|
rcu_barrier();
|
|
- printf("after copy_tag_check: %d allocated, preempt %d\n",
|
|
|
|
|
|
+ printv(2, "after copy_tag_check: %d allocated, preempt %d\n",
|
|
nr_allocated, preempt_count);
|
|
nr_allocated, preempt_count);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -340,16 +345,20 @@ int main(int argc, char **argv)
|
|
int opt;
|
|
int opt;
|
|
unsigned int seed = time(NULL);
|
|
unsigned int seed = time(NULL);
|
|
|
|
|
|
- while ((opt = getopt(argc, argv, "ls:")) != -1) {
|
|
|
|
|
|
+ while ((opt = getopt(argc, argv, "ls:v")) != -1) {
|
|
if (opt == 'l')
|
|
if (opt == 'l')
|
|
long_run = true;
|
|
long_run = true;
|
|
else if (opt == 's')
|
|
else if (opt == 's')
|
|
seed = strtoul(optarg, NULL, 0);
|
|
seed = strtoul(optarg, NULL, 0);
|
|
|
|
+ else if (opt == 'v')
|
|
|
|
+ test_verbose++;
|
|
}
|
|
}
|
|
|
|
|
|
printf("random seed %u\n", seed);
|
|
printf("random seed %u\n", seed);
|
|
srand(seed);
|
|
srand(seed);
|
|
|
|
|
|
|
|
+ printf("running tests\n");
|
|
|
|
+
|
|
rcu_register_thread();
|
|
rcu_register_thread();
|
|
radix_tree_init();
|
|
radix_tree_init();
|
|
|
|
|
|
@@ -366,9 +375,11 @@ int main(int argc, char **argv)
|
|
benchmark();
|
|
benchmark();
|
|
|
|
|
|
rcu_barrier();
|
|
rcu_barrier();
|
|
- printf("after rcu_barrier: %d allocated, preempt %d\n",
|
|
|
|
|
|
+ printv(2, "after rcu_barrier: %d allocated, preempt %d\n",
|
|
nr_allocated, preempt_count);
|
|
nr_allocated, preempt_count);
|
|
rcu_unregister_thread();
|
|
rcu_unregister_thread();
|
|
|
|
|
|
|
|
+ printf("tests completed\n");
|
|
|
|
+
|
|
exit(0);
|
|
exit(0);
|
|
}
|
|
}
|