Re: [PATCH] Makefile: generate 'git' as 'cc [...] -o git+ && mv git+ git'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 07 2021, Junio C Hamano wrote:

> Ævar Arnfjörð Bjarmason  <avarab@xxxxxxxxx> writes:
>
>> Change the compilation of the main 'git' binary to not have the CC
>> clobber 'git' in-place. This means that e.g. running the test suite
>> in-place and recompiling won't fail whatever tests happen to be
>> running for the duration of the binary being regenerated.
>
> I am not sure why I would want to support the workflow this is
> trying to help.

Because it also allows me and others to do more testing on patches to
git.git.

If I'm working on a patch to e.g. git-fsck I might be doing
edit->save->some-tests, where "some-tests" are a subset of the test
suite I think is relevant to fsck.

But after doing N commits with passing tests I might notice that some
other part of the test suite I didn't expect to have anything to do with
fsck broke because I wasn't running that test.

I wasn't running that test because I'm not going to wait 10-15 minutes
for it to run while actively editing, but will wait 30s-1m for 10-50
test files to run.

So I can also have the full test suite running in a loop in some side
window that'll give me a headsup if the "while do-full-tests; [...]"
loop breaks, at which point I'm likely to investigate it sooner than
otherwise, and not waste time going down the wrong path.

You can of course do that now, but it requires having a worktree on the
side or whatever, which isn't always ideal (sometimes I'd like to have
these tests on uncommitted changes).

This change makes it mostly just work.


> I do not want to see a patch on this list claiming that "While the
> whole test suite is running, I tweaked the source three times and
> recompiled, so some tests may have used my second iteration while
> others may have used my third and the final version of the code---in
> any case, all tests passed".  And when a patch that was developed
> that way came in, I do not want to hear "Yes, the test suite used
> mixed binaries, but I KNOW the difference between my second and
> third iteration should not matter the parts of the earlier tests
> that used the older iteration".

We have a lot of existing rules in the Makefile that are of the form:

    make thing >thing+ &&
    mv thing+ thing

Where we're not doing the rename dance to avoid clobbering the file
we're reading.

As far as I can see all/most of those rules can just be rewritten like
e.g. this if this is a use-case we not only don't care about, but would
like to go out of our way to break:

    diff --git a/Makefile b/Makefile
    index dfb0f1000fa..8b57c3a5e63 100644
    --- a/Makefile
    +++ b/Makefile
    @@ -2190,2 +2190 @@ config-list.h:
    -       $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh \
    -               >$@+ && mv $@+ $@
    +       $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux