diff options
author | Thomas Gummerer <t.gummerer@gmail.com> | 2013-09-17 14:10:42 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-09-19 13:05:02 -0700 |
commit | e39c5020d9df26714c96b7dfa3134d506c877f45 (patch) | |
tree | 9e8b1505912832481625aaa16ac33d29af48e47d /t/perf/perf-lib.sh | |
parent | 52b8aef8a34adc1e7215e528900593aee983d23d (diff) | |
download | git-tg/perf-lib-test-perf-cleanup.tar.gz |
perf-lib: add test_perf_cleanup targettg/perf-lib-test-perf-cleanup
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/perf/perf-lib.sh')
-rw-r--r-- | t/perf/perf-lib.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh index 8f92eb8889..34129c9c85 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_ () { |