Basic testing! woot
This commit is contained in:
parent
765ecf5208
commit
2195ac3618
1 changed files with 41 additions and 1 deletions
42
test.pl
42
test.pl
|
@ -79,6 +79,7 @@ use autodie;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use List::Util qw/uniq/;
|
use List::Util qw/uniq/;
|
||||||
|
use IPC::Run qw/run/;
|
||||||
|
|
||||||
sub dep_order {
|
sub dep_order {
|
||||||
my $module = shift;
|
my $module = shift;
|
||||||
|
@ -94,7 +95,46 @@ sub dep_order {
|
||||||
return @orders;
|
return @orders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub run_cpanm {
|
||||||
|
my ($module, $incstatus) = @_;
|
||||||
|
|
||||||
|
$ENV{PERL_USE_UNSAFE_INC} = !!$incstatus;
|
||||||
|
my @cmd = (qw/perlbrew exec --with perlbot-inctest cpanm --reinstall --verbose/, $module);
|
||||||
|
|
||||||
|
my $out;
|
||||||
|
run \@cmd, '>&', \$out;
|
||||||
|
|
||||||
|
my $exitcode = $?;
|
||||||
|
if ($exitcode) {
|
||||||
|
print "command failed\n"; # TODO save output?
|
||||||
|
print $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($exitcode, $out);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub test_module {
|
||||||
|
my $module = shift;
|
||||||
|
my ($ret, $noincout) = run_cpanm($module, 0);
|
||||||
|
|
||||||
|
if ($ret) {
|
||||||
|
my ($ret2, $incout) = run_cpanm($module, 1);
|
||||||
|
|
||||||
|
if (!$ret2) {
|
||||||
|
print ">>>>Module $module failed to build without UNSAFE INC\n";
|
||||||
|
open(my $fh, ">", "logs/${$}_${module}_incfailure.log");
|
||||||
|
print $fh $noincout;
|
||||||
|
} else {
|
||||||
|
print "<<<<Module $module fails to build entirely\n";
|
||||||
|
|
||||||
|
open(my $fh, ">", "logs/${$}_${module}_genfailure.log");
|
||||||
|
print $fh $incout;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
my $foo = Module->new_module('Moose');
|
my $foo = Module->new_module('Moose');
|
||||||
$foo->print_deps(0, []);
|
|
||||||
|
|
||||||
print Dumper([map {$_->name} uniq dep_order($foo)]);
|
print Dumper([map {$_->name} uniq dep_order($foo)]);
|
||||||
|
|
||||||
|
test_module('Clone');
|
||||||
|
|
Loading…
Add table
Reference in a new issue