p7300: add performance tests for clean
The tests are run in dry-run mode to avoid having to restore the test directories for each timed iteration. Using dry-run is an acceptable compromise since we are mostly interested in the initial computation of what to clean and not so much in the cleaning it self. Signed-off-by: Erik Elfström <erik.elfstrom@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Erik Elfström committed
Jun 15, 2015 at 21:39 UTC
f49a5650ab536a31a22c2b48398e0e29bb59269f
1 file changed
+31
t/perf/p7300-clean.sh
new
+31
@@ -0,0 +1,31 @@
1
+#!/bin/sh
2
+
3
+test_description="Test git-clean performance"
4
+
5
+. ./perf-lib.sh
6
+
7
+test_perf_default_repo
8
+test_checkout_worktree
9
+
10
+test_expect_success 'setup untracked directory with many sub dirs' '
11
+ rm -rf 500_sub_dirs 100000_sub_dirs clean_test_dir &&
12
+ mkdir 500_sub_dirs 100000_sub_dirs clean_test_dir &&
13
+ for i in $(test_seq 1 500)
14
+ do
15
+ mkdir 500_sub_dirs/dir$i || return $?
16
+ done &&
17
+ for i in $(test_seq 1 200)
18
+ do
19
+ cp -r 500_sub_dirs 100000_sub_dirs/dir$i || return $?
20
+ done
21
+'
22
+
23
+test_perf 'clean many untracked sub dirs, check for nested git' '
24
+ git clean -n -q -f -d 100000_sub_dirs/
25
+'
26
+
27
+test_perf 'clean many untracked sub dirs, ignore nested git' '
28
+ git clean -n -q -f -f -d 100000_sub_dirs/
29
+'
30
+
31
+test_done