[v2,5/8] tests: disable fsmonitor in submodule tests
diff mbox series

Message ID a5b0bf6ac7cd28fa47e26ab481f781d74c656f6a.1575907804.git.gitgitgadget@gmail.com
State New
Headers show
Series
  • Improve testability with GIT_TEST_FSMONITOR
Related show

Commit Message

Heba Waly via GitGitGadget Dec. 9, 2019, 4:10 p.m. UTC
From: Derrick Stolee <dstolee@microsoft.com>

The fsmonitor feature allows an external tool such as watchman to
monitor the working directory. The direct test
t7619-status-fsmonitor.sh provides some coverage, but it would be
better to run the entire test suite with watchman enabled. This
would provide more confidence that the feature is working as
intended.

The fsmonitor feature struggles with submodules. Disable the
GIT_TEST_FSMONITOR environment variable before running tests with
a lot of submodule interactions.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
 t/t3404-rebase-interactive.sh                | 1 +
 t/t3600-rm.sh                                | 1 +
 t/t4060-diff-submodule-option-diff-format.sh | 3 +++
 t/t5526-fetch-submodules.sh                  | 2 ++
 t/t7402-submodule-rebase.sh                  | 3 +++
 t/t7406-submodule-update.sh                  | 2 ++
 t/t7506-status-submodule.sh                  | 3 +++
 t/t7508-status.sh                            | 3 +++
 8 files changed, 18 insertions(+)

Comments

SZEDER Gábor Dec. 10, 2019, 10:13 a.m. UTC | #1
On Mon, Dec 09, 2019 at 04:10:01PM +0000, Derrick Stolee via GitGitGadget wrote:
> From: Derrick Stolee <dstolee@microsoft.com>
> 
> The fsmonitor feature allows an external tool such as watchman to
> monitor the working directory. The direct test
> t7619-status-fsmonitor.sh provides some coverage, but it would be
> better to run the entire test suite with watchman enabled. This
> would provide more confidence that the feature is working as
> intended.
> 
> The fsmonitor feature struggles with submodules. Disable the
> GIT_TEST_FSMONITOR environment variable before running tests with
> a lot of submodule interactions.
> 
> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
> ---
>  t/t3404-rebase-interactive.sh                | 1 +
>  t/t3600-rm.sh                                | 1 +
>  t/t4060-diff-submodule-option-diff-format.sh | 3 +++
>  t/t5526-fetch-submodules.sh                  | 2 ++
>  t/t7402-submodule-rebase.sh                  | 3 +++
>  t/t7406-submodule-update.sh                  | 2 ++
>  t/t7506-status-submodule.sh                  | 3 +++
>  t/t7508-status.sh                            | 3 +++
>  8 files changed, 18 insertions(+)
> 
> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
> index 461dd539ff..9dc7d1aefb 100755
> --- a/t/t3404-rebase-interactive.sh
> +++ b/t/t3404-rebase-interactive.sh
> @@ -697,6 +697,7 @@ test_expect_success 'do "noop" when there is nothing to cherry-pick' '
>  '
>  
>  test_expect_success 'submodule rebase setup' '
> +	GIT_TEST_FSMONITOR="" &&

This disables GIT_TEST_FSMONITOR for the remainder of the test script,
but there are still a lot of non-submodule-specific tests to run.

