[PATCH/WIP v2 08/14] read-cache: add GIT_TEST_FORCE_WATCHER for testing

2014-01-17 Thread Nguyễn Thái Ngọc Duy
This can be used to force watcher on when running the test
suite.

git-file-watcher processes are not automatically cleaned up after each
test. So after running the test suite you'll be left with plenty
git-file-watcher processes that should all end after about a minute.

Signed-off-by: Nguyễn Thái Ngọc Duy 
---
 read-cache.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/read-cache.c b/read-cache.c
index 5dae9eb..a1245d4 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1544,7 +1544,12 @@ static void validate_watcher(struct index_state *istate, 
const char *path)
}
 
if (autorun_watcher == -1) {
-   git_config(watcher_config, NULL);
+   if (getenv("GIT_TEST_FORCE_WATCHER")) {
+   watch_lowerlimit = 0;
+   recent_limit = 0;
+   autorun_watcher = 1;
+   } else
+   git_config(watcher_config, NULL);
if (autorun_watcher == -1)
autorun_watcher = 0;
}
-- 
1.8.5.1.208.g05b12ea

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


Re: [PATCH/WIP v2 08/14] read-cache: add GIT_TEST_FORCE_WATCHER for testing

2014-01-19 Thread Thomas Rast
Nguyễn Thái Ngọc Duy  writes:

> This can be used to force watcher on when running the test
> suite.
>
> git-file-watcher processes are not automatically cleaned up after each
> test. So after running the test suite you'll be left with plenty
> git-file-watcher processes that should all end after about a minute.

Probably not a very good idea, especially in noninteractive use?  E.g.,
a bisection through the test suite or parallel test runs on different
commits may exhaust the available processes and/or memory.

Each test should make an effort to clean up all watchers before
terminating.

> Signed-off-by: Nguyễn Thái Ngọc Duy 
> ---
>  read-cache.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/read-cache.c b/read-cache.c
> index 5dae9eb..a1245d4 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -1544,7 +1544,12 @@ static void validate_watcher(struct index_state 
> *istate, const char *path)
>   }
>  
>   if (autorun_watcher == -1) {
> - git_config(watcher_config, NULL);
> + if (getenv("GIT_TEST_FORCE_WATCHER")) {
> + watch_lowerlimit = 0;
> + recent_limit = 0;
> + autorun_watcher = 1;
> + } else
> + git_config(watcher_config, NULL);
>   if (autorun_watcher == -1)
>   autorun_watcher = 0;
>   }

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


Re: [PATCH/WIP v2 08/14] read-cache: add GIT_TEST_FORCE_WATCHER for testing

2014-01-19 Thread Duy Nguyen
On Mon, Jan 20, 2014 at 12:04 AM, Thomas Rast  wrote:
> Nguyễn Thái Ngọc Duy  writes:
>
>> This can be used to force watcher on when running the test
>> suite.
>>
>> git-file-watcher processes are not automatically cleaned up after each
>> test. So after running the test suite you'll be left with plenty
>> git-file-watcher processes that should all end after about a minute.
>
> Probably not a very good idea, especially in noninteractive use?  E.g.,
> a bisection through the test suite or parallel test runs on different
> commits may exhaust the available processes and/or memory.

I think we run out of inotify resources before hitting process/memory
limits. At least that's the case when running tests in parallel.

> Each test should make an effort to clean up all watchers before
> terminating.

For now it's hard to do this correctly. Maybe once we get the
multi-repo file watcher, we could launch one watcher per trash
directory and cleaning up would be easier.
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html