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

[PATCH] p5311: handle spaces in wc(1) output

From
René Scharfe <l.s.r@web.de>
Date
Oct 2, 2021, 20:33 UTC
Message-ID
<a682e2c8-fecc-906e-0ff6-93de2b311d14@web.de>

Some implementations of wc(1) align their output with leading spaces, even when just a single number is requested, e.g. with "wc -c". p5311 runs all tests successfully on such a platform, but fails to aggregate their results and reports:

   # passed all 33 test(s)
   1..33
   bad input line:    57144

Use the helper function test_file_size to get the number without any spaces in a portable way to avoid the issue.

Signed-off-by: René Scharfe <l.s.r@web.de>
---
 t/perf/README                      | 2 +-
 t/perf/p5311-pack-bitmaps-fetch.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/perf/README b/t/perf/README
index fb9127a66f..802402d738 100644
--- a/t/perf/README
+++ b/t/perf/README
@@ -190,7 +190,7 @@ shown in the aggregated output. For example:
 	'

 	test_size 'output size'
-		wc -c <foo.out
+		test_file_size foo.out
 	'

 might produce output like:
diff --git a/t/perf/p5311-pack-bitmaps-fetch.sh b/t/perf/p5311-pack-bitmaps-fetch.sh
index 47c3fd7581..ed0c7570d7 100755
--- a/t/perf/p5311-pack-bitmaps-fetch.sh
+++ b/t/perf/p5311-pack-bitmaps-fetch.sh
@@ -33,7 +33,7 @@ for days in 1 2 4 8 16 32 64 128; do
 	'

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

 	test_perf "client $title" '
--
2.33.0
Next: Taylor Blau
Message 1 of 5 in “p5311: handle spaces in wc(1) output”
  1. p5311: handle spaces in wc(1) outputRené Scharfe, Oct 2, 2021
  2. Taylor BlauOct 3, 2021
  3. Ævar Arnfjörð BjarmasonOct 3, 2021
  4. Junio C HamanoOct 4, 2021
  5. Jeff KingOct 4, 2021

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.