Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 938c6f4

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 d6ec3d2 commit 938c6f4

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
@@ -1717,14 +1717,11 @@ run_schedule(const char *schedule, test_function tfunc)
17171717
*/
17181718
for (rl = resultfiles[i], el = expectfiles[i], tl = tags[i];
17191719
rl != NULL; /* rl and el have the same length */
1720-
rl = rl->next, el = el->next)
1720+
rl = rl->next, el = el->next,
1721+
tl = tl ? tl->next : NULL)
17211722
{
17221723
bool newdiff;
17231724

1724-
if (tl)
1725-
tl = tl->next; /* tl has the same length as rl and el
1726-
* if it exists */
1727-
17281725
newdiff = results_differ(tests[i], rl->str, el->str);
17291726
if (newdiff && tl)
17301727
{
@@ -1804,14 +1801,11 @@ run_single_test(const char *test, test_function tfunc)
18041801
*/
18051802
for (rl = resultfiles, el = expectfiles, tl = tags;
18061803
rl != NULL; /* rl and el have the same length */
1807-
rl = rl->next, el = el->next)
1804+
rl = rl->next, el = el->next,
1805+
tl = tl ? tl->next : NULL)
18081806
{
18091807
bool newdiff;
18101808

1811-
if (tl)
1812-
tl = tl->next; /* tl has the same length as rl and el if it
1813-
* exists */
1814-
18151809
newdiff = results_differ(test, rl->str, el->str);
18161810
if (newdiff && tl)
18171811
{

0 commit comments

Comments
 (0)