diff mbox series

[v6,5/7] t4216: test changed path filters with high bit paths

Message ID 5276e6a90ecb84cbca3b14a27dc055cf81d27ac3.1689889382.git.jonathantanmy@google.com (mailing list archive)
State Superseded
Headers show
Series Changed path filter hash fix and version bump | expand

Commit Message

Jonathan Tan July 20, 2023, 9:46 p.m. UTC
Subsequent commits will teach Git another version of changed path
filter that has different behavior with paths that contain at least
one character with its high bit set, so test the existing behavior as
a baseline.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t4216-log-bloom.sh | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

Comments

Taylor Blau July 26, 2023, 11:28 p.m. UTC | #1
On Thu, Jul 20, 2023 at 02:46:38PM -0700, Jonathan Tan wrote:
> +test_expect_success 'setup check value of version 1 changed-path' '
> +	(cd highbit1 &&
> +		echo "52a9" >expect &&
> +		get_first_changed_path_filter >actual &&
> +		test_cmp expect actual)
> +'

This is a little bit of funky indentation, I probably would have
expected something more along the lines of:

    (
      cd highbit1 &&
      echo "52a9" >expect &&
      get_first_changed_path_filter >actual &&
      test_cmp expect actual
    )

but this obviously doesn't merit a reroll on its own.

> +test_expect_success 'version 1 changed-path used when version 1 requested' '
> +	(cd highbit1 &&
> +		test_bloom_filters_used "-- $CENT")
> +'

Same here, but neither of these is incorrect.

Thanks,
Taylor
diff mbox series

Patch

diff --git a/t/t4216-log-bloom.sh b/t/t4216-log-bloom.sh
index fa9d32facf..c49528b947 100755
--- a/t/t4216-log-bloom.sh
+++ b/t/t4216-log-bloom.sh
@@ -404,4 +404,43 @@  test_expect_success 'Bloom generation backfills empty commits' '
 	)
 '
 
+get_first_changed_path_filter () {
+	test-tool read-graph bloom-filters >filters.dat &&
+	head -n 1 filters.dat
+}
+
+# chosen to be the same under all Unicode normalization forms
+CENT=$(printf "\302\242")
+
+test_expect_success 'set up repo with high bit path, version 1 changed-path' '
+	git init highbit1 &&
+	test_commit -C highbit1 c1 "$CENT" &&
+	git -C highbit1 commit-graph write --reachable --changed-paths
+'
+
+test_expect_success 'setup check value of version 1 changed-path' '
+	(cd highbit1 &&
+		echo "52a9" >expect &&
+		get_first_changed_path_filter >actual &&
+		test_cmp expect actual)
+'
+
+# expect will not match actual if char is unsigned by default. Write the test
+# in this way, so that a user running this test script can still see if the two
+# files match. (It will appear as an ordinary success if they match, and a skip
+# if not.)
+if test_cmp highbit1/expect highbit1/actual
+then
+	test_set_prereq SIGNED_CHAR_BY_DEFAULT
+fi
+test_expect_success SIGNED_CHAR_BY_DEFAULT 'check value of version 1 changed-path' '
+	# Only the prereq matters for this test.
+	true
+'
+
+test_expect_success 'version 1 changed-path used when version 1 requested' '
+	(cd highbit1 &&
+		test_bloom_filters_used "-- $CENT")
+'
+
 test_done