summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--t/perf/README11
-rw-r--r--t/perf/perf-lib.sh25
2 files changed, 36 insertions, 0 deletions
diff --git a/t/perf/README b/t/perf/README
index 8848c14619..72f8a7b999 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 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_ () {