git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: git@vger.kernel.org
Cc: "Derrick Stolee" <stolee@gmail.com>,
	"Thomas Gummerer" <t.gummerer@gmail.com>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"SZEDER Gábor" <szeder.dev@gmail.com>
Subject: [PATCH v2 5/6] tests: disable GIT_TEST_SPLIT_INDEX for sparse index tests
Date: Thu, 26 Aug 2021 23:00:03 +0200	[thread overview]
Message-ID: <20210826210004.672860-6-szeder.dev@gmail.com> (raw)
In-Reply-To: <20210826210004.672860-1-szeder.dev@gmail.com>

The sparse index and split index features are said to be currently
incompatible [1], and consequently GIT_TEST_SPLIT_INDEX=1 might
interfere with the test cases exercising the sparse index feature.
Therefore GIT_TEST_SPLIT_INDEX is already explicitly disabled for the
whole of 't1092-sparse-checkout-compatibility.sh'.  There are,
however, two other test cases exercising sparse index, namely
'sparse-index enabled and disabled' in
't1091-sparse-checkout-builtin.sh' and 'status succeeds with sparse
index' in 't7519-status-fsmonitor.sh', and these two could fail with
GIT_TEST_SPLIT_INDEX=1 as well [2].

Unset GIT_TEST_SPLIT_INDEX and disable the split index in these two
test cases to avoid such interference.

Note that this is the minimal change to merely avoid failures when
these test cases are run with GIT_TEST_SPLIT_INDEX=1.  Interestingly,
though, without these changes the 'git sparse-checkout init --cone
--sparse-index' commands still succeed even with split index, and set
all the necessary configuration variables and create the initial
'$GIT_DIR/info/sparse-checkout' file, but the test failures are caused
by later sanity checks finding that the index is not in fact a sparse
index.  This indicates that 'git sparse-checkout init --sparse-index'
lacks some error checking and its tests lack coverage related to split
index, but fixing those issues is beyond the scope of this patch
series.

[1] https://public-inbox.org/git/48e9c3d6-407a-1843-2d91-22112410e3f8@gmail.com/

[2] Neither of these test cases fail at the moment, because
    GIT_TEST_SPLIT_INDEX=1 is broken and never splits the index, and
    it broke long before the sparse index feature was added.
    This patch series is about to fix GIT_TEST_SPLIT_INDEX, and then
    both test cases mentioned above would fail.

(The diff is best viewed with '--ignore-all-space')

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
---
 t/t1091-sparse-checkout-builtin.sh | 25 ++++++-----
 t/t7519-status-fsmonitor.sh        | 68 ++++++++++++++++--------------
 2 files changed, 51 insertions(+), 42 deletions(-)

diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh
index 38fc8340f5..3f94c41241 100755
--- a/t/t1091-sparse-checkout-builtin.sh
+++ b/t/t1091-sparse-checkout-builtin.sh
@@ -206,16 +206,21 @@ test_expect_success 'sparse-checkout disable' '
 '
 
 test_expect_success 'sparse-index enabled and disabled' '
-	git -C repo sparse-checkout init --cone --sparse-index &&
-	test_cmp_config -C repo true index.sparse &&
-	test-tool -C repo read-cache --table >cache &&
-	grep " tree " cache &&
-
-	git -C repo sparse-checkout disable &&
-	test-tool -C repo read-cache --table >cache &&
-	! grep " tree " cache &&
-	git -C repo config --list >config &&
-	! grep index.sparse config
+	(
+		sane_unset GIT_TEST_SPLIT_INDEX &&
+		git -C repo update-index --no-split-index &&
+
+		git -C repo sparse-checkout init --cone --sparse-index &&
+		test_cmp_config -C repo true index.sparse &&
+		test-tool -C repo read-cache --table >cache &&
+		grep " tree " cache &&
+
+		git -C repo sparse-checkout disable &&
+		test-tool -C repo read-cache --table >cache &&
+		! grep " tree " cache &&
+		git -C repo config --list >config &&
+		! grep index.sparse config
+	)
 '
 
 test_expect_success 'cone mode: init and set' '
diff --git a/t/t7519-status-fsmonitor.sh b/t/t7519-status-fsmonitor.sh
index 6f2cf306f6..451734b9c2 100755
--- a/t/t7519-status-fsmonitor.sh
+++ b/t/t7519-status-fsmonitor.sh
@@ -399,41 +399,45 @@ check_sparse_index_behavior () {
 }
 
 test_expect_success 'status succeeds with sparse index' '
