From: Kristofer Karlsson via GitGitGadget Date: Thu, 06 Aug 2026 10:59:33 GMT Subject: [PATCH v7 02/10] test-lib-functions: improve diagnostic output for trace2 data assertions Message-ID: <57ecc0b18a53ac567c24d90288d75aee16eefc01.1786013982.git.gitgitgadget@gmail.com> In-Reply-To: From: Kristofer Karlsson test_trace2_data is a bare grep that silently exits on failure. Add a more informative variant that verifies the event appears exactly once and reports what went wrong: key not found, multiple entries, or value mismatch. Diagnostics go to FD 4 like test_grep. Before (value mismatch): $ test_trace2_data status count/changed 999 --- t/test-lib-functions.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 809c662124..8c6d327b03 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -1996,6 +1996,41 @@ test_trace2_data () { grep -e '"category":"'"$1"'","key":"'"$2"'","value":"'"$3"'"' } +# Check that the given trace2 data event has the expected value and +# appears exactly once. Produces a diagnostic on failure. +# +# test_trace2_data_singular [