diff options
| author | millert <> | 2017-05-17 21:40:13 +0000 |
|---|---|---|
| committer | millert <> | 2017-05-17 21:40:13 +0000 |
| commit | 925427598d664573ecb8e8f20b14f5ff10f0f534 (patch) | |
| tree | d2838940bc0527214804e928f3a8c7a7e878f065 /src | |
| parent | 0bbcaddbe494193e0624899bc6fc248cb71da1b6 (diff) | |
| download | openbsd-925427598d664573ecb8e8f20b14f5ff10f0f534.tar.gz openbsd-925427598d664573ecb8e8f20b14f5ff10f0f534.tar.bz2 openbsd-925427598d664573ecb8e8f20b14f5ff10f0f534.zip | |
Avoid running the "killer" tests multiple times with the same
parameters.
Diffstat (limited to 'src')
| -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; |
