Skip to content

Commit cc2d43b

Browse files
ttaylorrgitster
authored andcommitted
p7519: allow running without watchman prereq
p7519 measures the performance of the fsmonitor code. To do this, it uses the installed copy of Watchman. If Watchman isn't installed, a noop integration script is installed in its place. When in the latter mode, it is expected that the script should not write a "last update token": in fact, it doesn't write anything at all since the script is blank. Commit 33226af (t/perf/fsmonitor: improve error message if typoing hook name, 2020-10-26) made sure that running 'git update-index --fsmonitor' did not write anything to stderr, but this is not the case when using the empty Watchman script, since Git will complain that: $ which watchman watchman not found $ cat .git/hooks/fsmonitor-empty $ git -c core.fsmonitor=.git/hooks/fsmonitor-empty update-index --fsmonitor warning: Empty last update token. Prior to 33226af, the output wasn't checked at all, which allowed this noop mode to work. But, 33226af breaks p7519 when running it without a 'watchman(1)' on your system. Handle this by only checking that the stderr is empty only when running with a real watchman executable. Otherwise, assert that the error message is the expected one when running in the noop mode. Signed-off-by: Taylor Blau <[email protected]> Acked-by: Nipunn Koorapati <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 36fa907 commit cc2d43b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

t/perf/p7519-fsmonitor.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,12 @@ setup_for_fsmonitor() {
129129

130130
git config core.fsmonitor "$INTEGRATION_SCRIPT" &&
131131
git update-index --fsmonitor 2>error &&
132-
test_must_be_empty error # ensure no silent error
132+
if test_have_prereq WATCHMAN
133+
then
134+
test_must_be_empty error # ensure no silent error
135+
else
136+
grep "Empty last update token" error
137+
fi
133138
}
134139

135140
test_perf_w_drop_caches () {

0 commit comments

Comments
 (0)