idr test suite: Fix ida_test_random()
authorMatthew Wilcox <mawilcox@microsoft.com>
Fri, 10 Nov 2017 01:15:14 +0000 (20:15 -0500)
committerMatthew Wilcox <mawilcox@microsoft.com>
Tue, 6 Feb 2018 20:07:20 +0000 (15:07 -0500)
The test was checking the wrong errno; ida_get_new_above() returns
EAGAIN, not ENOMEM on memory allocation failure.  Double the number of
threads to increase the chance that we actually exercise this path
during the test suite (it was a bit sporadic before).

Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
tools/testing/radix-tree/idr-test.c

index 30cd0b296f1a76847122f009c2cd0f2d5b9109f4..193450b29bf01473386e30fa4ff4f8ec2136bf39 100644 (file)
@@ -380,7 +380,7 @@ void ida_check_random(void)
                        do {
                                ida_pre_get(&ida, GFP_KERNEL);
                                err = ida_get_new_above(&ida, bit, &id);
-                       } while (err == -ENOMEM);
+                       } while (err == -EAGAIN);
                        assert(!err);
                        assert(id == bit);
                }
@@ -489,7 +489,7 @@ static void *ida_random_fn(void *arg)
 
 void ida_thread_tests(void)
 {
-       pthread_t threads[10];
+       pthread_t threads[20];
        int i;
 
        for (i = 0; i < ARRAY_SIZE(threads); i++)