-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
have the dependents test test all dependents
- Loading branch information
1 parent
19e390a
commit e527641
Showing
4 changed files
with
134 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
/PPI-*.tar.gz | ||
/nytprof* | ||
/TODO | ||
/xt/cpanfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package # | ||
DepReqs; | ||
|
||
use 5.010; | ||
use strictures 2; | ||
|
||
use Test::DependentModules; | ||
use IO::All; | ||
use MetaCPAN::Client; | ||
use List::Util 'uniqstr'; | ||
use Devel::Confess; | ||
|
||
1; | ||
|
||
__PACKAGE__->run unless caller; | ||
|
||
sub exclusions { | ||
qr/^( | ||
# don't remember why i excluded these | ||
Apache2-SSI|Devel-IPerl|Padre | ||
# fails tests regarding directory write permissions, probably not PPI | ||
|Devel-Examine-Subs | ||
# their dependencies don't even install | ||
|Devel-ebug-HTTP|Padre-Plugin-ParserTool|Devel-PerlySense|PPI-Tester | ||
|Acme-ReturnValue|Bot-BasicBot-Pluggable-Module-Gitbot|Pinwheel | ||
|Dist-Zilla-Plugin-MetaProvides-Package|Dist-Zilla-Plugin-Readme-Brief | ||
|Apache2-PPI-HTML | ||
# author parsing issue | ||
|Spellunker-Perl | ||
# takes too long | ||
|RPerl | ||
# broken on cpan | ||
|Acme-VarMess|Module-Checkstyle|MooseX-Documenter|Perl-Achievements | ||
|Perl-Metrics|Ravenel|Test-LocalFunctions|UML-Class-Simple | ||
# maybe broken on cpan | ||
|App-Grepl|App-Midgen|App-PRT|Pod-Weaver-Section-SQL | ||
# investigate | ||
|Class-Discover|Devel-Decouple|File-PackageIndexer|Perl-Signature | ||
|Perl-Squish|Perl-ToPerl6|Test-Declare | ||
# RT 76417 | ||
|Devel-Graph | ||
# meeds Class::Gomor as dep | ||
|Metabrik | ||
# depends on RPerl | ||
|MLPerl | ||
# RT 129344 | ||
|Module-AnyEvent-Helper | ||
)$/x | ||
} | ||
|
||
sub force_big_metacpan_fetch { | ||
## force metacpan to actually return the whole dependents list | ||
# https://github.com/metacpan/metacpan-client/issues/122 | ||
my $old_fetch = \&MetaCPAN::Client::fetch; | ||
my $new_fetch = sub { $old_fetch->( shift, shift . "?size=5000", @_ ) }; | ||
{ no warnings 'redefine'; *MetaCPAN::Client::fetch = $new_fetch; } | ||
|
||
return $old_fetch; | ||
} | ||
|
||
sub run { | ||
my $old_fetch = force_big_metacpan_fetch; | ||
|
||
my @deps = | ||
Test::DependentModules::_get_deps PPI => { exclude => exclusions() }; | ||
|
||
{ no warnings 'redefine'; *MetaCPAN::Client::fetch = $old_fetch; } | ||
|
||
my $c = MetaCPAN::Client->new; | ||
my @reqs; | ||
for my $dependent (@deps) { | ||
say $dependent; | ||
my @dep_reqs = map @{ $c->release($_)->dependency }, $dependent; | ||
say " $_->{module}" for @dep_reqs; | ||
push @reqs, @dep_reqs; | ||
} | ||
|
||
say "writing file"; | ||
io("xt/cpanfile") | ||
->print( join "\n", | ||
uniqstr map qq[requires "$_->{module}" => "$_->{version}";], @reqs ); | ||
|
||
say "debug printing file"; | ||
say io("xt/cpanfile")->all; | ||
|
||
# test early that all modules don't have an author that crashes tests later | ||
# !!! careful, this changes CWD !!! | ||
Test::DependentModules::_load_cpan; | ||
for my $name (@deps) { | ||
my $mod = $name; | ||
$mod =~ s/-/::/g; | ||
next unless # | ||
my $dist = Test::DependentModules::_get_distro($mod); | ||
$dist->author->id; | ||
} | ||
|
||
say "done"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,33 @@ | ||
use strict; | ||
use warnings; | ||
use Test2::V0; | ||
use strictures 2; | ||
|
||
use Test::DependentModules qw( test_modules ); | ||
use Test::More; | ||
use Test::DependentModules 'test_all_dependents'; | ||
use MetaCPAN::Client; | ||
use Devel::Confess; | ||
|
||
my @modules = ('Perl::Critic'); | ||
use lib '.'; | ||
|
||
SKIP: { | ||
skip '$ENV{TEST_DEPENDENTS} not set', scalar @modules | ||
unless $ENV{TEST_DEPENDENTS}; | ||
test_modules(@modules); | ||
require( -e "xt" ? "xt/DepReqs.pm" : "DepReqs.pm" ); | ||
|
||
} | ||
skip_all "ENV var TEST_DEPENDENTS not set" if not $ENV{TEST_DEPENDENTS}; | ||
|
||
done_testing(); | ||
# duplicate error output into an array for later printing | ||
my @error_log; | ||
my $old_log = \&Test::DependentModules::_error_log; | ||
my $new_log = sub { push @error_log, @_; $old_log->(@_); }; | ||
{ no warnings 'redefine'; *Test::DependentModules::_error_log = $new_log; } | ||
|
||
DepReqs::force_big_metacpan_fetch(); | ||
|
||
test_all_dependents PPI => { exclude => DepReqs::exclusions() }; | ||
|
||
my $error_log = join "\n", @error_log; | ||
my $fails = join "\n", $error_log =~ /(FAIL: .*\w+)$/mg; | ||
|
||
diag "\n\n---------- ERROR LOG START -----------\n\n", | ||
@error_log, | ||
"\n\n---------- FAILS: -----------\n\n", | ||
$fails, | ||
"\n\n---------- ERROR LOG END -----------\n\n"; | ||
|
||
done_testing; |