Skip to content

Commit

Permalink
fixup! t9390: modify --analyze test to pass under zlib-ng
Browse files Browse the repository at this point in the history
  • Loading branch information
newren committed Oct 4, 2024
1 parent 9bd925e commit 01e5a88
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions t/t9390-filter-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,19 @@ test_expect_success C_LOCALE_OUTPUT '--analyze' '
(
cd analyze_me &&
# Detect whether zlib or zlib-ng are in use; they give
# slightly different compression
echo 0bd4c13bc1d771633ae12014e7c0ce0d2e36f123 >expect &&
python -c "print((\"test\"+chr(13)) * 1000, end=\"\")" >tempfile &&
ls -l tempfile &&
wc -c tempfile &&
python -c "print((\"test\"+chr(13)) * 1000, end=\"\")" | git hash-object -w --stdin >actual &&
test_cmp expect actual &&
compressed_size=$(python -c "import os; print(os.path.getsize(\".git/objects/0b/d4c13bc1d771633ae12014e7c0ce0d2e36f123\"))") &&
zlibng=$(( (73-${compressed_size})/3*2 )) &&
test $zlibng -eq "0" -o $zlibng -eq "2" &&
# Now do the analysis
git filter-repo --analyze &&
# It should not work again without a --force
Expand Down Expand Up @@ -785,16 +798,16 @@ test_expect_success C_LOCALE_OUTPUT '--analyze' '
Number of file extensions: 2
Total unpacked size (bytes): 206
Total packed size (bytes): 389
Total packed size (bytes): $((387+${zlibng}))
EOF
head -n 9 README >actual &&
test_cmp expect actual &&
cat >expect <<-\EOF &&
cat >expect <<-EOF &&
=== Files by sha and associated pathnames in reverse size ===
Format: sha, unpacked size, packed size, filename(s) object stored as
a89c82a2d4b713a125a4323d25adda062cc0013d 44 50 numbers/medium.num
a89c82a2d4b713a125a4323d25adda062cc0013d 44 $((48+${zlibng})) numbers/medium.num
c58ae2ffaf8352bd9860bf4bbb6ea78238dca846 35 41 fickle
ccff62141ec7bae42e01a3dcb7615b38aa9fa5b3 24 40 fickle
f00c965d8307308469e537302baa73048488f162 21 37 numbers/small.num
Expand All @@ -809,8 +822,8 @@ test_expect_success C_LOCALE_OUTPUT '--analyze' '
cat >expect <<-EOF &&
=== All directories by reverse size ===
Format: unpacked size, packed size, date deleted, directory name
206 389 <present> <toplevel>
65 87 2005-04-07 numbers
206 $((387+${zlibng})) <present> <toplevel>
65 $((85+${zlibng})) 2005-04-07 numbers
13 58 <present> words
10 40 <present> sequence
EOF
Expand All @@ -819,30 +832,30 @@ test_expect_success C_LOCALE_OUTPUT '--analyze' '
cat >expect <<-EOF &&
=== Deleted directories by reverse size ===
Format: unpacked size, packed size, date deleted, directory name
65 87 2005-04-07 numbers
65 $((85+${zlibng})) 2005-04-07 numbers
EOF
test_cmp expect directories-deleted-sizes.txt &&
cat >expect <<-EOF &&
=== All extensions by reverse size ===
Format: unpacked size, packed size, date deleted, extension name
141 302 <present> <no extension>
65 87 2005-04-07 .num
65 $((85+${zlibng})) 2005-04-07 .num
EOF
test_cmp expect extensions-all-sizes.txt &&
cat >expect <<-EOF &&
=== Deleted extensions by reverse size ===
Format: unpacked size, packed size, date deleted, extension name
65 87 2005-04-07 .num
65 $((85+${zlibng})) 2005-04-07 .num
EOF
test_cmp expect extensions-deleted-sizes.txt &&
cat >expect <<-EOF &&
=== All paths by reverse accumulated size ===
Format: unpacked size, packed size, date deleted, path name
72 110 <present> fickle
44 50 2005-04-07 numbers/medium.num
44 $((48+${zlibng})) 2005-04-07 numbers/medium.num
8 38 <present> words/know
21 37 2005-04-07 numbers/small.num
20 36 <present> whatever
Expand All @@ -857,7 +870,7 @@ test_expect_success C_LOCALE_OUTPUT '--analyze' '
cat >expect <<-EOF &&
=== Deleted paths by reverse accumulated size ===
Format: unpacked size, packed size, date deleted, path name(s)
44 50 2005-04-07 numbers/medium.num
44 $((48+${zlibng})) 2005-04-07 numbers/medium.num
21 37 2005-04-07 numbers/small.num
EOF
test_cmp expect path-deleted-sizes.txt
Expand Down

0 comments on commit 01e5a88

Please sign in to comment.