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

Re: [PATCH v3 2/3] worktree: link worktrees with relative paths

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 9, 2024, 19:10 UTC
Message-ID
<xmqqy12xqehd.fsf@gitster.g>
In-Reply-To
<k3X5W4US76LBJ_IUq-quVRha2jd-4iWJ9yX6Ukh6-ifZdWC3iajoUJ8VUyTDfkJHSqiD1RJlqIuVlDGIsReR_SDREVWyHGIqsXhazvJu1ek=@pm.me>
Caleb White <cdwhite3@pm.me> writes:
> What's the best way to parameterize the worktree tests? I would like
> to run the same tests for both absolute and relative paths and I'm
> not particularly a fan of just copying them all into new *-relative.sh
> files.
What I meant by interoperability tests are a lot smaller scale.

A test that creates worktree/repository pair without the option to use relative, and then tries to use such a worktree/repository pair with the option would simulate "how well the newer Git handles an existing repository", and another test that creates with the option to use relative and uses the worktree/repository without the option would simulate "how well existing versions of Git works when seeing a worktree made with the newer git with the relative option".

By "parameterise", if you mean running a set of worktree/repository tests without the "relative" option enabled, and run the same set of tests with the option enabled, you could model it after how t8001 and t8002 (or t5560 and t5561) share a lot of same tests that are in a file that is included by both of them. In smaller scale, it is common to have an ad-hoc construct like:

	for conf in relative absolute
	do
		test_expect_success ... 
		test_expect_success ... 
		test_expect_success ... 
	done

that has bunch of test_expect_success, which may change the behaviour depending on the value of $conf, not &&-chained inside the for loop. You can use a nested loop (one for preparing, the other for testing the use of worktree) if you want to test the full matrix.

I do not offhand know if such parametralized tests are necessary in the context of this change, though.

Thanks.
Previous: Caleb WhiteNext: Caleb White
Message 14 of 24 in “Link worktrees with relative paths”
  1. 0/3 Link worktrees with relative pathsCaleb White via B4 Relay, Oct 8, 2024
  2. 1/3 worktree: refactor infer_backlink() to use *strbufCaleb White via B4 Relay, Oct 8, 2024
  3. shejialuoOct 10, 2024
  4. Caleb WhiteOct 10, 2024
  5. shejialuoOct 10, 2024
  6. Caleb WhiteOct 10, 2024
  7. Junio C HamanoOct 10, 2024
  8. Caleb WhiteOct 10, 2024
  9. Junio C HamanoOct 10, 2024
  10. 3/3 worktree: add test for path handling in linked worktreesCaleb White via B4 Relay, Oct 8, 2024
  11. 2/3 worktree: link worktrees with relative pathsCaleb White via B4 Relay, Oct 8, 2024
  12. Junio C HamanoOct 8, 2024
  13. Caleb WhiteOct 9, 2024
  14. Junio C HamanoOct 9, 2024
  15. Caleb WhiteOct 9, 2024
  16. Junio C HamanoOct 9, 2024
  17. Caleb WhiteOct 10, 2024
  18. Caleb WhiteOct 11, 2024
  19. Caleb WhiteOct 22, 2024
  20. Phillip WoodOct 9, 2024
  21. Caleb WhiteOct 9, 2024
  22. Caleb WhiteOct 8, 2024
  23. Junio C HamanoOct 8, 2024
  24. Caleb WhiteOct 8, 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.