3 test_description
="Perf test for the builtin FSMonitor"
7 if ! test_have_prereq FSMONITOR_DAEMON
9 skip_all
="fsmonitor--daemon is not supported on this platform"
13 test_lazy_prereq UNTRACKED_CACHE
'
14 { git update-index --test-untracked-cache; ret=$?; } &&
18 # Lie to perf-lib and ask for a new empty repo and avoid
19 # the complaints about GIT_PERF_REPO not being big enough
20 # the perf hit when GIT_PERF_LARGE_REPO is copied into
21 # the trash directory.
23 # NEEDSWORK: It would be nice if perf-lib had an option to
24 # "borrow" an existing large repo (especially for gigantic
25 # monorepos) and use it in-place. For now, fake it here.
30 # Use a generated synthetic monorepo. If it doesn't exist, we will
31 # generate it. If it does exist, we will put it in a known state
32 # before we start our timings.
38 PARAMS
="$PARAM_D".
"$PARAM_W".
"$PARAM_F"
40 BALLAST_BR
=p0006-ballast
46 REPO
=..
/repos
/gen-many-files-
"$PARAMS".git
51 (cd ..
/repos
; .
/many-files.sh
-d $PARAM_D -w $PARAM_W -f $PARAM_F)
56 git
-C $REPO config core.untrackedcache true
57 git
-C $REPO update-index
--untracked-cache
58 git
-C $REPO status
>/dev
/null
2>&1
62 git
-C $REPO config core.untrackedcache false
63 git
-C $REPO update-index
--no-untracked-cache
64 git
-C $REPO status
>/dev
/null
2>&1
68 git
-C $REPO fsmonitor--daemon start
69 git
-C $REPO fsmonitor--daemon status
70 git
-C $REPO config core.fsmonitor true
71 git
-C $REPO update-index
--fsmonitor
72 git
-C $REPO status
>/dev
/null
2>&1
76 git
-C $REPO config
--unset core.fsmonitor
77 git
-C $REPO update-index
--no-fsmonitor
78 test_might_fail git
-C $REPO fsmonitor--daemon stop
2>/dev
/null
79 git
-C $REPO status
>/dev
/null
2>&1
83 # Ensure that FSMonitor is turned off on the borrowed repo.
85 test_expect_success
"Setup borrowed repo (fsm+uc)" "
90 # Also ensure that it starts in a known state.
92 # Because we assume that $GIT_PERF_REPEAT_COUNT > 1, we are not going to time
93 # the ballast checkout, since only the first invocation does any work and the
94 # subsequent ones just print "already on branch" and quit, so the reported
97 # Create a temp branch and do all work relative to it so that we don't
98 # accidentially alter the real ballast branch.
100 test_expect_success
"Setup borrowed repo (temp ballast branch)" "
101 test_might_fail git -C $REPO checkout $BALLAST_BR &&
102 test_might_fail git -C $REPO reset --hard &&
103 git -C $REPO clean -d -f &&
104 test_might_fail git -C $REPO branch -D $TMP_BR &&
105 git -C $REPO branch $TMP_BR $BALLAST_BR &&
106 git -C $REPO checkout $TMP_BR
112 # NEEDSWORK: We assume that $GIT_PERF_REPEAT_COUNT > 1. With
113 # FSMonitor enabled, we can get a skewed view of status times, since
114 # the index MAY (or may not) be updated after the first invocation
115 # which will update the FSMonitor Token, so the subsequent invocations
116 # may get a smaller response from the daemon.
122 git -C $REPO status >/dev/null 2>&1
130 t
="[uc $uc][fsm $fsm]"
131 MATRIX_BR
="$TMP_BR-$uc-$fsm"
133 test_expect_success
"$t Setup matrix branch" "
134 git -C $REPO clean -d -f &&
135 git -C $REPO checkout $TMP_BR &&
136 test_might_fail git -C $REPO branch -D $MATRIX_BR &&
137 git -C $REPO branch $MATRIX_BR $TMP_BR &&
138 git -C $REPO checkout $MATRIX_BR
155 do_status
"$t status after checkout"
157 # Modify many files in the matrix branch.
162 test_expect_success
"$t modify tracked files" "
163 find $REPO -name file1 -exec cp data.txt {} \\;
166 do_status
"$t status after big change"
168 # Don't bother timing the "add" because _REPEAT_COUNT
169 # issue described above.
171 test_expect_success
"$t add all" "
175 do_status
"$t status after add all"
177 test_expect_success
"$t add dot" "
181 do_status
"$t status after add dot"
183 test_expect_success
"$t commit staged" "
184 git -C $REPO commit -a -m data
187 do_status
"$t status after commit"
189 test_expect_success
"$t reset HEAD~1 hard" "
190 git -C $REPO reset --hard HEAD~1 >/dev/null 2>&1
193 do_status
"$t status after reset hard"
195 # Create some untracked files.
197 test_expect_success
"$t create untracked files" "
198 cp -R $REPO/ballast/dir1 $REPO/ballast/xxx1
201 do_status
"$t status after create untracked files"
203 # Remove the new untracked files.
205 test_expect_success
"$t clean -df" "
206 git -C $REPO clean -d -f
209 do_status
"$t status after clean"
217 # Begin testing each case in the matrix that we care about.
220 test_have_prereq UNTRACKED_CACHE
&& uc_values
="false true"
222 fsm_values
="false true"
224 for uc_val
in $uc_values
226 for fsm_val
in $fsm_values
228 do_matrix
$uc_val $fsm_val
236 MATRIX_BR
="$TMP_BR-$uc-$fsm"
238 test_might_fail git
-C $REPO branch
-D $MATRIX_BR
242 # We're borrowing this repo. We should leave it in a clean state.
244 test_expect_success
"Cleanup temp and matrix branches" "
245 git -C $REPO clean -d -f &&
246 test_might_fail git -C $REPO checkout $BALLAST_BR &&
247 test_might_fail git -C $REPO branch -D $TMP_BR &&
248 for uc_val in $uc_values
250 for fsm_val in $fsm_values
252 cleanup $uc_val $fsm_val || return 1