1 package TAP::Harness::IgnoreNonessentialDzilAutogeneratedTests;
6 use base 'TAP::Harness';
8 use IPC::Open3 'open3';
10 use List::Util 'first';
12 my $frivolous_test_map = {
13 # Test based on the extremely dep-heavy, *prone to failures* Test::CheckDeps
15 qr|^t/00-check-deps.t$| => [
16 qr|^\Q# this test was generated with Dist::Zilla::Plugin::Test::CheckDeps|m,
18 # older non-annotated versions
19 qr|use \s+ Test::CheckDeps .*? ^\Qcheck_dependencies('suggests')\E .*? \QBAIL_OUT("Missing dependencies") if !Test::More->builder->is_passing|smx,
22 # "does everything compile" tests are useless by definition - this is what the
23 # rest of the test suite is for
25 qr|^t/00-compile.t$| => [
26 qr|^\Q# this test was generated with Dist::Zilla::Plugin::Test::Compile|m,
29 # The report prereq test managed to become fatal as well
31 qr|^t/00-report-prereqs.t$| => [
32 qr|^\Q# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs|m,
35 # Just future-proof the thing, catch anything autogened by dzil for a bit
37 qr|^\Q# This test was generated by Dist::Zilla::|m,
42 my ($self, $aggregate, @all_tests) = @_;
44 my ($run_tests, $skip_tests);
48 my $fn = File::Spec::Unix->catpath( File::Spec->splitpath( $_ ) );
50 if (my $REs = $frivolous_test_map->{
51 (first { $fn =~ $_ } keys %$frivolous_test_map ) || ''
53 my $slurptest = do { local (@ARGV, $/) = $fn; <> };
54 $slurptest =~ $_ and push @$skip_tests, $fn and next TESTFILE for @$REs;
57 push @$run_tests, $fn;
62 for my $tfn (@$skip_tests) {
64 (my $tfn_flattened = $tfn) =~ s|/|_|g;
66 my $log_file = File::Temp->new(
68 TEMPLATE => "AutoGenTest_${tfn_flattened}_XXXXX",
72 # FIXME I have no idea why the fileno dance is necessary - will investigate later
73 # All I know is that if I pass in just $log_file - open3 ignores it >:(
74 my $pid = open3(undef, '>&'.fileno($log_file), undef, $^X, qw(-I blib -I arch/lib), $tfn );
79 # use qx as opposed to another open3 until I figure out the above
80 close $log_file or die "Unable to close $log_file: $!";
81 chomp( my $url = `/usr/bin/nopaste -q -s Shadowcat -d $log_file < $log_file` );
83 $tfn .= "[would NOT have passed: $ex / $url]";
87 print STDERR "=== Skipping nonessential autogenerated tests: @$skip_tests\n";
90 return $self->SUPER::aggregate_tests($aggregate, @$run_tests);