git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] t/perf: use 'test_file_size' in more places

From
Taylor Blau <me@ttaylorr.com>
Date
Nov 21, 2024, 20:29 UTC
Message-ID
<50c1368630684f235548d2e9a68d4de3745b5fe6.1732220875.git.me@ttaylorr.com>

The perf test suite prefers to use test_file_size over 'wc -c' when inside of a test_size block. One advantage is that accidentally writign "wc -c file" (instead of "wc -c <file") does not inadvertently break the tests (since the former will include the filename in the output of wc).

Both of the two uses of test_size use "wc -c", but let's convert those to the more conventional test_file_size helper instead.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
I noticed while reviewing Stolee's --full-name-hash series that he added
new test_size tests that use the test_file_size helper instead of "wc
-c". I thought it would be good to clean up the existing uses of "wc -c"
in the perf suite as a result, which is what this patch does.
 t/perf/p5311-pack-bitmaps-fetch.sh | 2 +-
 t/perf/p5332-multi-pack-reuse.sh   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/perf/p5311-pack-bitmaps-fetch.sh b/t/perf/p5311-pack-bitmaps-fetch.sh
index 426fab87e32..047efb995d6 100755
--- a/t/perf/p5311-pack-bitmaps-fetch.sh
+++ b/t/perf/p5311-pack-bitmaps-fetch.sh
@@ -39,7 +39,7 @@ test_fetch_bitmaps () {
 		'

 		test_size "size   $title" '
-			wc -c <tmp.pack
+			test_file_size tmp.pack
 		'

 		test_perf "client $title (lookup=$1)" '
diff --git a/t/perf/p5332-multi-pack-reuse.sh b/t/perf/p5332-multi-pack-reuse.sh
index 5c6c575d62c..d1c89a8b7db 100755
--- a/t/perf/p5332-multi-pack-reuse.sh
+++ b/t/perf/p5332-multi-pack-reuse.sh
@@ -73,7 +73,7 @@ do
 		"

 		test_size "clone size for $nr_packs-pack scenario ($reuse-pack reuse)" '
-			wc -c <result
+			test_file_size result
 		'
 	done
 done

base-commit: 4083a6f05206077a50af7658bedc17a94c54607d
--
2.47.0.237.gc601277f4c4
Next: Junio C Hamano
Message 1 of 3 in “t/perf: use 'test_file_size' in more places”
  1. t/perf: use 'test_file_size' in more placesTaylor Blau, Nov 21, 2024
  2. Junio C HamanoNov 22, 2024
  3. Jeff KingNov 22, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.