summaryrefslogtreecommitdiff
path: root/t/perf/p7519-fsmonitor.sh
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2021-01-04 21:35:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-01-06 21:48:25 (GMT)
commitcc2d43be2bc93f7016ee97b8d78a79d771e017e4 (patch)
tree21dbe941680c8bf608d18a06c75bb851178dc290 /t/perf/p7519-fsmonitor.sh
parent36fa907d7a10c9c9c22009640ab9750adc04230d (diff)
downloadgit-cc2d43be2bc93f7016ee97b8d78a79d771e017e4.zip
git-cc2d43be2bc93f7016ee97b8d78a79d771e017e4.tar.gz
git-cc2d43be2bc93f7016ee97b8d78a79d771e017e4.tar.bz2
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 33226af42b (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 33226af42b, the output wasn't checked at all, which allowed this noop mode to work. But, 33226af42b 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 <me@ttaylorr.com> Acked-by: Nipunn Koorapati <nipunn@dropbox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/perf/p7519-fsmonitor.sh')
-rwxr-xr-xt/perf/p7519-fsmonitor.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/t/perf/p7519-fsmonitor.sh b/t/perf/p7519-fsmonitor.sh
index 9b43342..1e20a18 100755
--- a/t/perf/p7519-fsmonitor.sh
+++ b/t/perf/p7519-fsmonitor.sh
@@ -129,7 +129,12 @@ setup_for_fsmonitor() {
git config core.fsmonitor "$INTEGRATION_SCRIPT" &&
git update-index --fsmonitor 2>error &&
- test_must_be_empty error # ensure no silent error
+ if test_have_prereq WATCHMAN
+ then
+ test_must_be_empty error # ensure no silent error
+ else
+ grep "Empty last update token" error
+ fi
}
test_perf_w_drop_caches () {