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

Re: [PATCH 2/2] perf-lib: add test_perf_cleanup target

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 17, 2013, 17:43 UTC
Message-ID
<xmqq7gefz6m0.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1379419842-32627-2-git-send-email-t.gummerer@gmail.com>
Thomas Gummerer <t.gummerer@gmail.com> writes:
Show 11 quoted lines
> +For performance tests that need cleaning up after them that should not
> +be timed, use
> +
> +	test_perf_cleanup 'descriptive string' '
> +		command1 &&
> +		command2
> +	' '
> +		cleanupcommand1 &&
> +		cleanupcommand2
> +	'
> +

Hmm, if "not timing the clean-up actions" is the primary goal, is it an option to reuse test_when_finished for this (you may have to make sure that the commands run inside it are not timed; I didn't check).

One thing I felt uneasy about the above construct is that it makes cleanupcommand2 responsible for handling cases where not just command2 but also command1 might have failed.

Compared to that, test-when-finished allows you to control what clean-up to do depending on what have already been done, i.e.

        test_when_finished 'undo what command1 would have done' &&
	command1 &&
        test_when_finished 'undo what command2 would have done' &&
	command2 &&
        ...

The second "undo command2" must be prepared for the case where command2 may have failed in the middle, but it can at least rely on command1 having succeeded when it is run.

Previous: Thomas GummererNext: Thomas Gummerer
Message 3 of 12 in “perf-lib: split starting the test from the execution”
  1. 1/2 perf-lib: split starting the test from the executionThomas Gummerer, Sep 17, 2013
  2. 2/2 perf-lib: add test_perf_cleanup targetThomas Gummerer, Sep 17, 2013
  3. Junio C HamanoSep 17, 2013
  4. Thomas GummererSep 19, 2013
  5. Junio C HamanoSep 19, 2013
  6. Junio C HamanoSep 19, 2013
  7. Junio C HamanoSep 19, 2013
  8. Thomas GummererSep 20, 2013
  9. 0/3 Add cleanup action to perf-libThomas Gummerer, Sep 23, 2013
  10. 1/3 test-lib: introduce "modern" style testsThomas Gummerer, Sep 23, 2013
  11. 2/3 perf-lib: add cleanup optionThomas Gummerer, Sep 23, 2013
  12. 3/3 p0003-index.sh: add perf test for the index formatsThomas Gummerer, Sep 23, 2013

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.