about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-01-30 04:30:58 +0000
committerEric Wong <e@80x24.org>2023-01-30 06:42:43 +0000
commit155ee9cdaffd6232ef3c774d1a9f61d708fc8d6e (patch)
tree806834f3f6ddd62ee454f55f000e7b5cd22745d6
parent7b654d175cf2e31b4354929ea678563f534947e5 (diff)
downloadpublic-inbox-155ee9cdaffd6232ef3c774d1a9f61d708fc8d6e.tar.gz
t/run.perl now prints slowest 10 tests at startup, and I've
added ./devel/longest-tests to print all tests sorted by
elapsed time.

This should allow us to notice outliers more quickly in the
future.
-rw-r--r--MANIFEST1
-rwxr-xr-xdevel/longest-tests7
-rwxr-xr-xt/run.perl4
3 files changed, 12 insertions, 0 deletions
diff --git a/MANIFEST b/MANIFEST
index f22f60aa..aba32762 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -121,6 +121,7 @@ contrib/css/README
 contrib/selinux/el7/publicinbox.fc
 contrib/selinux/el7/publicinbox.te
 devel/README
+devel/longest-tests
 devel/syscall-list
 examples/README
 examples/README.unsubscribe
diff --git a/devel/longest-tests b/devel/longest-tests
new file mode 100755
index 00000000..bf46e166
--- /dev/null
+++ b/devel/longest-tests
@@ -0,0 +1,7 @@
+eval 'exec perl -wS $0 ${1+"$@"}' # this script is too short to copyright
+if 0; # running under some shell
+use v5.12; use autodie; use YAML::XS qw(Load);
+open(my $fh, '<', shift // '.prove');
+my $t = Load(do { local $/; <$fh> })->{tests};
+my @t = sort { $t->{$b}->{elapsed} <=> $t->{$a}->{elapsed} } keys %$t;
+printf "%0.6f %s\n", $t->{$_}->{elapsed}, $_ for @t;
diff --git a/t/run.perl b/t/run.perl
index b90715a6..f68dab60 100755
--- a/t/run.perl
+++ b/t/run.perl
@@ -85,6 +85,10 @@ if ($shuffle) {
         @tests = sort {
                 ($t->{$b}->{elapsed} // 0) <=> ($t->{$a}->{elapsed} // 0)
         } @tests;
+        say "# top 10 longest tests (`make check' regenerates)";
+        for (@tests[0..9]) {
+                printf "# %0.6f %s\n", $t->{$_}->{elapsed}, $_;
+        }
 }
 
 our $tb = Test::More->builder;