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

Re: [PATCH v3 2/3] perf: make the tests work in worktrees

From
Jeff King <peff@peff.net>
Date
Jun 21, 2016, 19:25 UTC
Message-ID
<20160621192557.GA2311@sigill.intra.peff.net>
In-Reply-To
<0f0bc7ac7b6eebed22b05c277cf7352122d164d2.1463145936.git.johannes.schindelin@gmx.de>
On Fri, May 13, 2016 at 03:25:58PM +0200, Johannes Schindelin wrote:
Show 9 quoted lines
> This patch makes perf-lib.sh more robust so that it can run correctly
> even inside a worktree. For example, it assumed that $GIT_DIR/objects is
> the objects directory (which is not the case for worktrees) and it used
> the commondir file verbatim, even if it contained a relative path.
> 
> Furthermore, the setup code expected `git rev-parse --git-dir` to spit
> out a relative path, which is also not true for worktrees. Let's just
> change the code to accept both relative and absolute paths, by avoiding
> the `cd` into the copied working directory.

I was trying to run the perf scripts today and got bit by this patch. The problem is this line:

> +	objects_dir="$(git -C "$source" rev-parse --git-path objects)"

When the perf script is running, the "git" in its PATH is the version of git being perf-tested, not the most recent one. And --git-path wasn't introduced until v2.5.0. So if you try to compare results against an older git, it fails:

  $ cd t/perf
  $ ./run v2.4.0 v2.9.0 -- p0000-perf-lib-sanity.sh
  [...]
  === Running 1 tests in build/67308bd628c6235dbc1bad60c9ad1f2d27d576cc/bin-wrappers ===
  fatal: ambiguous argument 'objects': unknown revision or path not in the working tree.
  Use '--' to separate paths from revisions, like this:
  'git <command> [<revision>...] -- [<file>...]'
  cp: unrecognized option '--git-path
  objects'
  Try 'cp --help' for more information.
  error: failed to copy repository '/home/peff/compile/git/t/..' to '/var/ram/git-tests/trash directory.p0000-perf-lib-sanity'
  [...]
  Test                                                       v2.4.0      v2.9.0         
  --------------------------------------------------------------------------------------
  0000.1: test_perf_default_repo works                       <missing>   0.00(0.00+0.00)
  0000.2: test_checkout_worktree works                       <missing>   0.01(0.00+0.00)
  0000.4: export a weird var                                 <missing>   0.00(0.00+0.00)
  0000.6: important variables available in subshells         <missing>   0.00(0.00+0.00)
  0000.7: test-lib-functions correctly loaded in subshells   <missing>   0.00(0.00+0.00)

I know that running modern perf tests against older versions isn't guaranteed to work (the tests might rely on newer options, for example), but it at least generally worked up until this point.

IMHO the problem is in the design of t/perf, though. It should always use your modern git for the harness setup, and only use the git-to-test inside test_expect and test_perf blocks.

-Peff
Previous: Junio C HamanoNext: Johannes Schindelin
Message 25 of 26 in “Introduce a perf test for interactive rebase”
  1. 0/3 Introduce a perf test for interactive rebaseJohannes Schindelin, May 10, 2016
  2. 1/3 perf: let's disable symlinks on WindowsJohannes Schindelin, May 10, 2016
  3. Junio C HamanoMay 10, 2016
  4. Johannes SchindelinMay 11, 2016
  5. 2/3 perf: make the tests work in worktreesJohannes Schindelin, May 10, 2016
  6. Junio C HamanoMay 10, 2016
  7. Johannes SchindelinMay 11, 2016
  8. 3/3 Add a perf test for rebase -iJohannes Schindelin, May 10, 2016
  9. 0/3 Introduce a perf test for interactive rebaseJohannes Schindelin, May 11, 2016
  10. 3/3 Add a perf test for rebase -iJohannes Schindelin, May 11, 2016
  11. Junio C HamanoMay 11, 2016
  12. Johannes SchindelinMay 13, 2016
  13. 2/3 perf: make the tests work in worktreesJohannes Schindelin, May 11, 2016
  14. Eric SunshineMay 11, 2016
  15. Johannes SchindelinMay 13, 2016
  16. 1/3 perf: let's disable symlinks when they are not availableJohannes Schindelin, May 11, 2016
  17. 0/3 Introduce a perf test for interactive rebaseJohannes Schindelin, May 13, 2016
  18. 1/3 perf: let's disable symlinks when they are not availableJohannes Schindelin, May 13, 2016
  19. 2/3 perf: make the tests work in worktreesJohannes Schindelin, May 13, 2016
  20. René ScharfeMay 29, 2016
  21. Johannes SchindelinMay 30, 2016
  22. Junio C HamanoMay 30, 2016
  23. René ScharfeMay 30, 2016
  24. Junio C HamanoMay 31, 2016
  25. Jeff KingJun 21, 2016
  26. 3/3 Add a perf test for rebase -iJohannes Schindelin, May 13, 2016

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.