|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +test_description="Test core.fsmonitor" |
| 4 | + |
| 5 | +. ./perf-lib.sh |
| 6 | + |
| 7 | +test_perf_large_repo |
| 8 | +test_checkout_worktree |
| 9 | + |
| 10 | +test_expect_success 'setup' ' |
| 11 | + # Maybe set untrackedCache & splitIndex depending on the |
| 12 | + # environment, defaulting to false. |
| 13 | + if test -n "$GIT_PERF_7519_UNTRACKED_CACHE" |
| 14 | + then |
| 15 | + git config core.untrackedCache true |
| 16 | + else |
| 17 | + git config core.untrackedCache false |
| 18 | + fi && |
| 19 | + if test -n "$GIT_PERF_7519_SPLIT_INDEX" |
| 20 | + then |
| 21 | + git config core.splitIndex true |
| 22 | + else |
| 23 | + git config core.splitIndex false |
| 24 | + fi && |
| 25 | +
|
| 26 | + # Relies on core.fsmonitor not being merged into master. Needs |
| 27 | + # better per-test ways to disable it if it gets merged. |
| 28 | + git config core.fsmonitor true && |
| 29 | +
|
| 30 | + # Hook scaffolding |
| 31 | + mkdir .git/hooks && |
| 32 | + cp ../../../templates/hooks--query-fsmonitor.sample .git/hooks/query-fsmonitor && |
| 33 | +
|
| 34 | + # Setup watchman & ensure it is actually watching |
| 35 | + watchman watch-del "$PWD" >/dev/null 2>&1 && |
| 36 | + watchman watch "$PWD" >/dev/null 2>&1 && |
| 37 | + watchman watch-list | grep -q -F "$PWD" |
| 38 | +' |
| 39 | + |
| 40 | +# Setting: |
| 41 | +# |
| 42 | +# GIT_PERF_REPEAT_COUNT=1 GIT_PERF_MAKE_COMMAND='sudo sync && echo 3 | sudo tee /proc/sys/vm/drop_caches && make -j8' |
| 43 | +# |
| 44 | +# Can be used as a hack to performance test 'git status' on a cold fs |
| 45 | +# cache with an existing watchman watching the directory, which should |
| 46 | +# be blindingly fast, compared to amazingly slow without watchman. |
| 47 | +test_perf 'status (first)' 'git status' |
| 48 | + |
| 49 | + |
| 50 | +# The same git-status once the fs cache has been warmed, if using the |
| 51 | +# GIT_PERF_MAKE_COMMAND above. Otherwise the same as above. |
| 52 | +test_perf 'status (subsequent)' 'git status' |
| 53 | + |
| 54 | +# Let's see if -uno & -uall make any difference |
| 55 | +test_perf 'status -uno' 'git status -uno' |
| 56 | +test_perf 'status -uall' 'git status -uall' |
| 57 | + |
| 58 | +test_done |
0 commit comments