Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision bd0bd7a0

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID bd0bd7a0380c750eda91d0467e9e4af414273d00
  • Vorgänger 1181d2b6
  • Nachfolger 19f08831

Tests: 001compile.t parallelisiert

Unterschiede anzeigen:

SL/InstallationCheck.pm
72 72
  { name => "LWP::Simple",                         url => "http://search.cpan.org/~gaas/",      debian => 'libwww-perl', dist_name => 'libwww-perl' },
73 73
  { name => "Moose::Role",                         url => "http://search.cpan.org/~doy/",       debian => 'libmoose-perl' },
74 74
  { name => "Perl::Tags",                          url => "http://search.cpan.org/~osfameron/", debian => 'libperl-tags-perl' },
75
  { name => "Sys::CPU",                            url => "http://search.cpan.org/~mkoderer/",  debian => 'libsys-cpu-perl' },
75 76
  { name => "Test::Deep",                          url => "http://search.cpan.org/~rjbs/",      debian => 'libtest-deep-perl' },
76 77
  { name => "Test::Exception",                     url => "http://search.cpan.org/~adie/",      debian => 'libtest-exception-perl' },
77 78
  { name => "Test::Output",                        url => "http://search.cpan.org/~bdfoy/",     debian => 'libtest-output-perl' },
79
  { name => "Thread::Pool::Simple",                url => "http://search.cpan.org/~jwu/",       debian => 'libthread-pool-simple-perl' },
78 80
  { name => "URI::Find",                           url => "http://search.cpan.org/~mschwern/",  debian => 'liburi-find-perl' },
79 81
  { name => "GD",              version => '2.00',  url => "http://search.cpan.org/~lds/",       debian => 'libgd-perl' },
80 82
  { name => "Rose::DB::Object", version => 0.809,  url => "http://search.cpan.org/~jsiracusa/", debian => 'librose-db-object-perl' },
t/001compile.t
25 25
###Compilation###
26 26

  
27 27
use strict;
28
use threads;
28 29

  
29 30
use lib 't';
30 31

  
31 32
use Support::Files;
33
use Sys::CPU;
34
use Thread::Pool::Simple;
32 35

  
33 36
use Test::More tests => scalar(@Support::Files::testitems);
34 37

  
......
61 64

  
62 65
# Test the scripts by compiling them
63 66

  
64
foreach my $file (@testitems) {
65
    $file =~ s/\s.*$//; # nuke everything after the first space (#comment)
66
    next if !$file;    # skip null entries
67
my @to_compile;
68

  
69
sub test_compile_file {
70
  my ($file, $T) = @{ $_[0] };
71

  
67 72

  
68
    open (FILE,$file);
69
    my $bang = <FILE>;
70
    close (FILE);
71
    my $T = "";
72
    $T = "T" if $bang =~ m/#!\S*perl\s+-.*T/;
73
  my $command = "$perlapp -w -c$T -Imodules/fallback -Imodules/override -It -MSupport::CanonialGlobals $file 2>&1";
74
  my $loginfo=`$command`;
73 75

  
74
    if (-l $file) {
75
        ok(1, "$file is a symlink");
76
  if ($loginfo =~ /syntax ok$/im) {
77
    if ($loginfo ne "$file syntax OK\n") {
78
      ok(0,$file." --WARNING");
79
      print $fh $loginfo;
76 80
    } else {
77
        my $command = "$perlapp -w -c$T -Imodules/fallback -Imodules/override -It -MSupport::CanonialGlobals $file 2>&1";
78
        my $loginfo=`$command`;
79

  
80
        if ($loginfo =~ /syntax ok$/im) {
81
            if ($loginfo ne "$file syntax OK\n") {
82
                ok(0,$file." --WARNING");
83
                print $fh $loginfo;
84
            } else {
85
                ok(1,$file);
86
            }
87
        } else {
88
            ok(0,$file." --ERROR");
89
            print $fh $loginfo;
90
        }
81
      ok(1,$file);
91 82
    }
83
  } else {
84
    ok(0,$file." --ERROR");
85
    print $fh $loginfo;
86
  }
92 87
}
93 88

  
89
foreach my $file (@testitems) {
90
  $file =~ s/\s.*$//;           # nuke everything after the first space (#comment)
91
  next if !$file;               # skip null entries
92

  
93
  open (FILE,$file);
94
  my $bang = <FILE>;
95
  close (FILE);
96
  my $T = "";
97
  $T = "T" if $bang =~ m/#!\S*perl\s+-.*T/;
98

  
99
  if (-l $file) {
100
    ok(1, "$file is a symlink");
101
  } else {
102
    push @to_compile, [ $file, $T ];
103
  }
104
}
105

  
106
my $pool = Thread::Pool::Simple->new(
107
  min    => 2,
108
  max    => Sys::CPU::cpu_count() + 1,
109
  do     => [ \&test_compile_file ],
110
  passid => 0,
111
);
112

  
113
$pool->add($_) for @to_compile;
114

  
115
$pool->join;
116

  
94 117
exit 0;

Auch abrufbar als: Unified diff