mbox series

[v1,0/3] fixes for commented out code in tests (was "Re: [PATCH] *: fix typos which duplicate a word")

Message ID 20230111233242.16870-1-rybak.a.v@gmail.com (mailing list archive)
Headers show
Series fixes for commented out code in tests (was "Re: [PATCH] *: fix typos which duplicate a word") | expand

Message

Andrei Rybak Jan. 11, 2023, 11:32 p.m. UTC
[ I apologize for some people getting this twice -- I messed up when
  invoking `git send-email` ]

On 2023-01-06T19:25, Eric Sunshine wrote:
> Not related to your patch at all, but I notice in this test that the
> call to test_when_finished() is commented out:
> 
>     # test_when_finished "stop_daemon_delete_repo test_insensitive" &&
> 
> which makes me wonder if it was commented out while the test was being
> debugged but then forgotten, and that the script is now potentially
> leaking a running daemon if something in the test fails after the
> daemon was started, or if the daemon does not shut down on its own as
> it's supposed to do. [cc:+Jeff Hostetler]

Here's a patch series that fixes some of the commented out test code.

I skipped changing the following:

1. a minute-long test_expect_failure is commented out in t0014-alias.sh .
   Technically, this could be uncommented and marked with `EXPENSIVE`
   prerequisite, but it doesn't seem worth it for a `test_expect_failure`.
   [ cc Tim Schumacher, who added this test in fef5f7fc43 (t0014: introduce an
   alias testing suite, 2018-09-16) ]

2. In t6426-merge-skip-unneeded-updates.sh, second part of the test '2c: Modify
   b & add c VS rename b->c' is commented out with an explicit "# FIXME:
   rename/add conflicts are horribly broken right now;" above the commented out
   part.
   [ cc Elijah Newren, author of c04ba51739 (t6046: testcases checking whether
   updates can be skipped in a merge, 2018-04-19) ]

3. I've experimented a bit with commented out test in file
   t9200-git-cvsexportcommit.sh.  Tests in this file rely on state from previous
   tests, which complicates more thorough investigation.  Unfortunately,  I
   didn't have bandwidth to investigate this further.
   [ cc Robin Rosenberg, who added it in fe142b3a45 (Rework cvsexportcommit to
   handle binary files for all cases., 2006-11-12) and commented out in
   e86ad71fe5 (Make cvsexportcommit work with filenames with spaces and
   non-ascii characters., 2006-12-11) ]

I found these places in tests with:

    git grep -P '^\s*[#]\s*test_' -- 't/t[0-9]*'

The rest of the results of this grep are documentation comments.

Andrei Rybak (3):
  t6003: uncomment test '--max-age=c3, --topo-order'
  t6422: drop commented out code
  t7527: uncomment test_when_finished step in a test

 t/t6003-rev-list-topo-order.sh       | 23 ++++++++++-------------
 t/t6422-merge-rename-corner-cases.sh |  2 --
 t/t7527-builtin-fsmonitor.sh         |  2 +-
 3 files changed, 11 insertions(+), 16 deletions(-)

Comments

Tim Schumacher Jan. 12, 2023, 12:45 a.m. UTC | #1
On 12.01.23 00:32, Andrei Rybak wrote:
> [...]
>
> Here's a patch series that fixes some of the commented out test code.
>
> I skipped changing the following:
>
> 1. a minute-long test_expect_failure is commented out in t0014-alias.sh .
>     Technically, this could be uncommented and marked with `EXPENSIVE`
>     prerequisite, but it doesn't seem worth it for a `test_expect_failure`.
>     [ cc Tim Schumacher, who added this test in fef5f7fc43 (t0014: introduce an
>     alias testing suite, 2018-09-16) ]

The reason why this particular test is commented out (and why it
mentions a run time of one minute) is because support for detecting
external alias loops isn't yet implemented. This means that running that
test would spin the test runner until the test times out due to an
intentional infinite loop.

As soon as that is implemented properly, git would ideally detect the
loop after a few iterations at latest, so the test wouldn't require to
be marked as 'EXPENSIVE' in the first place.

For the context of your patches, skipping adjusting this test is most
likely fine, as it references currently unimplemented behavior and it
presumably would require more adjustments anyways before finally being
enabled.

