summaryrefslogtreecommitdiff
path: root/regress/lib
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2017-05-17 21:40:14 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2017-05-17 21:40:14 +0000
commitea8af568cfb78ffcffa5f9710cca3d937c5f7b81 (patch)
tree0b6984447671557edb0ca58f9ffdec285b5b415e /regress/lib
parent721d021ec418ae0679adee93da132d7605de127a (diff)
Avoid running the "killer" tests multiple times with the same
parameters.
Diffstat (limited to 'regress/lib')
-rw-r--r--regress/lib/libc/qsort/qsort_test.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/regress/lib/libc/qsort/qsort_test.c b/regress/lib/libc/qsort/qsort_test.c
index 221770e0ac2..b1e1a25c92e 100644
--- a/regress/lib/libc/qsort/qsort_test.c
+++ b/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)
}
static int
-run_tests(int m, int n)
+run_tests(int n)
{
int *x, *y, *z;
- int ret = 0;
+ int m, ret = 0;
int idx, nlgn = 0;
enum distribution dist;
@@ -281,8 +281,20 @@ run_tests(int m, int n)
err(1, NULL);
for (dist = SAWTOOTH; dist != INVALID; dist++) {
- if (test_distribution(dist, m, n, x, y, z) != 0)
- ret = 1;
+ switch (dist) {
+ case BSD_KILLER:
+ case MED3_KILLER:
+ /* 'm' not used. */
+ if (test_distribution(dist, 0, n, x, y, z) != 0)
+ ret = 1;
+ break;
+ default:
+ for (m = 1; m < 2 * n; m *= 2) {
+ if (test_distribution(dist, m, n, x, y, z) != 0)
+ ret = 1;
+ }
+ break;
+ }
}
free(x);
@@ -295,14 +307,11 @@ int
main(int argc, char *argv[])
{
int *nn, nums[] = { 100, 1023, 1024, 1025, 4095, 4096, 4097, -1 };
- int m, n;
- int ret = 0;
+ int n, ret = 0;
for (nn = nums; (n = *nn) > 0; nn++) {
- for (m = 1; m < 2 * n; m *= 2) {
- if (run_tests(m, n) != 0)
- ret = 1;
- }
+ if (run_tests(n) != 0)
+ ret = 1;
}
return ret;