Subject: Re: [PATCH v2 5/6] p5313: add size comparison test

From: Derrick Stolee <[email-masked]>
Date: Sun, 22 Sep 2024 21:50:07 -0400

On 9/19/24 5:58 PM, Junio C Hamano wrote:
> "Derrick Stolee via GitGitGadget" <[email-masked]> writes:

>>   t/perf/p5313-pack-objects.sh | 71 ++++++++++++++++++++++++++++++++++++
>>   1 file changed, 71 insertions(+)
>>   create mode 100755 t/perf/p5313-pack-objects.sh
> 
> "wc -c" -> "test_file_size" or "test-tool path-utils file-size"?

Thanks. I was unfamiliar with those options.

I will squash this change into the next version. The use of a
variable for the packfile name was important at some point while
I was testing this with various repos on different platforms.

--- >8 ---

diff --git a/t/perf/p5313-pack-objects.sh b/t/perf/p5313-pack-objects.sh
index 5dcf52acb0..bf6f0d69e4 100755
--- a/t/perf/p5313-pack-objects.sh
+++ b/t/perf/p5313-pack-objects.sh
@@ -25,7 +25,7 @@ test_perf 'thin pack' '
  '

  test_size 'thin pack size' '
-	wc -c <out
+	test_file_size out
  '

  test_perf 'thin pack with --full-name-hash' '
@@ -33,7 +33,7 @@ test_perf 'thin pack with --full-name-hash' '
  '

  test_size 'thin pack size with --full-name-hash' '
-	wc -c <out
+	test_file_size out
  '

  test_perf 'big pack' '
@@ -41,7 +41,7 @@ test_perf 'big pack' '
  '

  test_size 'big pack size' '
-	wc -c <out
+	test_file_size out
  '

  test_perf 'big pack with --full-name-hash' '
@@ -49,7 +49,7 @@ test_perf 'big pack with --full-name-hash' '
  '

  test_size 'big pack size with --full-name-hash' '
-	wc -c <out
+	test_file_size out
  '

  test_perf 'repack' '
@@ -57,7 +57,8 @@ test_perf 'repack' '
  '

  test_size 'repack size' '
-	wc -c <.git/objects/pack/pack-*.pack
+	pack=$(ls .git/objects/pack/pack-*.pack) &&
+	test_file_size "$pack"
  '

  test_perf 'repack with --full-name-hash' '
@@ -65,7 +66,8 @@ test_perf 'repack with --full-name-hash' '
  '

  test_size 'repack size with --full-name-hash' '
-	wc -c <.git/objects/pack/pack-*.pack
+	pack=$(ls .git/objects/pack/pack-*.pack) &&
+	test_file_size "$pack"
  '

  test_done