Consider a failed process as a failed test in pg_regress
authorDaniel Gustafsson <dgustafsson@postgresql.org>
Thu, 23 Feb 2023 08:25:47 +0000 (09:25 +0100)
committerDaniel Gustafsson <dgustafsson@postgresql.org>
Thu, 23 Feb 2023 08:25:47 +0000 (09:25 +0100)
Commit 55de145d1cf added reporting of child process failures, but the
test suite is still allowed to pass even if the process failed. Since
regress tests are higher level tests, a false positive is more likely
in this case so report failed test processes as failed tests.

Reported-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/82C46B5E-1821-4039-82C2-56BCA5992989@yesql.se
Discussion: https://postgr.es/m/20221122235636.4frx7hjterq6bmls@awork3.anarazel.de

src/test/regress/pg_regress.c

index 6cd5998b9d7610b30e10c578f85eda10495950d9..7b23cc80dcd6b0bab355f33068cb234007f5db1b 100644 (file)
@@ -1697,19 +1697,26 @@ run_schedule(const char *schedule, test_start_function startfunc,
                differ |= newdiff;
            }
 
-           if (differ)
+           if (statuses[i] != 0)
            {
                status(_("FAILED"));
+               log_child_failure(statuses[i]);
                fail_count++;
            }
            else
            {
-               status(_("ok    "));    /* align with FAILED */
-               success_count++;
-           }
 
-           if (statuses[i] != 0)
-               log_child_failure(statuses[i]);
+               if (differ)
+               {
+                   status(_("FAILED"));
+                   fail_count++;
+               }
+               else
+               {
+                   status(_("ok    "));    /* align with FAILED */
+                   success_count++;
+               }
+           }
 
            INSTR_TIME_SUBTRACT(stoptimes[i], starttimes[i]);
            status(_(" %8.0f ms"), INSTR_TIME_GET_MILLISEC(stoptimes[i]));
@@ -1778,20 +1785,26 @@ run_single_test(const char *test, test_start_function startfunc,
        differ |= newdiff;
    }
 
-   if (differ)
+   if (exit_status != 0)
    {
        status(_("FAILED"));
        fail_count++;
+       log_child_failure(exit_status);
    }
    else
    {
-       status(_("ok    "));    /* align with FAILED */
-       success_count++;
+       if (differ)
+       {
+           status(_("FAILED"));
+           fail_count++;
+       }
+       else
+       {
+           status(_("ok    "));    /* align with FAILED */
+           success_count++;
+       }
    }
 
-   if (exit_status != 0)
-       log_child_failure(exit_status);
-
    INSTR_TIME_SUBTRACT(stoptime, starttime);
    status(_(" %8.0f ms"), INSTR_TIME_GET_MILLISEC(stoptime));