diff options
-rw-r--r-- | src/regress/lib/libc/qsort/qsort_test.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/regress/lib/libc/qsort/qsort_test.c b/src/regress/lib/libc/qsort/qsort_test.c index 221770e0ac..b1e1a25c92 100644 --- a/src/regress/lib/libc/qsort/qsort_test.c +++ b/src/regress/lib/libc/qsort/qsort_test.c | |||
@@ -256,10 +256,10 @@ test_distribution(int dist, int m, int n, int *x, int *y, int *z) | |||
256 | } | 256 | } |
257 | 257 | ||
258 | static int | 258 | static int |
259 | run_tests(int m, int n) | 259 | run_tests(int n) |
260 | { | 260 | { |
261 | int *x, *y, *z; | 261 | int *x, *y, *z; |
262 | int ret = 0; | 262 | int m, ret = 0; |
263 | int idx, nlgn = 0; | 263 | int idx, nlgn = 0; |
264 | enum distribution dist; | 264 | enum distribution dist; |
265 | 265 | ||
@@ -281,8 +281,20 @@ run_tests(int m, int n) | |||
281 | err(1, NULL); | 281 | err(1, NULL); |
282 | 282 | ||
283 | for (dist = SAWTOOTH; dist != INVALID; dist++) { | 283 | for (dist = SAWTOOTH; dist != INVALID; dist++) { |
284 | if (test_distribution(dist, m, n, x, y, z) != 0) | 284 | switch (dist) { |
285 | ret = 1; | 285 | case BSD_KILLER: |
286 | case MED3_KILLER: | ||
287 | /* 'm' not used. */ | ||
288 | if (test_distribution(dist, 0, n, x, y, z) != 0) | ||
289 | ret = 1; | ||
290 | break; | ||
291 | default: | ||
292 | for (m = 1; m < 2 * n; m *= 2) { | ||
293 | if (test_distribution(dist, m, n, x, y, z) != 0) | ||
294 | ret = 1; | ||
295 | } | ||
296 | break; | ||
297 | } | ||
286 | } | 298 | } |
287 | 299 | ||
288 | free(x); | 300 | free(x); |
@@ -295,14 +307,11 @@ int | |||
295 | main(int argc, char *argv[]) | 307 | main(int argc, char *argv[]) |
296 | { | 308 | { |
297 | int *nn, nums[] = { 100, 1023, 1024, 1025, 4095, 4096, 4097, -1 }; | 309 | int *nn, nums[] = { 100, 1023, 1024, 1025, 4095, 4096, 4097, -1 }; |
298 | int m, n; | 310 | int n, ret = 0; |
299 | int ret = 0; | ||
300 | 311 | ||
301 | for (nn = nums; (n = *nn) > 0; nn++) { | 312 | for (nn = nums; (n = *nn) > 0; nn++) { |
302 | for (m = 1; m < 2 * n; m *= 2) { | 313 | if (run_tests(n) != 0) |
303 | if (run_tests(m, n) != 0) | 314 | ret = 1; |
304 | ret = 1; | ||
305 | } | ||
306 | } | 315 | } |
307 | 316 | ||
308 | return ret; | 317 | return ret; |