From: Thomas Gummerer <t.gummerer@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, trast@inf.ethz.ch
Subject: Re: [PATCH 2/2] perf-lib: add test_perf_cleanup target
Date: Thu, 19 Sep 2013 13:42:23 +0200 [thread overview]
Message-ID: <87fvt1ghr4.fsf@gmail.com> (raw)
In-Reply-To: <xmqq7gefz6m0.fsf@gitster.dls.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
> Thomas Gummerer <t.gummerer@gmail.com> writes:
>
>> +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).
Maybe I wasn't clear enough. The goal is to allow tests to have
everything cleaned up after every run. This can then be used for
commands that change the index (or other things) and get back to the
original state after that. For example something like this:
file=$(git ls-files | tail -n 30 | head -1)
test_expect_success "change a file" "
echo 'something' >>$file
"
test_perf_cleanup "v5 update-index file" "
git update-index $file
" "
git reset
"
test_when_finished on the other hand only cleans up when the whole test
is finished.
> 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.
When one performance test fails, the testing is aborted and the cleanup
commands are not executed anymore, leaving the trash directory in the
failed state. This consistent with the normal tests with the immediate
flag passed to them. (All performance tests have the --immediate flag
on implicitly).
next prev parent reply other threads:[~2013-09-19 11:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-17 12:10 [PATCH 1/2] perf-lib: split starting the test from the execution Thomas Gummerer
2013-09-17 12:10 ` [PATCH 2/2] perf-lib: add test_perf_cleanup target Thomas Gummerer
2013-09-17 17:43 ` Junio C Hamano
2013-09-19 11:42 ` Thomas Gummerer [this message]
2013-09-19 17:19 ` Junio C Hamano
2013-09-19 19:52 ` Junio C Hamano
2013-09-19 20:11 ` Junio C Hamano
2013-09-20 22:14 ` Thomas Gummerer
2013-09-23 21:08 ` [PATCH v2 0/3] Add cleanup action to perf-lib Thomas Gummerer
2013-09-23 21:08 ` [PATCH v2 1/3] test-lib: introduce "modern" style tests Thomas Gummerer
2013-09-23 21:08 ` [PATCH v2 2/3] perf-lib: add cleanup option Thomas Gummerer
2013-09-23 21:08 ` [PATCH v2 3/3] p0003-index.sh: add perf test for the index formats Thomas Gummerer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fvt1ghr4.fsf@gmail.com \
--to=t.gummerer@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=trast@inf.ethz.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).