aboutsummaryrefslogtreecommitdiff
path: root/t/t5710-promisor-remote-capability.sh
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2026-02-23 17:00:06 +0100
committerJunio C Hamano <gitster@pobox.com>2026-02-23 13:19:00 -0800
commit26fc7b59cd00ee4042494b0a01afbda62c9d5b1a (patch)
tree31ec2c830d182a060202f00c3b383d5c7dd2df56 /t/t5710-promisor-remote-capability.sh
parent67ad42147a7acc2af6074753ebd03d904476118f (diff)
downloadgit-26fc7b59cd00ee4042494b0a01afbda62c9d5b1a.tar.xz
t/helper: improve "genrandom" test helper
The `test-tool genrandom` test helper can be used to generate random data, either as an infinite stream or with a specified number of bytes. The way we handle parsing the number of bytes is lacking though: - We don't have good error handling, so if the caller for example uses `test-tool genrandom 200xyz` then we'll end up generating 200 bytes of random data successfully. - Many callers want to generate e.g. 1 kilobyte or megabyte of data, but they have to either use unwieldy numbers like 1048576, or they have to precompute them. Fix both of these issues by using `git_parse_ulong()` to parse the argument. This function has better error handling, and it knows to handle unit suffixes. Adapt a couple of our tests to use suffixes instead of manual computations. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5710-promisor-remote-capability.sh')
-rwxr-xr-xt/t5710-promisor-remote-capability.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t5710-promisor-remote-capability.sh b/t/t5710-promisor-remote-capability.sh
index 023735d6a8..66af84cd56 100755
--- a/t/t5710-promisor-remote-capability.sh
+++ b/t/t5710-promisor-remote-capability.sh
@@ -20,7 +20,7 @@ test_expect_success 'setup: create "template" repository' '
test_commit -C template 1 &&
test_commit -C template 2 &&
test_commit -C template 3 &&
- test-tool genrandom foo 10240 >template/foo &&
+ test-tool genrandom foo 10k >template/foo &&
git -C template add foo &&
git -C template commit -m foo
'
@@ -376,7 +376,7 @@ test_expect_success "clone with promisor.advertise set to 'true' but don't delet
test_expect_success "setup for subsequent fetches" '
# Generate new commit with large blob
- test-tool genrandom bar 10240 >template/bar &&
+ test-tool genrandom bar 10k >template/bar &&
git -C template add bar &&
git -C template commit -m bar &&