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

Re: [RFC PATCH v2 2/4] t1510-repo-setup: don't use exact matching on traces

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Apr 23, 2021, 09:59 UTC
Message-ID
<c31c30f0-2613-0a12-1025-6043ef5f2962@gmail.com>
In-Reply-To
<20210423001539.4059524-3-emilyshaffer@google.com>
Hi Emily
On 23/04/2021 01:15, Emily Shaffer wrote:
Show 10 quoted lines
> Tests which interrogate the exact underlying behavior of the code under
> test, instead of checking for the presence of desired side effects or
> calls, are a known testing antipattern. They are flaky as they need to
> be updated every time the underlying implementation changes.
> 
> By using 'grep --fixed-strings --file <expect>' instead, we can check
> for the positive presence of lines we are sure should be happening, and
> ignore any additional things which may be happening around us (for
> example, additional child processes which are occurring unrelated to the
> code under test).
 >
Show 15 quoted lines
> Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
> ---
>   t/t1510-repo-setup.sh | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh
> index bbfe05b8e4..8bd4f54d03 100755
> --- a/t/t1510-repo-setup.sh
> +++ b/t/t1510-repo-setup.sh
> @@ -63,7 +63,7 @@ test_repo () {
>   		rm -f trace &&
>   		GIT_TRACE_SETUP="$(pwd)/trace" git symbolic-ref HEAD >/dev/null &&
>   		grep '^setup: ' trace >result &&
> -		test_cmp expected result
> +		grep -Ff expected result

If there is more than one line in expected (it's not clear from the limited context if there is) then grep will succeed if any of the lines match rather than requiring all the lines to match as test_cmp does.

Best wishes
Phillip
>   	)
>   }
>   
> 
Previous: Emily ShafferNext: Emily Shaffer
Message 17 of 22 in “share a config between submodule and superproject”
  1. 0/2 share a config between submodule and superprojectEmily Shaffer, Apr 8, 2021
  2. 1/2 config: rename "submodule" scope to "gitmodules"Emily Shaffer, Apr 8, 2021
  3. 2/2 config: add 'config.superproject' fileEmily Shaffer, Apr 8, 2021
  4. Philip OakleyApr 9, 2021
  5. Emily ShafferApr 13, 2021
  6. Matheus Tavares BernardinoApr 9, 2021
  7. Junio C HamanoApr 9, 2021
  8. Emily ShafferApr 13, 2021
  9. Emily ShafferApr 13, 2021
  10. Future structure of submodules and .git/, .git/modules/* organizationÆvar Arnfjörð Bjarmason, Apr 14, 2021
  11. Emily ShafferApr 15, 2021
  12. Junio C HamanoApr 15, 2021
  13. 0/4 share a config between submodule and superprojectEmily Shaffer, Apr 23, 2021
  14. 1/4 config: rename "submodule" scope to "gitmodules"Emily Shaffer, Apr 23, 2021
  15. Phillip WoodApr 23, 2021
  16. 2/4 t1510-repo-setup: don't use exact matching on tracesEmily Shaffer, Apr 23, 2021
  17. Phillip WoodApr 23, 2021
  18. 3/4 t7006-pager.sh: more lenient trace checkingEmily Shaffer, Apr 23, 2021
  19. Phillip WoodApr 23, 2021
  20. Phillip WoodApr 23, 2021
  21. 4/4 config: add 'config.superproject' fileEmily Shaffer, Apr 23, 2021
  22. Johannes SchindelinApr 23, 2021

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.