Skip to content

Commit c5e46c7

Browse files
committed
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.
1 parent eb16011 commit c5e46c7

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/test/regress/pg_regress.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,14 +1752,11 @@ run_schedule(const char *schedule, test_function tfunc)
17521752
*/
17531753
for (rl = resultfiles[i], el = expectfiles[i], tl = tags[i];
17541754
rl != NULL; /* rl and el have the same length */
1755-
rl = rl->next, el = el->next)
1755+
rl = rl->next, el = el->next,
1756+
tl = tl ? tl->next : NULL)
17561757
{
17571758
bool newdiff;
17581759

1759-
if (tl)
1760-
tl = tl->next; /* tl has the same length as rl and el if
1761-
* it exists */
1762-
17631760
newdiff = results_differ(tests[i], rl->str, el->str);
17641761
if (newdiff && tl)
17651762
{
@@ -1848,14 +1845,11 @@ run_single_test(const char *test, test_function tfunc)
18481845
*/
18491846
for (rl = resultfiles, el = expectfiles, tl = tags;
18501847
rl != NULL; /* rl and el have the same length */
1851-
rl = rl->next, el = el->next)
1848+
rl = rl->next, el = el->next,
1849+
tl = tl ? tl->next : NULL)
18521850
{
18531851
bool newdiff;
18541852

1855-
if (tl)
1856-
tl = tl->next; /* tl has the same length as rl and el if it
1857-
* exists */
1858-
18591853
newdiff = results_differ(test, rl->str, el->str);
18601854
if (newdiff && tl)
18611855
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy