From: Thomas Gummerer <t.gummerer@gmail.com>
To: git@vger.kernel.org
Cc: trast@inf.ethz.ch, gitster@pobox.com, t.gummerer@gmail.com
Subject: [PATCH 2/2] perf-lib: add test_perf_cleanup target
Date: Tue, 17 Sep 2013 14:10:42 +0200 [thread overview]
Message-ID: <1379419842-32627-2-git-send-email-t.gummerer@gmail.com> (raw)
In-Reply-To: <1379419842-32627-1-git-send-email-t.gummerer@gmail.com>
Currently there is no way to clean up the changes that have been made
with test_perf for the next run. Add a way to reset the repository to
the state before the test for testing commands that modify the git
repository, e.g. for perf testing git add.
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
---
This enables me to do something like (hint, hint, hint ;-)):
Test HEAD~1 HEAD
------------------------------------------------------------------------------------
....
0003.16: v5 update-index file 0.19(0.12+0.06) 0.08(0.06+0.01) -57.9%
There are no performance tests currently using this, but since I have
it anyway for a POC of partial writing of index-v5 (which is ugly and
will have to wait a bit until I'm ready to send it to the list) I think
this may be a worthwhile addition others can use in the meantime.
t/perf/README | 11 +++++++++++
t/perf/perf-lib.sh | 25 +++++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/t/perf/README b/t/perf/README
index 8848c14..72f8a7b 100644
--- a/t/perf/README
+++ b/t/perf/README
@@ -123,6 +123,17 @@ tests, use
command2
'
+For performance tests that need cleaning up after them that should not
+be timed, use
+
+ test_perf_cleanup 'descriptive string' '
+ command1 &&
+ command2
+ ' '
+ cleanupcommand1 &&
+ cleanupcommand2
+ '
+
test_perf spawns a subshell, for lack of better options. This means
that
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index 95e483c..11a93f1 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -174,6 +174,22 @@ perf_test_ () {
test_failure_ "$@"
break
fi
+ say >&3 "cleaning up: $3"
+ if test "$#" = 3
+ then
+ if test_run_ "$3"
+ then
+ if test -z "$verbose"; then
+ echo -n " c$i"
+ else
+ echo "* cleaning up run $i/$GIT_PERF_REPEAT_COUNT:"
+ fi
+ else
+ test -z "$verbose" && echo
+ test_failure_ "$@"
+ break
+ fi
+ fi
done
if test -z "$verbose"; then
echo " ok"
@@ -194,6 +210,15 @@ test_perf () {
perf_test_ "$1" "$2"
}
+test_perf_cleanup () {
+ test_start_
+ test "$#" = 4 && { test_prereq=$1; shift; } || test_prereq=
+ test "$#" = 3 ||
+ error "bug in the test script: not 3 or 4 parameters to test-expect-success"
+ export test_prereq
+ perf_test_ "$1" "$2" "$3"
+}
+
# We extend test_done to print timings at the end (./run disables this
# and does it after running everything)
test_at_end_hook_ () {
--
1.8.3.4.1238.ga800761
next prev parent reply other threads:[~2013-09-17 12:11 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 ` Thomas Gummerer [this message]
2013-09-17 17:43 ` [PATCH 2/2] perf-lib: add test_perf_cleanup target Junio C Hamano
2013-09-19 11:42 ` Thomas Gummerer
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=1379419842-32627-2-git-send-email-t.gummerer@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).