From: Tom Lane Date: Mon, 30 Apr 2018 01:56:28 +0000 (-0400) Subject: Fix bogus list-iteration code in pg_regress.c, affecting ecpg tests only. X-Git-Tag: REL9_3_23~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3f91c4005f3dd55b8653ebc220861d5497a8d4d8;p=thirdparty%2Fpostgresql.git Fix bogus list-iteration code in pg_regress.c, affecting ecpg tests only. While looking at a recent buildfarm failure in the ecpg tests, I wondered why the pg_regress output claimed the stderr part of the test failed, when the regression diffs were clearly for the stdout part. Looking into it, the reason is that pg_regress.c's logic for iterating over three parallel lists is wrong, and has been wrong since it was written: it advances the "tag" pointer at a different place in the loop than the other two pointers. Fix that. --- diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index b5c604b2a39..f1111d92476 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -1885,14 +1885,11 @@ run_schedule(const char *schedule, test_function tfunc) */ for (rl = resultfiles[i], el = expectfiles[i], tl = tags[i]; rl != NULL; /* rl and el have the same length */ - rl = rl->next, el = el->next) + rl = rl->next, el = el->next, + tl = tl ? tl->next : NULL) { bool newdiff; - if (tl) - tl = tl->next; /* tl has the same length as rl and el - * if it exists */ - newdiff = results_differ(tests[i], rl->str, el->str); if (newdiff && tl) { @@ -1970,14 +1967,11 @@ run_single_test(const char *test, test_function tfunc) */ for (rl = resultfiles, el = expectfiles, tl = tags; rl != NULL; /* rl and el have the same length */ - rl = rl->next, el = el->next) + rl = rl->next, el = el->next, + tl = tl ? tl->next : NULL) { bool newdiff; - if (tl) - tl = tl->next; /* tl has the same length as rl and el if it - * exists */ - newdiff = results_differ(test, rl->str, el->str); if (newdiff && tl) {