diff --git a/t/t3500-cherry.sh b/t/t3500-cherry.sh index 3e66827d7641d8..77715318de4927 100755 --- a/t/t3500-cherry.sh +++ b/t/t3500-cherry.sh @@ -92,7 +92,7 @@ test_expect_success 'cherry in partial clone does bulk prefetch' ' grep "child_start.*fetch.negotiationAlgorithm" trace.output >fetches && test_line_count = 1 fetches && - test_trace2_data promisor fetch_count 4 revs2 && @@ -160,8 +160,8 @@ test_expect_success 'backfill --sparse' ' # older versions of the four files at tip. GIT_TRACE2_EVENT="$(pwd)/sparse-trace1" git \ -C backfill3 backfill --sparse && - test_trace2_data promisor fetch_count 4 missing && test_line_count = 40 missing && @@ -172,8 +172,8 @@ test_expect_success 'backfill --sparse' ' git -C backfill3 sparse-checkout set d && GIT_TRACE2_EVENT="$(pwd)/sparse-trace2" git \ -C backfill3 backfill --sparse && - test_trace2_data promisor fetch_count 8 missing && test_line_count = 24 missing && @@ -194,8 +194,8 @@ test_expect_success 'backfill auto-detects sparse-checkout from config' ' GIT_TRACE2_EVENT="$(pwd)/auto-sparse-trace" git \ -C backfill-auto-sparse backfill && - test_trace2_data promisor fetch_count 4 missing && test_line_count = 36 missing ' @@ -246,11 +246,11 @@ test_expect_success 'backfill --sparse without cone mode (negative)' ' GIT_TRACE2_EVENT="$(pwd)/no-cone-trace2" git \ -C backfill5 backfill --sparse && - test_trace2_data promisor fetch_count 18 missing && test_line_count = 12 missing ' @@ -268,7 +268,7 @@ test_expect_success 'backfill with revision range' ' GIT_TRACE2_EVENT="$(pwd)/backfill-trace" git -C backfill-revs backfill HEAD~2..HEAD && # 36 objects downloaded, 12 still missing - test_trace2_data promisor fetch_count 36 missing && test_line_count = 12 missing ' @@ -288,10 +288,10 @@ test_expect_success 'backfill with revisions over stdin' ' ^HEAD~2 EOF - GIT_TRACE2_EVENT="$(pwd)/backfill-trace" git -C backfill-revs backfill --stdin missing && test_line_count = 12 missing ' @@ -523,7 +523,7 @@ test_expect_success 'backfilling over HTTP succeeds' ' -C backfill-http backfill && # We should have engaged the partial clone machinery - test_trace2_data promisor fetch_count 48 rev-list-out && diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh index d61c4a4d73c390..3f8f4723956223 100755 --- a/t/t7810-grep.sh +++ b/t/t7810-grep.sh @@ -1964,8 +1964,8 @@ test_expect_success 'grep of revision in partial clone batches prefetch and hono # Exactly the two a/*.txt blobs should have been requested, and # the server packed those two objects in the response. - test_trace2_data promisor fetch_count 2 result && test_line_count = 2 result && - test_trace2_data promisor fetch_count 1 +test_trace2_data_singular () { + local category="$1" key="$2" expect_val="$3" + local kv_pattern='"category":"'"$category"'","key":"'"$key"'","value":"\([^"]*\)"' + local actual + + actual=$(sed -n "s|.*${kv_pattern}.*|\1|p") && + + if test -z "$actual" + then + echo >&4 "error: trace2 data '$category/$key' not found" + return 1 + fi && + + case "$actual" in + *" +"*) + echo >&4 "error: trace2 data '$category/$key' has multiple entries, expected 1" + printf '%s\n' "$actual" | sed 's/^/ actual: /' >&4 + return 1 + ;; + esac && + + if test "$actual" != "$expect_val" + then + echo >&4 "error: trace2 data '$category/$key'" + echo >&4 " expected: $expect_val" + echo >&4 " actual: $actual" + return 1 + fi +} + # Given a GIT_TRACE2_EVENT log over stdin, writes to stdout a list of URLs # sent to git-remote-https child processes. test_remote_https_urls() {