Lines Matching defs:test

3  * maple_tree.c: Userspace testing for maple tree test-suite
14 #include "test.h"
29 #define RCU_MT_BUG_ON(test, y) {if (y) { test->stop = true; } MT_BUG_ON(test->mt, y); }
62 struct rcu_test_struct2 *test;
698 /* Shrinking tree test. */
34153 /* This test found issues with retry moving rebalanced nodes so the
34165 /* This test found issues with deleting all entries in a node when
34178 /* This test found an issue with deleting all entries in a node that was
34321 static void rcu_reader_register(struct rcu_test_struct2 *test)
34324 uatomic_inc(&test->thread_count);
34326 while (!test->start)
34327 usleep(test->pause * 100);
34331 unsigned int id, struct rcu_test_struct2 *test)
34334 reader->test = test;
34346 struct rcu_test_struct2 *test = reader->test;
34351 MA_STATE(mas, test->mt, 0, 0);
34353 rcu_reader_register(test);
34356 while (!test->stop) {
34360 mas_set(&mas, test->index[index]);
34361 mas_for_each(&mas, entry, test->last[index + 9]) {
34365 r_start = test->index[index + i];
34366 r_end = test->last[index + i];
34371 alt_start = test->index[index + reader->flip];
34374 uatomic_inc(&test->seen_deleted);
34380 r_start = test->index[index + i];
34381 r_end = test->last[index + i];
34387 alt_start = test->index[index + reader->next];
34389 uatomic_inc(&test->seen_added);
34393 r_start = test->index[index + i];
34394 r_end = test->last[index + i];
34399 RCU_MT_BUG_ON(test, mas.index != r_start);
34400 RCU_MT_BUG_ON(test, mas.last != r_end);
34406 uatomic_inc(&test->seen_toggle);
34408 uatomic_inc(&test->seen_toggle);
34417 RCU_MT_BUG_ON(test, 1);
34426 uatomic_inc(&test->seen_modified);
34430 uatomic_inc(&test->seen_modified);
34435 RCU_MT_BUG_ON(test, entry != alt);
34440 RCU_MT_BUG_ON(test, entry != expected);
34446 usleep(test->pause);
34456 struct rcu_test_struct2 *test = reader->test;
34461 MA_STATE(mas, test->mt, 0, 0);
34463 rcu_reader_register(test);
34467 while (!test->stop) {
34471 mas_set(&mas, test->index[index + i]);
34479 entry = mas_prev(&mas, test->index[index]);
34480 r_start = test->index[index + i];
34481 r_end = test->last[index + i];
34485 alt_start = test->index[index + reader->mod];
34489 uatomic_inc(&test->seen_deleted);
34495 r_start = test->index[index + i];
34496 r_end = test->last[index + i];
34501 alt_start = test->index[index + reader->flip];
34504 uatomic_inc(&test->seen_added);
34509 r_start = test->index[index + i];
34510 r_end = test->last[index + i];
34523 mt_dump(test->mt, mt_dump_dec);
34529 RCU_MT_BUG_ON(test, mas.index != r_start);
34530 RCU_MT_BUG_ON(test, mas.last != r_end);
34538 uatomic_inc(&test->seen_modified);
34542 uatomic_inc(&test->seen_modified);
34546 RCU_MT_BUG_ON(test, entry != alt);
34554 uatomic_inc(&test->seen_toggle);
34556 uatomic_inc(&test->seen_toggle);
34567 RCU_MT_BUG_ON(test, 1);
34575 RCU_MT_BUG_ON(test, entry != expected);
34579 usleep(test->pause);
34586 static void rcu_stress_rev(struct maple_tree *mt, struct rcu_test_struct2 *test,
34592 test->start = true; /* Release the hounds! */
34604 start = test->index[this->id + this->mod];
34605 end = test->last[this->id + this->mod];
34614 start = test->index[this->id + this->flip];
34615 end = test->last[this->id + this->flip];
34625 start = test->index[this->id + this->del];
34626 end = test->last[this->id + this->del];
34632 start = test->index[this->id + this->add];
34633 end = test->last[this->id + this->add];
34638 usleep(test->pause);
34639 /* If a test fails, don't flood the console */
34640 if (test->stop)
34645 static void rcu_stress_fwd(struct maple_tree *mt, struct rcu_test_struct2 *test,
34651 test->start = true; /* Release the hounds! */
34661 start = test->index[this->id + this->mod];
34662 end = test->last[this->id + this->mod];
34671 start = test->index[this->id + this->flip];
34672 end = test->last[this->id + this->flip];
34682 start = test->index[this->id + this->del];
34683 end = test->last[this->id + this->del];
34689 start = test->index[this->id + this->add];
34690 end = test->last[this->id + this->add];
34695 usleep(test->pause);
34696 /* If a test fails, don't flood the console */
34697 if (test->stop)
34718 struct rcu_test_struct2 test;
34723 test.mt = mt;
34724 test.pause = 5;
34725 test.seen_toggle = 0;
34726 test.seen_deleted = 0;
34727 test.seen_added = 0;
34728 test.seen_modified = 0;
34729 test.thread_count = 0;
34730 test.start = test.stop = false;
34739 test.index[i] = seed;
34740 test.last[i] = r;
34754 rcu_reader_setup(&test_reader[i], id, &test);
34767 mtree_store_range(mt, test.index[add], test.last[add],
34774 } while (test.thread_count > ARRAY_SIZE(readers));
34777 rcu_stress_fwd(mt, &test, count, test_reader);
34779 rcu_stress_rev(mt, &test, count, test_reader);
34781 test.stop = true;
34819 int eval_rcu_entry(struct rcu_test_struct *test, void *entry, bool *update_2,
34822 if (entry == test->entry1)
34825 if (entry == test->entry2) {
34827 uatomic_inc(&test->seen_entry2);
34830 uatomic_inc(&test->seen_both);
34835 if (entry == test->entry3) {
34837 uatomic_inc(&test->seen_entry3);
34840 uatomic_inc(&test->seen_both);
34849 * rcu_val() - Read a given value in the tree test->count times using the
34856 struct rcu_test_struct *test = (struct rcu_test_struct *)ptr;
34857 unsigned long count = test->count;
34864 usleep(test->val_sleep);
34869 entry = mtree_load(test->mt, test->index);
34870 MT_BUG_ON(test->mt, eval_rcu_entry(test, entry, &update_2,
34885 struct rcu_test_struct *test = (struct rcu_test_struct *)ptr;
34886 unsigned long count = test->count;
34890 MA_STATE(mas, test->mt, test->range_start, test->range_start);
34895 * Loop through the test->range_start - test->range_end test->count
34899 usleep(test->loop_sleep);
34901 mas_for_each(&mas, entry, test->range_end) {
34906 if (mas.index < test->index || mas.index > test->last) {
34911 MT_BUG_ON(test->mt, entry != expected);
34919 MT_BUG_ON(test->mt, eval_rcu_entry(test, entry,
34924 mas_set(&mas, test->range_start);
34960 /* Make sure the test caught at least one update. */
34966 struct rcu_test_struct3 *test = ptr;
34967 MA_STATE(mas, test->mt, test->index, test->index);
34972 while (!test->stop) {
34975 RCU_MT_BUG_ON(test, (test->index - mas.index) !=
34976 (mas.last - test->last));
34989 struct rcu_test_struct3 test = {.stop = false, .mt = mt};
34993 test.index = start;
34994 test.last = end;
35006 &test)) {
35020 test.stop = true;
35065 /* Make sure the test caught at least one update. */
35295 /* Slow reader test with spanning store. */
35439 * pr_info(" ->seq test of 0-%lu %luK in %d active (%d total)\n",
35829 * userspace test suite.