X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=t%2F003safesys.t;fp=t%2F003safesys.t;h=436fc7b63cc5f0c912eee6529ffd4e5f1f8d1af4;hb=53593baa211863fbf66540cf1bcc36c8fb37257f;hp=b4f41f61c4b43357af2bf86cd5a44a596335a33b;hpb=deb4d2dbb676d7d6f69dfe7815d6e0cb09bd4a44;p=kivitendo-erp.git diff --git a/t/003safesys.t b/t/003safesys.t index b4f41f61c..436fc7b63 100644 --- a/t/003safesys.t +++ b/t/003safesys.t @@ -1,22 +1,22 @@ # -*- Mode: perl; indent-tabs-mode: nil -*- -# +# # The contents of this file are subject to the Mozilla Public # License Version 1.1 (the "License"); you may not use this file # except in compliance with the License. You may obtain a copy of # the License at http://www.mozilla.org/MPL/ -# +# # Software distributed under the License is distributed on an "AS # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or # implied. See the License for the specific language governing # rights and limitations under the License. -# +# # The Original Code are the Bugzilla Tests. -# +# # The Initial Developer of the Original Code is Zach Lipton -# Portions created by Zach Lipton are +# Portions created by Zach Lipton are # Copyright (C) 2001 Zach Lipton. All # Rights Reserved. -# +# # Contributor(s): Zach Lipton @@ -25,10 +25,13 @@ ###Safesystem#### use strict; +use threads; use lib 't'; use Support::Files; +use Sys::CPU; +use Thread::Pool::Simple; use Test::More tests => scalar(@Support::Files::testitems); @@ -46,20 +49,34 @@ my $fh; } } -my @testitems = @Support::Files::testitems; +my @testitems = @Support::Files::testitems; my $perlapp = "\"$^X\""; +sub test_file { + my ($file) = @_; + my $command = "$perlapp -c -It -MSupport::Systemexec $file 2>&1"; + my $loginfo =`$command`; + + if ($loginfo =~ /arguments for Support::Systemexec::(system|exec)/im) { + ok(0,"$file DOES NOT use proper system or exec calls"); + print $fh $loginfo; + } else { + ok(1,"$file uses proper system and exec calls"); + } +} + +my $pool = Thread::Pool::Simple->new( + min => 2, + max => Sys::CPU::cpu_count() + 1, + do => [ \&test_file ], + passid => 0, +); + foreach my $file (@testitems) { - $file =~ s/\s.*$//; # nuke everything after the first space (#comment) - next if (!$file); # skip null entries - my $command = "$perlapp -c -It -MSupport::Systemexec $file 2>&1"; - my $loginfo=`$command`; - if ($loginfo =~ /arguments for Support::Systemexec::(system|exec)/im) { - ok(0,"$file DOES NOT use proper system or exec calls"); - print $fh $loginfo; - } else { - ok(1,"$file uses proper system and exec calls"); - } + $file =~ s/\s.*$//; # nuke everything after the first space (#comment) + $pool->add($file) if $file; # skip null entries } +$pool->join; + exit 0;