mirror of
https://github.com/webmin/webmin.git
synced 2026-07-25 10:50:31 +01:00
Add new test for miniserv library loading
This commit is contained in:
18
t/compile.t
18
t/compile.t
@@ -24,7 +24,7 @@ use Test::More;
|
||||
use File::Find;
|
||||
use File::Basename qw(dirname);
|
||||
use File::Spec;
|
||||
use Cwd qw(abs_path);
|
||||
use Cwd qw(abs_path getcwd);
|
||||
|
||||
my $root = abs_path(File::Spec->catdir(dirname(__FILE__), '..'));
|
||||
chdir($root) or die "chdir($root): $!";
|
||||
@@ -68,6 +68,22 @@ if ($filter) {
|
||||
@files or do { diag("filter '$filter' matched zero files"); plan skip_all => "no files match filter"; };
|
||||
}
|
||||
|
||||
if (grep { $_ eq q{./miniserv.pl} } @files) {
|
||||
my $cwd = getcwd();
|
||||
my $tmpdir = File::Spec->tmpdir();
|
||||
my $miniserv = File::Spec->catfile($root, q{miniserv.pl});
|
||||
chdir($tmpdir) or BAIL_OUT("chdir($tmpdir): $!");
|
||||
my $out = qx{perl -c -- "$miniserv" 2>&1};
|
||||
chdir($cwd) or BAIL_OUT("chdir($cwd): $!");
|
||||
if ($out =~ /\bsyntax OK\b/) {
|
||||
pass(q{miniserv.pl compiles outside the source tree});
|
||||
}
|
||||
else {
|
||||
fail(q{miniserv.pl compiles outside the source tree});
|
||||
diag($out);
|
||||
}
|
||||
}
|
||||
|
||||
diag("compile-checking " . scalar(@files) . " files");
|
||||
|
||||
for my $f (@files) {
|
||||
|
||||
Reference in New Issue
Block a user