-
Notifications
You must be signed in to change notification settings - Fork 0
/
testall.pl
48 lines (42 loc) · 1.25 KB
/
testall.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use strict;
use warnings;
use File::Spec;
use Capture::Tiny qw[capture_merged];
use Getopt::Long;
use Cwd;
use FindBin qw[$Bin];
die unless @ARGV;
my ($target);
GetOptions( 'target=s', \$target, );
die "No --target specified, please do so\n" unless $target;
foreach my $arg ( @ARGV ) {
my $path = Cwd::realpath($arg);
next unless -d $path;
my $confroot = File::Spec->catdir( $path, 'conf' );
next unless -d $confroot;
my @perls;
opendir my $dir, $path or die "$!\n";
while (my $item = readdir($dir)) {
next unless $item =~ /^perl-/;
push @perls, $item;
}
closedir $dir;
next unless @perls;
foreach my $perl ( sort @perls ) {
my $conf = File::Spec->catdir( $confroot, $perl );
next unless -d $conf;
my $perlexe = File::Spec->catfile($path,$perl,'bin','perl');
unless ( -e $perlexe ) {
# hmmm no perl there. Let's see if it is a dev release
my @possibles = glob("${perlexe}5*");
die "No perl executable found at '$path'\n" unless @possibles;
$perlexe = shift @possibles;
}
my $yactool = File::Spec->catfile($path,$perl,'bin','yactool');
local $ENV{PERL5_YACSMOKE_BASE} = $conf;
system($yactool,'--reindex');
system($yactool,'--test', $target);
system($yactool,'--flush');
}
}
exit 0;