[PATCH v3 21/26] Support running file watcher with the test suite

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]