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

Re: [PATCH 1/2] Update shell tests to use semantic functions

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 5, 2026, 02:17 UTC
Message-ID
<xmqq1pb830ih.fsf@gitster.g>
In-Reply-To
<20260904-file-tests-use-shell-functions-v1-1-b66f9cb4adbe@fastmail.com>

"Mark C. Chu-Carroll via B4 Relay" <devnull+markchucarroll.fastmail.com@kernel.org> writes:

> -		if test_have_prereq MINGW && test -f /proc/$shell_pid/winpid
> +		if test_have_prereq MINGW && test_path_is_file /proc/$shell_pid/winpid
This is Wrong.

First think what the point of "test_path_is_file" and other helpers is. Once you understood them, you would never write them as part of conditional expressions like the above one.

A conditional statement like this "if" does *not* want to shout when the test condition it used to switch between its "then" (and "else" if it has it) is not satisfied. If this "test -f" does not find the named /proc/$shell_pid/winpid file, it does not mean that we detected a breakage in the system that is being tested.

After looking at a handful of hunks from the top of this patch, it seems there are many more similarly wrong conversions among them than a few that are good, and I won't look at the remainder of the [1/2] or [2/2]. Sifting the two large patches that lack sign-off that span across many files and finding salvageable bits is not something I would spend my weekend on.

This kind of conversion first needs to understand what each invocation of "test -X" is really trying to check and why. Brain-less mechanical conversion is not sufficient and will produce a wrong conversion like the above one.

Previous: Mark C. Chu-Carroll via B4 RelayNext: Patrick Steinhardt
Message 4 of 5 in “Update tests to use semantic functions”
  1. 0/2 Update tests to use semantic functionsMark C. Chu-Carroll via B4 Relay, Sep 4, 2026
  2. 2/2 Second batch of shell test migrations.Mark C. Chu-Carroll via B4 Relay, Sep 4, 2026
  3. 1/2 Update shell tests to use semantic functionsMark C. Chu-Carroll via B4 Relay, Sep 4, 2026
  4. Junio C HamanoSep 5, 2026
  5. Patrick SteinhardtSep 7, 2026

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.