>  	git checkout A &&
>  	mkdir sub &&
>  	(
> diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
> index 66282a720e..64269bd89d 100755
> --- a/t/t3600-rm.sh
> +++ b/t/t3600-rm.sh
> @@ -355,6 +355,7 @@ test_expect_success 'rm succeeds when given a directory with a trailing /' '
>  '
>  
>  test_expect_success 'rm of a populated submodule with different HEAD fails unless forced' '
> +	GIT_TEST_FSMONITOR="" &&

Likewise.

>  	git reset --hard &&
>  	git submodule update &&
>  	git -C submod checkout HEAD^ &&
> diff --git a/t/t4060-diff-submodule-option-diff-format.sh b/t/t4060-diff-submodule-option-diff-format.sh
> index 9dcb69df5c..017417790e 100755
> --- a/t/t4060-diff-submodule-option-diff-format.sh
> +++ b/t/t4060-diff-submodule-option-diff-format.sh
> @@ -15,6 +15,9 @@ This test tries to verify the sanity of --submodule=diff option of git diff.
>  # Tested non-UTF-8 encoding
>  test_encoding="ISO8859-1"
>  
> +# fsmonitor does not work well with submodules
> +GIT_TEST_FSMONITOR=""
> +
>  # String "added" in German (translated with Google Translate), encoded in UTF-8,
>  # used in sample commit log messages in add_file() function below.
>  added=$(printf "hinzugef\303\274gt")
> diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh
> index 63205dfdf9..fb346bff05 100755
> --- a/t/t5526-fetch-submodules.sh
> +++ b/t/t5526-fetch-submodules.sh
> @@ -1,6 +1,8 @@
>  #!/bin/sh
>  # Copyright (c) 2010, Jens Lehmann
>  
> +GIT_TEST_FSMONITOR=""
> +
>  test_description='Recursive "git fetch" for submodules'
>  
>  . ./test-lib.sh
> diff --git a/t/t7402-submodule-rebase.sh b/t/t7402-submodule-rebase.sh
> index 8e32f19007..c78e9009cf 100755
> --- a/t/t7402-submodule-rebase.sh
> +++ b/t/t7402-submodule-rebase.sh
> @@ -7,6 +7,9 @@ test_description='Test rebasing, stashing, etc. with submodules'
>  
>  . ./test-lib.sh
>  
> +# fsmonitor does not work well with submodules
> +GIT_TEST_FSMONITOR=""
> +
>  test_expect_success setup '
>  
>  	echo file > file &&
> diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
> index c973278300..8d93aaef5f 100755
> --- a/t/t7406-submodule-update.sh
> +++ b/t/t7406-submodule-update.sh
> @@ -11,6 +11,8 @@ submodule and "git submodule update --rebase/--merge" does not detach the HEAD.
>  
>  . ./test-lib.sh
>  
> +# fsmonitor does not work well with submodules
> +GIT_TEST_FSMONITOR=""
>  
>  compare_head()
>  {
> diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh
> index 08629a6e70..1a716f2c2a 100755
> --- a/t/t7506-status-submodule.sh
> +++ b/t/t7506-status-submodule.sh
> @@ -4,6 +4,9 @@ test_description='git status for submodule'
>  
>  . ./test-lib.sh
>  
> +# fsmonitor does not work well with submodules
> +GIT_TEST_FSMONITOR=""
> +
>  test_create_repo_with_commit () {
>  	test_create_repo "$1" &&
>  	(
> diff --git a/t/t7508-status.sh b/t/t7508-status.sh
> index 4e676cdce8..bf0487632d 100755
> --- a/t/t7508-status.sh
> +++ b/t/t7508-status.sh
> @@ -846,6 +846,9 @@ test_expect_success 'status refreshes the index' '
>  	test_cmp expect output
>  '
>  
> +# fsmonitor does not work well with submodules
> +GIT_TEST_FSMONITOR=""
> +

Likewise.

>  test_expect_success 'setup status submodule summary' '
>  	test_create_repo sm && (
>  		cd sm &&
> -- 
> gitgitgadget
>
Derrick Stolee Dec. 10, 2019, 1:57 p.m. UTC | #2
On 12/10/2019 5:13 AM, SZEDER Gábor wrote:
> On Mon, Dec 09, 2019 at 04:10:01PM +0000, Derrick Stolee via GitGitGadget wrote:
>> From: Derrick Stolee <dstolee@microsoft.com>
>>
>> The fsmonitor feature allows an external tool such as watchman to
>> monitor the working directory. The direct test
>> t7619-status-fsmonitor.sh provides some coverage, but it would be
>> better to run the entire test suite with watchman enabled. This
>> would provide more confidence that the feature is working as
>> intended.
>>
>> The fsmonitor feature struggles with submodules. Disable the
>> GIT_TEST_FSMONITOR environment variable before running tests with
>> a lot of submodule interactions.
>>
>> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
>> ---
>>  t/t3404-rebase-interactive.sh                | 1 +
>>  t/t3600-rm.sh                                | 1 +
>>  t/t4060-diff-submodule-option-diff-format.sh | 3 +++
>>  t/t5526-fetch-submodules.sh                  | 2 ++
>>  t/t7402-submodule-rebase.sh                  | 3 +++
>>  t/t7406-submodule-update.sh                  | 2 ++
>>  t/t7506-status-submodule.sh                  | 3 +++
>>  t/t7508-status.sh                            | 3 +++
>>  8 files changed, 18 insertions(+)
>>
>> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
>> index 461dd539ff..9dc7d1aefb 100755
>> --- a/t/t3404-rebase-interactive.sh
>> +++ b/t/t3404-rebase-interactive.sh
>> @@ -697,6 +697,7 @@ test_expect_success 'do "noop" when there is nothing to cherry-pick' '
>>  '
>>  
>>  test_expect_success 'submodule rebase setup' '
>> +	GIT_TEST_FSMONITOR="" &&
> 
> This disables GIT_TEST_FSMONITOR for the remainder of the test script,
> but there are still a lot of non-submodule-specific tests to run.
...
>> diff --git a/t/t7508-status.sh b/t/t7508-status.sh
>> index 4e676cdce8..bf0487632d 100755
>> --- a/t/t7508-status.sh
>> +++ b/t/t7508-status.sh
>> @@ -846,6 +846,9 @@ test_expect_success 'status refreshes the index' '
>>  	test_cmp expect output
>>  '
>>  
>> +# fsmonitor does not work well with submodules
>> +GIT_TEST_FSMONITOR=""
>> +
> 
> Likewise.

Would it make sense to wrap the tests in a subshell without
increasing the tabbing inside the subshell? I can comment
the beginning of the subshell that we are disabling the
variable for a specific list of tests and the subshell can
be removed after the proper fixes make it work.

Thanks,
-Stolee

Patch
diff mbox series

diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 461dd539ff..9dc7d1aefb 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -697,6 +697,7 @@  test_expect_success 'do "noop" when there is nothing to cherry-pick' '
 '
 
 test_expect_success 'submodule rebase setup' '
+	GIT_TEST_FSMONITOR="" &&
 	git checkout A &&
 	mkdir sub &&
 	(
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index 66282a720e..64269bd89d 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -355,6 +355,7 @@  test_expect_success 'rm succeeds when given a directory with a trailing /' '
 '
 
 test_expect_success 'rm of a populated submodule with different HEAD fails unless forced' '
+	GIT_TEST_FSMONITOR="" &&
 	git reset --hard &&
 	git submodule update &&
 	git -C submod checkout HEAD^ &&
diff --git a/t/t4060-diff-submodule-option-diff-format.sh b/t/t4060-diff-submodule-option-diff-format.sh
index 9dcb69df5c..017417790e 100755
--- a/t/t4060-diff-submodule-option-diff-format.sh
+++ b/t/t4060-diff-submodule-option-diff-format.sh
@@ -15,6 +15,9 @@  This test tries to verify the sanity of --submodule=diff option of git diff.
 # Tested non-UTF-8 encoding
 test_encoding="ISO8859-1"
 
+# fsmonitor does not work well with submodules
+GIT_TEST_FSMONITOR=""
+
 # String "added" in German (translated with Google Translate), encoded in UTF-8,
 # used in sample commit log messages in add_file() function below.
 added=$(printf "hinzugef\303\274gt")
diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh
index 63205dfdf9..fb346bff05 100755
--- a/t/t5526-fetch-submodules.sh
+++ b/t/t5526-fetch-submodules.sh
@@ -1,6 +1,8 @@ 
 #!/bin/sh
 # Copyright (c) 2010, Jens Lehmann
 
+GIT_TEST_FSMONITOR=""
+
 test_description='Recursive "git fetch" for submodules'
 
 . ./test-lib.sh
diff --git a/t/t7402-submodule-rebase.sh b/t/t7402-submodule-rebase.sh
index 8e32f19007..c78e9009cf 100755
--- a/t/t7402-submodule-rebase.sh
+++ b/t/t7402-submodule-rebase.sh
@@ -7,6 +7,9 @@  test_description='Test rebasing, stashing, etc. with submodules'
 
 . ./test-lib.sh
 
+# fsmonitor does not work well with submodules
+GIT_TEST_FSMONITOR=""
+
 test_expect_success setup '
 
 	echo file > file &&
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index c973278300..8d93aaef5f 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -11,6 +11,8 @@  submodule and "git submodule update --rebase/--merge" does not detach the HEAD.
 
 . ./test-lib.sh
 
+# fsmonitor does not work well with submodules
+GIT_TEST_FSMONITOR=""
 
 compare_head()
 {
diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh
index 08629a6e70..1a716f2c2a 100755
--- a/t/t7506-status-submodule.sh
+++ b/t/t7506-status-submodule.sh
@@ -4,6 +4,9 @@  test_description='git status for submodule'
 
 . ./test-lib.sh
 
+# fsmonitor does not work well with submodules
+GIT_TEST_FSMONITOR=""
+
 test_create_repo_with_commit () {
 	test_create_repo "$1" &&
 	(
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index 4e676cdce8..bf0487632d 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -846,6 +846,9 @@  test_expect_success 'status refreshes the index' '
 	test_cmp expect output
 '
 
+# fsmonitor does not work well with submodules
+GIT_TEST_FSMONITOR=""
+
 test_expect_success 'setup status submodule summary' '
 	test_create_repo sm && (
 		cd sm &&