-	git clone . full &&
-	git clone . sparse &&
-	git -C sparse sparse-checkout init --cone --sparse-index &&
-	git -C sparse sparse-checkout set dir1 dir2 &&
+	(
+		sane_unset GIT_TEST_SPLIT_INDEX &&
 
-	write_script .git/hooks/fsmonitor-test <<-\EOF &&
-		printf "last_update_token\0"
-	EOF
-	git -C full config core.fsmonitor ../.git/hooks/fsmonitor-test &&
-	git -C sparse config core.fsmonitor ../.git/hooks/fsmonitor-test &&
-	check_sparse_index_behavior ! &&
+		git clone . full &&
+		git clone . sparse &&
+		git -C sparse sparse-checkout init --cone --sparse-index &&
+		git -C sparse sparse-checkout set dir1 dir2 &&
 
-	write_script .git/hooks/fsmonitor-test <<-\EOF &&
-		printf "last_update_token\0"
-		printf "dir1/modified\0"
-	EOF
-	check_sparse_index_behavior ! &&
-
-	git -C sparse sparse-checkout add dir1a &&
+		write_script .git/hooks/fsmonitor-test <<-\EOF &&
+			printf "last_update_token\0"
+		EOF
+		git -C full config core.fsmonitor ../.git/hooks/fsmonitor-test &&
+		git -C sparse config core.fsmonitor ../.git/hooks/fsmonitor-test &&
+		check_sparse_index_behavior ! &&
 
-	for repo in full sparse
-	do
-		cp -r $repo/dir1 $repo/dir1a &&
-		git -C $repo add dir1a &&
-		git -C $repo commit -m "add dir1a" || return 1
-	done &&
-	git -C sparse sparse-checkout set dir1 dir2 &&
-
-	# This one modifies outside the sparse-checkout definition
-	# and hence we expect to expand the sparse-index.
-	write_script .git/hooks/fsmonitor-test <<-\EOF &&
-		printf "last_update_token\0"
-		printf "dir1a/modified\0"
-	EOF
-	check_sparse_index_behavior
+		write_script .git/hooks/fsmonitor-test <<-\EOF &&
+			printf "last_update_token\0"
+			printf "dir1/modified\0"
+		EOF
+		check_sparse_index_behavior ! &&
+
+		git -C sparse sparse-checkout add dir1a &&
+
+		for repo in full sparse
+		do
+			cp -r $repo/dir1 $repo/dir1a &&
+			git -C $repo add dir1a &&
+			git -C $repo commit -m "add dir1a" || return 1
+		done &&
+		git -C sparse sparse-checkout set dir1 dir2 &&
+
+		# This one modifies outside the sparse-checkout definition
+		# and hence we expect to expand the sparse-index.
+		write_script .git/hooks/fsmonitor-test <<-\EOF &&
+			printf "last_update_token\0"
+			printf "dir1a/modified\0"
+		EOF
+		check_sparse_index_behavior
+	)
 '
 
 test_done
-- 
2.33.0.358.g803110d36e


  parent reply	other threads:[~2021-08-26 21:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-17 17:49 [PATCH 0/6] Fix GIT_TEST_SPLIT_INDEX SZEDER Gábor
2021-08-17 17:49 ` [PATCH 1/6] t1600-index: remove unnecessary redirection SZEDER Gábor
2021-08-17 18:12   ` Derrick Stolee
2021-08-17 18:39     ` SZEDER Gábor
2021-08-17 18:48       ` Derrick Stolee
2021-08-17 17:49 ` [PATCH 2/6] t1600-index: don't run git commands upstream of a pipe SZEDER Gábor
2021-08-17 17:49 ` [PATCH 3/6] t1600-index: disable GIT_TEST_SPLIT_INDEX SZEDER Gábor
2021-08-17 17:49 ` [PATCH 4/6] read-cache: look for shared index files next to the index, too SZEDER Gábor
2021-08-17 17:49 ` [PATCH 5/6] tests: disable GIT_TEST_SPLIT_INDEX for sparse index tests SZEDER Gábor
2021-08-17 18:26   ` Derrick Stolee
2021-08-17 21:32     ` SZEDER Gábor
2021-08-18 18:51       ` Derrick Stolee
2021-08-17 17:49 ` [PATCH 6/6] read-cache: fix GIT_TEST_SPLIT_INDEX SZEDER Gábor
2021-08-17 18:29   ` Derrick Stolee
2021-08-26 20:59 ` [PATCH v2 0/6] Fix GIT_TEST_SPLIT_INDEX SZEDER Gábor
2021-08-26 20:59   ` [PATCH v2 1/6] t1600-index: remove unnecessary redirection SZEDER Gábor
2021-08-26 21:00   ` [PATCH v2 2/6] t1600-index: don't run git commands upstream of a pipe SZEDER Gábor
2021-08-26 21:00   ` [PATCH v2 3/6] t1600-index: disable GIT_TEST_SPLIT_INDEX SZEDER Gábor
2021-08-26 21:00   ` [PATCH v2 4/6] read-cache: look for shared index files next to the index, too SZEDER Gábor
2021-08-26 21:00   ` SZEDER Gábor [this message]
2021-08-26 21:00   ` [PATCH v2 6/6] read-cache: fix GIT_TEST_SPLIT_INDEX SZEDER Gábor
2021-08-31 14:47   ` [PATCH v2 0/6] Fix GIT_TEST_SPLIT_INDEX Derrick Stolee
2021-08-31 17:38     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210826210004.672860-6-szeder.dev@gmail.com \
    --to=szeder.dev@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    --cc=stolee@gmail.com \
    --cc=t.gummerer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).