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

Re: [PATCH] t/perf: export variable used in other blocks

From
Jeff King <peff@peff.net>
Date
Mar 3, 2017, 06:45 UTC
Message-ID
<20170303064512.khs2seru5onl54mh@sigill.intra.peff.net>
In-Reply-To
<20170302195041.1699-1-jonathantanmy@google.com>
On Thu, Mar 02, 2017 at 11:50:41AM -0800, Jonathan Tan wrote:
Show 5 quoted lines
> In p0001, a variable was created in a test_expect_success block to be
> used in later test_perf blocks, but was not exported. This caused the
> variable to not appear in those blocks (this can be verified by writing
> 'test -n "$commit"' in those blocks), resulting in a slightly different
> invocation than what was intended. Export that variable.

Thanks, this is obviously the right thing to do, and the mistake is mine from ea97002fc (t/perf: time rev-list with UNINTERESTING commits, 2014-01-20). This is not the first time I've been confused by missing variables in t/perf scripts, since it behaves differently than the normal test suite. I wonder if we should turn on "set -a" during t/perf setup snippets. That's a bit of a blunt tool, but I suspect it would just be easier to work with.

I was curious that the tests added by ea97002fc showed something useful even with the bug you're fixing here. But it's because the actual slice of history we meant to traverse isn't important. It's intentionally tiny to show off the time spent dealing with the UNINTERESTING commits. So in effect we were traversing no commits instead of a tiny set, but the timing results were the same.

I repeated the tests over fbd4a703 given in the commit message of ee9a7002fc and confirmed that it behaves the same with your fixed version of the test. I did have to tweak a few other things to get the test to run against such an old version of git, though. I'll follow-up with a patch.

-Peff
Previous: Jonathan TanNext: Jeff King
Message 6 of 17 in “Test fetch-pack's ability to fetch arbitrary blobs”
  1. 0/3 Test fetch-pack's ability to fetch arbitrary blobsJonathan Tan, Feb 25, 2017
  2. 2/3 revision: exclude trees/blobs given commitJonathan Tan, Feb 25, 2017
  3. Junio C HamanoFeb 28, 2017
  4. Jeff KingFeb 28, 2017
  5. t/perf: export variable used in other blocksJonathan Tan, Mar 2, 2017
  6. Jeff KingMar 3, 2017
  7. t/perf: use $MODERN_GIT for all repo-copying stepsJeff King, Mar 3, 2017
  8. t/perf: add fallback for pre-bin-wrappers versions of gitJeff King, Mar 3, 2017
  9. Junio C HamanoMar 3, 2017
  10. Jeff KingMar 3, 2017
  11. Junio C HamanoFeb 28, 2017
  12. 1/3 revision: unify {tree,blob}_objects in rev_infoJonathan Tan, Feb 25, 2017
  13. Junio C HamanoFeb 28, 2017
  14. Jeff KingFeb 28, 2017
  15. Junio C HamanoMar 2, 2017
  16. Jeff KingFeb 28, 2017
  17. 3/3 upload-pack: compute blob reachability correctlyJonathan Tan, Feb 25, 2017

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.