[PATCH v3 21/26] Support running file watcher with the test suite
- From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Date
- Feb 3, 2014, 04:29 UTC
- Message-ID
- <1391401754-15347-22-git-send-email-pclouds@gmail.com>
- In-Reply-To
- <1391401754-15347-1-git-send-email-pclouds@gmail.com>
This is to force running the test suite with file-watcher with
$ mkdir /tmp/watcher $ chmod 700 /tmp/watcher $ git-file-watcher /tmp/watcher/
then open another terminal and run
$ export GIT_TEST_WATCHED=2 GIT_TEST_WATCHER=2 $ export GIT_TEST_WATCHER_PATH=/tmp/watcher $ make test
TIME_WAIT set set to unlimited by GIT_TEST_WATCHER=2 so the test suite could hang up indefinitely due to a file-watcher bug. Luckily everything passes.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> --- file-watcher-lib.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/file-watcher-lib.c b/file-watcher-lib.c index b6b0848..93afb52 100644 --- a/file-watcher-lib.c +++ b/file-watcher-lib.c @@ -136,6 +136,7 @@ void open_watcher(struct index_state *istate) } if (!read_config) { + const char *s; int i; /* * can't hook into git_default_config because @@ -149,6 +150,18 @@ void open_watcher(struct index_state *istate) if (i == istate->cache_nr) recent_limit = 0; read_config = 1; + + s = getenv("GIT_TEST_WATCHER"); + if (s) { + watch_lowerlimit = 1; + recent_limit = 0; + WAIT_TIME = -1; + if (atoi(s) > 1) + istate->update_watches = 1; + s = getenv("GIT_TEST_WATCHER_PATH"); + if (s) + watcher_path = xstrdup(s); + } } istate->watcher = connect_watcher(watcher_path);
-- 1.8.5.2.240.g8478abd