All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ci(github): bring back the 'print test failures' step
@ 2022-06-08 10:43 Johannes Schindelin via GitGitGadget
  2022-06-08 23:14 ` Junio C Hamano
  2022-06-09 13:06 ` Ævar Arnfjörð Bjarmason
  0 siblings, 2 replies; 6+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2022-06-08 10:43 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

Git now shows better information in the GitHub workflow runs when a test
case failed. However, when a test case was implemented incorrectly and
therefore does not even run, nothing is shown.

Let's bring back the step that prints the full logs of the failed tests,
and to improve the user experience, print out an informational message
for readers so that they do not have to know/remember where to see the
full logs.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
    ci(GitHub workflow): bring back the 'print test failures' step
    
    When an incorrectly-implemented test let a CI build fail
    [https://github.com/git/git/runs/6703333447?check_suite_focus=true#step:4:1750]
    without any failing test cases, the output was not helpful for readers
    who wished to investigate the problem:
    
    [...]
     751 ⏵Run tests
    1746 === Failed test: t3105-ls-tree-output ===
    1747 The full logs are in the artifacts attached to this run.
    1748 Error: Process completed with exit code 1.
    
    
    While this is still an improvement from before (where no output was
    shown in the test step at all, apart from the very high-level prove
    output), we can do better than point users to downloading the artifacts
    (which is a bit cumbersome).
    
    With this patch, the print test failures step is reintroduced. To make
    sure that readers know to look at it, we now print an explicit message
    [https://github.com/dscho/git/runs/6790035528?check_suite_focus=true#step:4:1741]:
    
    [...]
     749 ⏵Run tests
    1737 === Failed test: t3105-ls-tree-output ===
    1738 The full logs are in the 'print test failures' step below.
    1739 See also the 'failed-tests-*' artifacts attached to this run.
    1740 Error: Process completed with exit code 1.
    
    
    The "print test failures" step is still not expanded by default, but at
    least the output is now so nicely uncluttered that it is really easy to
    spot it: it is right below the above-quoted error message.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1252%2Fdscho%2Fci-print-failures-again-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1252/dscho/ci-print-failures-again-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1252

 .github/workflows/main.yml | 16 ++++++++++++++++
 ci/lib.sh                  |  3 ++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 3fa88b78b6d..cd1f52692a5 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -119,6 +119,10 @@ jobs:
     - name: test
       shell: bash
       run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
+    - name: print test failures
+      if: failure() && env.FAILED_TEST_ARTIFACTS != ''
+      shell: bash
+      run: ci/print-test-failures.sh
     - name: Upload failed tests' directories
       if: failure() && env.FAILED_TEST_ARTIFACTS != ''
       uses: actions/upload-artifact@v2
@@ -200,6 +204,10 @@ jobs:
       env:
         NO_SVN_TESTS: 1
       run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
+    - name: print test failures
+      if: failure() && env.FAILED_TEST_ARTIFACTS != ''
+      shell: bash
+      run: ci/print-test-failures.sh
     - name: Upload failed tests' directories
       if: failure() && env.FAILED_TEST_ARTIFACTS != ''
       uses: actions/upload-artifact@v2
@@ -253,6 +261,10 @@ jobs:
     - uses: actions/checkout@v2
     - run: ci/install-dependencies.sh
     - run: ci/run-build-and-tests.sh
+    - name: print test failures
+      if: failure() && env.FAILED_TEST_ARTIFACTS != ''
+      shell: bash
+      run: ci/print-test-failures.sh
     - name: Upload failed tests' directories
       if: failure() && env.FAILED_TEST_ARTIFACTS != ''
       uses: actions/upload-artifact@v2
@@ -282,6 +294,10 @@ jobs:
     - uses: actions/checkout@v1
     - run: ci/install-docker-dependencies.sh
     - run: ci/run-build-and-tests.sh
+    - name: print test failures
+      if: failure() && env.FAILED_TEST_ARTIFACTS != ''
+      shell: bash
+      run: ci/print-test-failures.sh
     - name: Upload failed tests' directories
       if: failure() && env.FAILED_TEST_ARTIFACTS != ''
       uses: actions/upload-artifact@v1
diff --git a/ci/lib.sh b/ci/lib.sh
index 2f6d9d26e40..b142d254ec1 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -177,7 +177,8 @@ then
 			test_name="${test_exit%.exit}"
 			test_name="${test_name##*/}"
 			printf "\\e[33m\\e[1m=== Failed test: ${test_name} ===\\e[m\\n"
-			echo "The full logs are in the artifacts attached to this run."
+			echo "The full logs are in the 'print test failures' step below."
+			echo "See also the 'failed-tests-*' artifacts attached to this run."
 			cat "t/test-results/$test_name.markup"
 
 			trash_dir="t/trash directory.$test_name"

base-commit: 3069f2a6f4c38e7e599067d2e4a8e31b4f53e2d3
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ci(github): bring back the 'print test failures' step
  2022-06-08 10:43 [PATCH] ci(github): bring back the 'print test failures' step Johannes Schindelin via GitGitGadget
@ 2022-06-08 23:14 ` Junio C Hamano
  2022-06-09 13:06 ` Ævar Arnfjörð Bjarmason
  1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2022-06-08 23:14 UTC (permalink / raw)
  To: Johannes Schindelin via GitGitGadget; +Cc: git, Johannes Schindelin

"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> Git now shows better information in the GitHub workflow runs when a test
> case failed. However, when a test case was implemented incorrectly and
> therefore does not even run, nothing is shown.
>
> Let's bring back the step that prints the full logs of the failed tests,
> and to improve the user experience, print out an informational message
> for readers so that they do not have to know/remember where to see the
> full logs.

Makes quite a lot of sense.  Not all test gotchas are caught by
test-lint locally, and something like this would still be needed.

Will queue.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ci(github): bring back the 'print test failures' step
  2022-06-08 10:43 [PATCH] ci(github): bring back the 'print test failures' step Johannes Schindelin via GitGitGadget
  2022-06-08 23:14 ` Junio C Hamano
@ 2022-06-09 13:06 ` Ævar Arnfjörð Bjarmason
  2022-06-10 16:40   ` Junio C Hamano
  1 sibling, 1 reply; 6+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2022-06-09 13:06 UTC (permalink / raw)
  To: Johannes Schindelin via GitGitGadget; +Cc: git, Johannes Schindelin


On Wed, Jun 08 2022, Johannes Schindelin via GitGitGadget wrote:

> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> Git now shows better information in the GitHub workflow runs when a test
> case failed.

This commit message should be more on-point. "Git" isn't showing
anything, and it's unclear that this is a regression fix for fc5a070f591
(Merge branch 'js/ci-github-workflow-markup', 2022-06-07).

> However, when a test case was implemented incorrectly and therefore
> does not even run, nothing is shown.

The *report* came about because of an incorrectly implemented test (of
mine).

But the real issue is that your recent change to the CI output is
implemented in such a way as to hide entire classes of errors that we'd
previously show.

The test being broken is besides the point, of course we'll have broken
tests. When we do so we should be showing output relevant to the
failure.

The selling point of your js/ci-github-workflow-markup topic was that we
*could* accurately summarize our failures as to make browsing the raw
logs unnecessary. Quoting your
https://lore.kernel.org/git/pull.1117.git.1643050574.gitgitgadget@gmail.com/:
	
	I know, and I do not expect any new contributor, not even most seasoned
	contributors to know, that I have to patiently collapse the "Run
	ci/run-build-and-tests.sh" job's log, and instead expand the "Run
	ci/print-test-failures.sh" job log (which did not fail and hence does not
	draw any attention to it).
	
	I know, and again: I do not expect many others to know this, that I then
	have to click into the "Search logs" box (not the regular web browser's
	search via Ctrl+F!) and type in "not ok" to find the log of the failed test
	case (and this might still be a "known broken" one that is marked via
	test_expect_failure and once again needs to be ignored).
	
	To be excessively clear: This is not a great experience!

As before we agree that it's not the ideal UX experience. But I don't
see how this isn't worse, especially for the proverbial new contributor.

I.e. when js/ci-github-workflow-markup landed we'd gotten rid of the
ci/print-test-failures.sh output entirely, because the topic argued that
we *could* accurately summarize these failures, and that any remaining
issues requiring that step were so obscure as to be left to the
artifacts downloading step.

But per my report at
https://lore.kernel.org/git/220603.86fskmxd43.gmgdl@evledraar.gmail.com/
(which b.t.w, would be useful to link to in the commit message) this
will fail in cases where we'll die early in test-lib.sh itself, e.g. due
to a syntax error.

Now, I haven't fully dug into what those cases are, but a regression fix
really should take the time to do so. E.g. if we fail in a prereq that
the test needs (with exit and/or BUG) do we similarly fail, how about
e.g. chainlint, or is it just if "eval" itself fails?

But getting back to the point, because of that we'll now be asking those
using the CI output to view the default GitHub Markup'd failure, and in
addition knowing enough about its implementation to know if/when they
should be opening the "print test failures" step as well, in case it
over-elided some output.

As an example, the output is now with this change, and a change on top
to re-trigger the reported failure:

	https://github.com/avar/git/runs/6808880749?check_suite_focus=true#step:4:1757

I.e. per the report above we only show a cryptic "Error: Process
completed with exit code 1.", but we do have a "print test failures"
step now.

And here's the version with the "GitHub markup" changes reverted:

	https://github.com/avar/git/runs/6808882949?check_suite_focus=true#step:4:1719

Which to be fair isn't much better in itself, but the greater context is
that *usually* this step would be sufficient to view a failure, but some
of the time it isn't, and you need to know enough to know when that's
the case. That's new.

> [...]Let's bring back the step that prints the full logs of the failed
> tests[...]

Except we still have another bug in js/ci-github-workflow-markup where
bug in it altered the raw logs themselves. To be fair in this case you
can see the failure itself.

Here's what we used to do:

    https://github.com/avar/git/runs/6808882949?check_suite_focus=true#step:5:579

And what we do now:

    https://github.com/avar/git/runs/6808880749?check_suite_focus=true#step:5:445

I.e. the former prints "expecting success of 3105.36 'setup:
HEAD_short_* variables': " followed by the test source itself, and then
the "set -x" output, whereas the new output only has the "set -x"
output. Both of them get to:

    t3105-ls-tree-output.sh: 20: local: --abbrev: bad variable name

So it doesn't matter much in this particular case, but we'll have other
cases where browsing the raw logs is really useful, and having the
now-missing context of the test source is even more useful.

> , and to improve the user experience, print out an informational
> message for readers so that they do not have to know/remember where to
> see the full logs.

I don't think we should call these "full logs" while the bug above
remains unsolved. Perhaps "more verbose logs emitted when running with
--github-workflow-markup, omit the flag to get the full *.out logs"?

> diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
> index 3fa88b78b6d..cd1f52692a5 100644
> --- a/.github/workflows/main.yml
> +++ b/.github/workflows/main.yml
> @@ -119,6 +119,10 @@ jobs:
>      - name: test
>        shell: bash
>        run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
> +    - name: print test failures

When ci/print-test-failures.sh was last in this file before 08dccc8fc1f
(ci: make it easier to find failed tests' logs in the GitHub workflow,
2022-05-21) there was no "name" field, that's an unrelated change that
shouldn't be part of a narrow regression fix.

> +      if: failure() && env.FAILED_TEST_ARTIFACTS != ''

We likewise just had "if failure()" then, is the distinction different
in all these cases?

> +      shell: bash

...and you've made every single one of them run with "bash" instead of
the default shell, which is another "change while at it" that isn't
discussed.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ci(github): bring back the 'print test failures' step
  2022-06-09 13:06 ` Ævar Arnfjörð Bjarmason
@ 2022-06-10 16:40   ` Junio C Hamano
  2022-06-10 17:32     ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2022-06-10 16:40 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Johannes Schindelin via GitGitGadget, git, Johannes Schindelin

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

> On Wed, Jun 08 2022, Johannes Schindelin via GitGitGadget wrote:
>
>> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>>
>> Git now shows better information in the GitHub workflow runs when a test
>> case failed.
>
> This commit message should be more on-point. "Git" isn't showing
> anything, and it's unclear that this is a regression fix for fc5a070f591
> (Merge branch 'js/ci-github-workflow-markup', 2022-06-07).
>
>> However, when a test case was implemented incorrectly and therefore
>> does not even run, nothing is shown.
>
> The *report* came about because of an incorrectly implemented test (of
> mine).
>
> But the real issue is that your recent change to the CI output is
> implemented in such a way as to hide entire classes of errors that we'd
> previously show.

Yup, I think we are all on the same page on that.  And we also all
agree that CI output should help those developers who make mistakes
by making it easy to see them.  The recent change may have been too
aggressive to hide stuff in the name of "newbie friendliness", which
may or may not have been a mismatch between what it claimed to aim
at and what it actually did, but let's not grumble too much about it
and move on in a more constructive way.

These fix-ups are to correct such earlier mistakes.

> I don't think we should call these "full logs" while the bug above
> remains unsolved. Perhaps "more verbose logs emitted when running with
> --github-workflow-markup, omit the flag to get the full *.out logs"?

Yup.

>> diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
>> index 3fa88b78b6d..cd1f52692a5 100644
>> --- a/.github/workflows/main.yml
>> +++ b/.github/workflows/main.yml
>> @@ -119,6 +119,10 @@ jobs:
>>      - name: test
>>        shell: bash
>>        run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
>> +    - name: print test failures
>
> When ci/print-test-failures.sh was last in this file before 08dccc8fc1f
> (ci: make it easier to find failed tests' logs in the GitHub workflow,
> 2022-05-21) there was no "name" field, that's an unrelated change that
> shouldn't be part of a narrow regression fix.
>
>> +      if: failure() && env.FAILED_TEST_ARTIFACTS != ''
>
> We likewise just had "if failure()" then, is the distinction different
> in all these cases?
>
>> +      shell: bash
>
> ...and you've made every single one of them run with "bash" instead of
> the default shell, which is another "change while at it" that isn't
> discussed.

If it is so important to support all the other shells in the GitHub
workflows environment, we can discuss fix-up patches on top or
replacement patches, but does that really matter?  If this were main
Makefile or ci/*.sh that are supposed to be usable by places other
than GitHub Actions environment we use for the CI there, of course
it would be worth to try being extra portable, but it may be even
beneficial to "fix" .github/workflows/* stuff, so that we won't have
to be affected by mistaken use of non-portable shell construct
written there, perhaps?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ci(github): bring back the 'print test failures' step
  2022-06-10 16:40   ` Junio C Hamano
@ 2022-06-10 17:32     ` Ævar Arnfjörð Bjarmason
  2022-07-25 20:00       ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 6+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2022-06-10 17:32 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Johannes Schindelin via GitGitGadget, git, Johannes Schindelin


On Fri, Jun 10 2022, Junio C Hamano wrote:

> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>> When ci/print-test-failures.sh was last in this file before 08dccc8fc1f
>> (ci: make it easier to find failed tests' logs in the GitHub workflow,
>> 2022-05-21) there was no "name" field, that's an unrelated change that
>> shouldn't be part of a narrow regression fix.
>>
>>> +      if: failure() && env.FAILED_TEST_ARTIFACTS != ''
>>
>> We likewise just had "if failure()" then, is the distinction different
>> in all these cases?
>>
>>> +      shell: bash
>>
>> ...and you've made every single one of them run with "bash" instead of
>> the default shell, which is another "change while at it" that isn't
>> discussed.
>
> If it is so important to support all the other shells in the GitHub
> workflows environment, we can discuss fix-up patches on top or
> replacement patches, but does that really matter?  If this were main
> Makefile or ci/*.sh that are supposed to be usable by places other
> than GitHub Actions environment we use for the CI there, of course
> it would be worth to try being extra portable, but it may be even
> beneficial to "fix" .github/workflows/* stuff, so that we won't have
> to be affected by mistaken use of non-portable shell construct
> written there, perhaps?

It just looks like a mistake. The Windows sections need an explicit
"bash" shell, but nothing else does, and the Windows sections had
explicit names for somes stuff, but the other ones did not.

So I think thas was just a case of copy/pasting the first section(s)
rather than bringing back the pre-image. I think just bringing back the
old behavior makes sense for a regression fix in a re-roll.

Aside from that I think it's very useful to not rely on bash, for future
directions of being able to use this tooling more portably, c.f. what I
did in my series where you can run "like CI" locally, which I'd like to
do on Solaris, AIX & whatever else without it being a portability
hassle.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ci(github): bring back the 'print test failures' step
  2022-06-10 17:32     ` Ævar Arnfjörð Bjarmason
@ 2022-07-25 20:00       ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 6+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2022-07-25 20:00 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Johannes Schindelin via GitGitGadget, git, Johannes Schindelin


On Fri, Jun 10 2022, Ævar Arnfjörð Bjarmason wrote:

> On Fri, Jun 10 2022, Junio C Hamano wrote:
>
>> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>>> When ci/print-test-failures.sh was last in this file before 08dccc8fc1f
>>> (ci: make it easier to find failed tests' logs in the GitHub workflow,
>>> 2022-05-21) there was no "name" field, that's an unrelated change that
>>> shouldn't be part of a narrow regression fix.
>>>
>>>> +      if: failure() && env.FAILED_TEST_ARTIFACTS != ''
>>>
>>> We likewise just had "if failure()" then, is the distinction different
>>> in all these cases?
>>>
>>>> +      shell: bash
>>>
>>> ...and you've made every single one of them run with "bash" instead of
>>> the default shell, which is another "change while at it" that isn't
>>> discussed.
>>
>> If it is so important to support all the other shells in the GitHub
>> workflows environment, we can discuss fix-up patches on top or
>> replacement patches, but does that really matter?  If this were main
>> Makefile or ci/*.sh that are supposed to be usable by places other
>> than GitHub Actions environment we use for the CI there, of course
>> it would be worth to try being extra portable, but it may be even
>> beneficial to "fix" .github/workflows/* stuff, so that we won't have
>> to be affected by mistaken use of non-portable shell construct
>> written there, perhaps?
>
> It just looks like a mistake. The Windows sections need an explicit
> "bash" shell, but nothing else does, and the Windows sections had
> explicit names for somes stuff, but the other ones did not.
>
> So I think thas was just a case of copy/pasting the first section(s)
> rather than bringing back the pre-image. I think just bringing back the
> old behavior makes sense for a regression fix in a re-roll.
>
> Aside from that I think it's very useful to not rely on bash, for future
> directions of being able to use this tooling more portably, c.f. what I
> did in my series where you can run "like CI" locally, which I'd like to
> do on Solaris, AIX & whatever else without it being a portability
> hassle.

It turns out this is also a regression for our CI, if linux-musl fails
it'll emit:

    OCI runtime exec failed: exec failed: container_linux.go:380:
    starting container process caused: exec: "bash": executable file not
    found in $PATH: unknown


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-25 20:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 10:43 [PATCH] ci(github): bring back the 'print test failures' step Johannes Schindelin via GitGitGadget
2022-06-08 23:14 ` Junio C Hamano
2022-06-09 13:06 ` Ævar Arnfjörð Bjarmason
2022-06-10 16:40   ` Junio C Hamano
2022-06-10 17:32     ` Ævar Arnfjörð Bjarmason
2022-07-25 20:00       ` Ævar Arnfjörð Bjarmason

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.