From: Derrick Stolee via GitGitGadget Date: Thu, 21 Nov 2019 22:20:26 GMT Subject: [PATCH 11/11] test-lib: clear watchman watches at test completion Message-ID: <47cecb4a83a3f726088ffba0b00679384c7349ae.1574374826.git.gitgitgadget@gmail.com> In-Reply-To: From: Derrick Stolee Signed-off-by: Derrick Stolee --- t/test-lib-functions.sh | 15 +++++++++++++++ t/test-lib.sh | 2 ++ 2 files changed, 17 insertions(+) diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index e0b3f28d3a..03573caf42 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -1475,3 +1475,18 @@ test_set_port () { port=$(($port + ${GIT_TEST_STRESS_JOB_NR:-0})) eval $var=$port } + +test_clear_watchman () { + if test $GIT_TEST_FSMONITOR -ne "" + then + watchman watch-list | + grep "$TRASH_DIRECTORY" | + sed "s/\t\"//g" | + sed "s/\",//g" >repo-list + + for repo in $(cat repo-list) + do + watchman watch-del "$repo" + done + fi +} diff --git a/t/test-lib.sh b/t/test-lib.sh index 30b07e310f..067a432ea5 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1072,6 +1072,8 @@ test_atexit_handler () { # sure that the registered cleanup commands are run only once. test : != "$test_atexit_cleanup" || return 0 + test_clear_watchman + setup_malloc_check test_eval_ "$test_atexit_cleanup" test_atexit_cleanup=: -- gitgitgadget