summaryrefslogtreecommitdiff
path: root/t/perf/aggregate.perl
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2017-04-21 19:44:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-04-24 04:33:15 (GMT)
commitdb7ed0f20c2929f3054c96497dd1cf482a198c7b (patch)
tree74d0209254173fc1aedbc5fb5081769906451ec4 /t/perf/aggregate.perl
parent6a2c2f8d34fa1e8f3bb85d159d354810ed63692e (diff)
downloadgit-db7ed0f20c2929f3054c96497dd1cf482a198c7b.zip
git-db7ed0f20c2929f3054c96497dd1cf482a198c7b.tar.gz
git-db7ed0f20c2929f3054c96497dd1cf482a198c7b.tar.bz2
t/perf: correctly align non-ASCII descriptions in output
Change the test descriptions from being treated as binary blobs by perl to being treated as UTF-8. This ensures that e.g. a test description like "æ" is counted as 1 character, not 2. I have WIP performance tests for non-ASCII grep patterns on another topic that are affected by this. Now instead of: $ ./run p0000-perf-lib-sanity.sh [...] 0000.4: export a weird var 0.00(0.00+0.00) 0000.5: éḿíẗ ńöń-ÁŚĆÍÍ ćḧáŕáćẗéŕś 0.00(0.00+0.00) 0000.7: important variables available in subshells 0.00(0.00+0.00) [...] We emit: [...] 0000.4: export a weird var 0.00(0.00+0.00) 0000.5: éḿíẗ ńöń-ÁŚĆÍÍ ćḧáŕáćẗéŕś 0.00(0.00+0.00) 0000.7: important variables available in subshells 0.00(0.00+0.00) [...] Fixes code originally added in 342e9ef2d9 ("Introduce a performance testing framework", 2012-02-17). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/perf/aggregate.perl')
-rwxr-xr-xt/perf/aggregate.perl3
1 files changed, 3 insertions, 0 deletions
diff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl
index 924b19d..1dbc85b 100755
--- a/t/perf/aggregate.perl
+++ b/t/perf/aggregate.perl
@@ -88,6 +88,7 @@ for my $t (@tests) {
sub read_descr {
my $name = shift;
open my $fh, "<", $name or return "<error reading description>";
+ binmode $fh, ":utf8" or die "PANIC on binmode: $!";
my $line = <$fh>;
close $fh or die "cannot close $name";
chomp $line;
@@ -147,6 +148,8 @@ for my $t (@subtests) {
my $totalwidth = 3*@dirs+$descrlen;
$totalwidth += $_ for (@colwidth);
+binmode STDOUT, ":utf8" or die "PANIC on binmode: $!";
+
printf "%-${descrlen}s", "Test";
for my $i (0..$#dirs) {
my $d = $dirs[$i];