>
> [...]
>

Tim
Elijah Newren Jan. 12, 2023, 1:54 a.m. UTC | #2
On Wed, Jan 11, 2023 at 4:05 PM Andrei Rybak <rybak.a.v@gmail.com> wrote:
>
> [ I apologize for some people getting this twice -- I messed up when
>   invoking `git send-email` ]
>
> On 2023-01-06T19:25, Eric Sunshine wrote:
> > Not related to your patch at all, but I notice in this test that the
> > call to test_when_finished() is commented out:
> >
> >     # test_when_finished "stop_daemon_delete_repo test_insensitive" &&
> >
> > which makes me wonder if it was commented out while the test was being
> > debugged but then forgotten, and that the script is now potentially
> > leaking a running daemon if something in the test fails after the
> > daemon was started, or if the daemon does not shut down on its own as
> > it's supposed to do. [cc:+Jeff Hostetler]
>
> Here's a patch series that fixes some of the commented out test code.

Patch 2 is obviously correct.  Patches 1 & 3 make sense to me, but it
would be nice to have someone familiar with fsmonitor look at #3.

As to your notes about other related testcases...

> I skipped changing the following:
[...]
> 2. In t6426-merge-skip-unneeded-updates.sh, second part of the test '2c: Modify
>    b & add c VS rename b->c' is commented out with an explicit "# FIXME:
>    rename/add conflicts are horribly broken right now;" above the commented out
>    part.
>    [ cc Elijah Newren, author of c04ba51739 (t6046: testcases checking whether
>    updates can be skipped in a merge, 2018-04-19) ]
[...]

You missed the cc...but I looked up this email since you did cc me for
patch 2/3.

Yeah, the commented out code was never tested, because the only thing
I could have tested at the time was incorrect results.  So I just took
a guess at what the improved testing would look like and apparently
made 3 small errors in doing so.  I have fixed it locally and can
submit a patch.
Elijah Newren Jan. 13, 2023, 4:32 a.m. UTC | #3
On Wed, Jan 11, 2023 at 5:54 PM Elijah Newren <newren@gmail.com> wrote:
>
> On Wed, Jan 11, 2023 at 4:05 PM Andrei Rybak <rybak.a.v@gmail.com> wrote:
> >
> > [ I apologize for some people getting this twice -- I messed up when
> >   invoking `git send-email` ]
> >
> > On 2023-01-06T19:25, Eric Sunshine wrote:
> > > Not related to your patch at all, but I notice in this test that the
> > > call to test_when_finished() is commented out:
> > >
> > >     # test_when_finished "stop_daemon_delete_repo test_insensitive" &&
> > >
> > > which makes me wonder if it was commented out while the test was being
> > > debugged but then forgotten, and that the script is now potentially
> > > leaking a running daemon if something in the test fails after the
> > > daemon was started, or if the daemon does not shut down on its own as
> > > it's supposed to do. [cc:+Jeff Hostetler]
> >
> > Here's a patch series that fixes some of the commented out test code.
>
> Patch 2 is obviously correct.  Patches 1 & 3 make sense to me, but it
> would be nice to have someone familiar with fsmonitor look at #3.
>
> As to your notes about other related testcases...
>
> > I skipped changing the following:
> [...]
> > 2. In t6426-merge-skip-unneeded-updates.sh, second part of the test '2c: Modify
> >    b & add c VS rename b->c' is commented out with an explicit "# FIXME:
> >    rename/add conflicts are horribly broken right now;" above the commented out
> >    part.
> >    [ cc Elijah Newren, author of c04ba51739 (t6046: testcases checking whether
> >    updates can be skipped in a merge, 2018-04-19) ]
> [...]
>
> You missed the cc...but I looked up this email since you did cc me for
> patch 2/3.
>
> Yeah, the commented out code was never tested, because the only thing
> I could have tested at the time was incorrect results.  So I just took
> a guess at what the improved testing would look like and apparently
> made 3 small errors in doing so.  I have fixed it locally and can
> submit a patch.

Submitted here:
https://lore.kernel.org/git/pull.1462.git.1673584084761.gitgitgadget@gmail.com/