2012-04-08 02:11:16 +02:00
|
|
|
use Config qw/ myconfig /;
|
|
|
|
use Data::Dumper;
|
|
|
|
use English qw/ -no_match_vars /;
|
|
|
|
use File::Find;
|
2012-05-05 01:36:35 +02:00
|
|
|
use Test::More;
|
|
|
|
|
2013-04-21 06:52:07 +02:00
|
|
|
if (!$ENV{'QPSMTPD_DEVELOPER'}) {
|
|
|
|
plan skip_all => "not a developer, skipping POD tests";
|
|
|
|
}
|
2012-04-08 02:11:16 +02:00
|
|
|
|
|
|
|
use lib 'lib';
|
|
|
|
|
|
|
|
my $this_perl = $Config{'perlpath'} || $EXECUTABLE_NAME;
|
|
|
|
|
2014-09-17 08:27:19 +02:00
|
|
|
my @files = find({wanted => \&test_syntax, no_chdir => 1}, 'plugins', 'lib', 't');
|
2012-04-08 02:11:16 +02:00
|
|
|
|
2013-04-21 06:52:07 +02:00
|
|
|
sub test_syntax {
|
2012-05-05 01:36:35 +02:00
|
|
|
my $f = $File::Find::name;
|
|
|
|
chomp $f;
|
2013-04-21 06:52:07 +02:00
|
|
|
return if !-f $f;
|
2014-09-17 08:27:19 +02:00
|
|
|
return if $f =~ m/(~|\.(bak|orig|rej|txt))$/;
|
|
|
|
return if $f =~ m/^t\/config/;
|
2012-05-05 01:36:35 +02:00
|
|
|
my $r;
|
|
|
|
eval { $r = `$this_perl -Ilib -MQpsmtpd::Constants -c $f 2>&1`; };
|
2013-04-21 06:52:07 +02:00
|
|
|
my $exit_code = sprintf("%d", $CHILD_ERROR >> 8);
|
|
|
|
if ($exit_code == 0) {
|
|
|
|
ok($exit_code == 0, "syntax $f");
|
2012-05-05 01:36:35 +02:00
|
|
|
return;
|
2013-04-21 06:52:07 +02:00
|
|
|
}
|
|
|
|
if ($r =~ /^Can't locate (.*?) in /) {
|
|
|
|
ok(0 == 0, "skipping $f, I couldn't load w/o $1");
|
2012-05-05 01:36:35 +02:00
|
|
|
return;
|
|
|
|
}
|
2013-04-21 06:52:07 +02:00
|
|
|
if ($r =~ /^Base class package "Danga::Socket" is empty/) {
|
|
|
|
ok(0 == 0, "skipping $f, Danga::Socket not available.");
|
2012-05-05 01:36:35 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
print "ec: $exit_code, r: $r\n";
|
2013-04-21 06:52:07 +02:00
|
|
|
}
|
2012-04-08 02:11:16 +02:00
|
|
|
|
2012-05-05 01:36:35 +02:00
|
|
|
done_testing();
|
2012-04-08 02:11:16 +02:00
|
|
|
|