Test-More / Test2-Harness

Alternative to Test::Harness
Other
23 stars 26 forks source link

Test2::Harness vs Devel::Cover #221

Closed ylavoie closed 3 years ago

ylavoie commented 3 years ago

That's not an issue and I'm hoping that the bug is sitting on my chair.

Test2::Plugin::Cover does a very nice job but we need Devel::Cover to get the statement coverage.

Setting it up was not a big problem but there are so many useless messages produced by B::Deparse about recursion & OP_CUSTOM that the real issues are hard to find and fix.

After all those years, I stopped expecting those to go away from B::Deparse or Perl to give us means to stop the recursion messages.

So, is there any way to filter out those messages from the Yath stream output?

ylavoie commented 3 years ago

This cannot be the solution and should be restrited to when using Devel::Cover but it removes noise from B::Deparse and gives back a useable log from Yath.

diff --git a/lib/Test2/Harness/Collector/JobDir.pm b/lib/Test2/Harness/Collector/JobDir.pm
index 997504f4..5e54bc6b 100644
--- a/lib/Test2/Harness/Collector/JobDir.pm
+++ b/lib/Test2/Harness/Collector/JobDir.pm
@@ -283,6 +283,15 @@ sub _poll_stream {

         chomp($line);

+# Filter out B::Deparse useless warnings when using Devel::Cover
+#( STDERR )  job  1    unexpected OP_CUSTOM (catch) at /usr/share/perl/5.30.0/B/Deparse.pm line 1633.
+#( STDERR )  job  1    Deep recursion on subroutine "B::Deparse::_pessimise_walk" at /usr/share/perl/5.30.0/B/Deparse.pm line 338.
+        if (    $line =~ /^unexpected OP_CUSTOM \([a-z]+\).+B\/Deparse/
+             || $line =~ /^Deep recursion on subroutine "B::Deparse::_pessimise_walk"/ ) {
+            shift @$buff;
+            next;
+        }
+
         my $esync = $self->_poll_stream_process_harness_line($line, $params);
         return 1 if $esync;
ylavoie commented 3 years ago

Fixed in latest Devel::Cover dependencies to stop warnings.