summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormillert <>2017-05-17 21:40:13 +0000
committermillert <>2017-05-17 21:40:13 +0000
commit676818f5d9d7309fc3c3c923183eb05b15da3018 (patch)
treed2838940bc0527214804e928f3a8c7a7e878f065
parent457dcb49fe6cb750035fe9019ac04e9d8d04a794 (diff)
downloadopenbsd-676818f5d9d7309fc3c3c923183eb05b15da3018.tar.gz
openbsd-676818f5d9d7309fc3c3c923183eb05b15da3018.tar.bz2
openbsd-676818f5d9d7309fc3c3c923183eb05b15da3018.zip
Avoid running the "killer" tests multiple times with the same
parameters.
-rw-r--r--src/regress/lib/libc/qsort/qsort_test.c29
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
258static int 258static int
259run_tests(int m, int n) 259run_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
295main(int argc, char *argv[]) 307main(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;