git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t/README: mention test files are make targets

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 25, 2024, 01:24 UTC
Message-ID
<xmqqfrwfp0hh.fsf@gitster.g>
In-Reply-To
<97212b72-70d6-e55f-8b2a-04ede4321288@gmail.com>
Philippe Blain <levraiphilippeblain@gmail.com> writes:
> Since '$(T)' is listed at the bottom of the Makefile as .PHONY,
> I think it is OK and not that ugly since this uses a documented feature
> of make.
You're prehaps right.

I've always felt that the documented .PHONY feature was to mark targets that do not correspond to any filename on the filesystem, e.g., "all", "clean", "install". Of course these can exist as filenames as well, and .PHONY works as an instruction that says "the existence or freshness of these targets do not matter at all". For our use, it is OK.

I however wonder if marking $(T) as .PHONY is the right thing to begin with. Declaring that the existence or freshness of t0000-basic.sh does not matter means we will not be able to later write rules other than "just run it!" that does depend on the freshness of t0000-basic.sh file, no? IOW, if we wanted to add a target like this at the end of the t/Makefile:

        t-combined.sh: t0000-basic.sh t0001-init.sh
                cat t0000-basic.sh t0001-init.sh >"$@"

then "make -C t t-combined.sh" would end up running these two test scripts (because they are .PHONY) and then leave the concatenation in t-combined.sh file. Without changing anything, doing the same "make -C t t-combined.sh" again will again run these two tests and recreate the same t-combined.sh file, even though there is no need to.

So I think that is what I felt ugly.

As long as we do not use these $(T) files as an input to some other thing and list them as the dependencies, we are OK, though.

Previous: Philippe BlainNext: Chris Torek
Message 4 of 6 in “t/README: mention test files are make targets”
  1. t/README: mention test files are make targetsPhilippe Blain via GitGitGadget, Mar 24, 2024
  2. Junio C HamanoMar 24, 2024
  3. Philippe BlainMar 24, 2024
  4. Junio C HamanoMar 25, 2024
  5. Chris TorekMar 25, 2024
  6. Junio C HamanoMar 25, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.