pg_regress: Treat child process failure as test failure
In the thread about TAP format out in pg_regress, Andres pointed out [0]/messages/by-id/20221122235636.4frx7hjterq6bmls@awork3.anarazel.de that
we allow a test to pass even if the test child process failed. While its
probably pretty rare to have a test pass if the process failed, this brings a
risk for false positives (and it seems questionable that any regress test will
have a child process failing as part of its intended run).
The attached makes child failures an error condition for the test as a belts
and suspenders type check. Thoughts?
--
Daniel Gustafsson https://vmware.com/
[0]: /messages/by-id/20221122235636.4frx7hjterq6bmls@awork3.anarazel.de
Attachments:
v1-0001-Consider-a-failed-test-process-as-a-failed-test.patchapplication/octet-stream; name=v1-0001-Consider-a-failed-test-process-as-a-failed-test.patch; x-unix-mode=0644Download+2-3
Hi,
On 2022-11-26 21:11:39 +0100, Daniel Gustafsson wrote:
In the thread about TAP format out in pg_regress, Andres pointed out [0] that
we allow a test to pass even if the test child process failed. While its
probably pretty rare to have a test pass if the process failed, this brings a
risk for false positives (and it seems questionable that any regress test will
have a child process failing as part of its intended run).
The attached makes child failures an error condition for the test as a belts
and suspenders type check. Thoughts?
I wonder if it's the right thing to treat a failed psql that's then also
ignored as "failed (ignored)". Perhaps it'd be better to move the statuses[i]
!= 0 check to before the if (differ)?
- if (differ)
+ if (differ || statuses[i] != 0)
{
bool ignore = false;
_stringlist *sl;
@@ -1815,7 +1815,7 @@ run_single_test(const char *test, test_start_function startfunc,
differ |= newdiff;
}- if (differ)
+ if (differ || exit_status != 0)
{
status(_("FAILED"));
fail_count++;
It certainly is a bit confusing that we print a psql failure separately from
the if "FAILED" vs "ok" bit.
Greetings,
Andres Freund
On 26 Nov 2022, at 21:55, Andres Freund <andres@anarazel.de> wrote:
On 2022-11-26 21:11:39 +0100, Daniel Gustafsson wrote:
The attached makes child failures an error condition for the test as a belts
and suspenders type check. Thoughts?I wonder if it's the right thing to treat a failed psql that's then also
ignored as "failed (ignored)". Perhaps it'd be better to move the statuses[i]
!= 0 check to before the if (differ)?
I was thinking about that too, but I think you're right. The "ignore" part is
about the test content and not the test run structure.
It certainly is a bit confusing that we print a psql failure separately from
the if "FAILED" vs "ok" bit.
I've moved the statuses[i] check before the differ check, such that there is a
separate block for this not mixed up with the differs check and printing. It
does duplicate things a little bit but also makes it a lot clearer.
--
Daniel Gustafsson https://vmware.com/
Attachments:
v2-0001-Consider-a-failed-test-process-as-a-failed-test.patchapplication/octet-stream; name=v2-0001-Consider-a-failed-test-process-as-a-failed-test.patch; x-unix-mode=0644Download+45-30
On 26 Nov 2022, at 22:46, Daniel Gustafsson <daniel@yesql.se> wrote:
I've moved the statuses[i] check before the differ check, such that there is a
separate block for this not mixed up with the differs check and printing.
Rebased patch to handle breakage of v2 due to bd8d453e9b.
--
Daniel Gustafsson
Attachments:
v3-0001-pg_regress-Consider-a-failed-test-process-as-a-fa.patchapplication/octet-stream; name=v3-0001-pg_regress-Consider-a-failed-test-process-as-a-fa.patch; x-unix-mode=0644Download+25-13
Hi,
On 2023-02-22 15:10:11 +0100, Daniel Gustafsson wrote:
On 26 Nov 2022, at 22:46, Daniel Gustafsson <daniel@yesql.se> wrote:
I've moved the statuses[i] check before the differ check, such that there is a
separate block for this not mixed up with the differs check and printing.Rebased patch to handle breakage of v2 due to bd8d453e9b.
I think we probably should just apply this? The current behaviour doesn't seem
right, and I don't see a downside of the new behaviour?
Greetings,
Andres Freund
On 22 Feb 2023, at 21:33, Andres Freund <andres@anarazel.de> wrote:
On 2023-02-22 15:10:11 +0100, Daniel Gustafsson wrote:
Rebased patch to handle breakage of v2 due to bd8d453e9b.
I think we probably should just apply this? The current behaviour doesn't seem
right, and I don't see a downside of the new behaviour?
Agreed, I can't think of a regression test where we wouldn't want this. My
only concern was if any of the ECPG tests were doing something odd that would
break from this but I can't see anything.
--
Daniel Gustafsson
Daniel Gustafsson <daniel@yesql.se> writes:
On 22 Feb 2023, at 21:33, Andres Freund <andres@anarazel.de> wrote:
On 2023-02-22 15:10:11 +0100, Daniel Gustafsson wrote:Rebased patch to handle breakage of v2 due to bd8d453e9b.
I think we probably should just apply this? The current behaviour doesn't seem
right, and I don't see a downside of the new behaviour?
Agreed, I can't think of a regression test where we wouldn't want this. My
only concern was if any of the ECPG tests were doing something odd that would
break from this but I can't see anything.
+1. I was a bit surprised to realize that we might not count such
a case as a failure.
regards, tom lane
On 22 Feb 2023, at 21:55, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Daniel Gustafsson <daniel@yesql.se> writes:
On 22 Feb 2023, at 21:33, Andres Freund <andres@anarazel.de> wrote:
On 2023-02-22 15:10:11 +0100, Daniel Gustafsson wrote:Rebased patch to handle breakage of v2 due to bd8d453e9b.
I think we probably should just apply this? The current behaviour doesn't seem
right, and I don't see a downside of the new behaviour?Agreed, I can't think of a regression test where we wouldn't want this. My
only concern was if any of the ECPG tests were doing something odd that would
break from this but I can't see anything.+1. I was a bit surprised to realize that we might not count such
a case as a failure.
Done that way, thanks!
--
Daniel Gustafsson