Update Debian CI tests

environments/ppa-mbqj77/deployments/1
Xavier Guimard 7 years ago
parent 7802a0d0f7
commit 50657167a5
  1. 7
      debian/tests/lib/build-deps.d/smoke
  2. 52
      debian/tests/lib/runtime-deps.d/use.t

@ -36,7 +36,8 @@ export AUTOMATED_TESTING=1
export NONINTERACTIVE_TESTING=1
# overridable with smoke-env
PKG_PERL_PROVE_ARGS="--merge"
PKG_PERL_PROVE_ARGS="--verbose --recurse --merge"
PKG_PERL_XVFB_ARGS="-a"
env_list=debian/tests/pkg-perl/smoke-env
if [ ! -r $env_list ]; then
@ -125,6 +126,8 @@ for dir in common handler portal manager; do
XVFB="xvfb-run -a"
else
XVFB=
PKG_PERL_XVFB_ARGS=
PKG_PERL_XVFB_SERVER_ARGS=
fi
test_targets=$(ls -d t/*.t 2>/dev/null || true)
@ -132,7 +135,7 @@ for dir in common handler portal manager; do
if [ ! -n "$test_targets" ]; then
echo 'Nothing to prove, skipping.'
else
$XVFB prove -I"$TDIR2" --blib --verbose $PKG_PERL_PROVE_ARGS $test_targets 2>&1
$XVFB $PKG_PERL_XVFB_ARGS ${PKG_PERL_XVFB_SERVER_ARGS:+-s} ${PKG_PERL_XVFB_SERVER_ARGS:+"$PKG_PERL_XVFB_SERVER_ARGS"} prove -I"$TDIR" --blib $PKG_PERL_PROVE_ARGS $test_targets 2>&1
fi
cd -

@ -4,6 +4,7 @@ use strict;
use Test::More;
use Getopt::Std;
use CPAN::Meta;
use File::Temp;
sub usage {
my $exit = shift;
@ -24,20 +25,31 @@ sub getmodule {
my $conffile = "debian/tests/pkg-perl/use-name";
$conffile = "debian/tests/pkg-perl/module-name" if ! -e $conffile; # backcompat
$conffile = "debian/tests/module-name" if ! -e $conffile; # backcompat squared
$module = read_conffile($conffile);
return $module if defined $module;
return getmeta();
}
sub read_conffile {
my $conffile = shift;
my $ret;
if ( -f $conffile ) {
open(M, "<", $conffile)
or BAIL_OUT("$conffile exists but can't be read");
while (<M>) {
chomp;
next if /^\s*#/;
/(\S+)/ and $module = $1, last;
/(\S+)/ and $ret = $1, last;
}
close M;
BAIL_OUT("can't find a module name in $conffile")
if !defined $module;
return $module;
close M;
BAIL_OUT("can't find anything in $conffile")
if !defined $ret;
}
return $ret;
}
sub getmeta {
my $meta;
my $dist;
eval { $meta = CPAN::Meta->load_file('META.json') };
@ -47,7 +59,7 @@ sub getmodule {
$dist = $meta->name;
$module = $dist;
my $module = $dist;
$module =~ s,-,::,g;
my $file = "$dist.pm";
@ -61,16 +73,38 @@ sub getmodule {
return $module;
}
sub getwhitelist {
my $whitelist = 'debian/tests/pkg-perl/use-whitelist';
my $ret;
$ret = read_conffile($whitelist) if ( -f $whitelist );
$ret;
}
my @modules = @ARGV ? @ARGV : getmodule();
my $whitelist = getwhitelist();
usage() if !@modules;
plan tests => 2 * scalar @modules;
plan tests => 4 * scalar @modules;
# don't run the command in the source directory, in case
# cwd is on @INC
my $dir;
$dir = $ENV{'AUTOPKGTEST_TMP'};
$dir = $ENV{'ADTTMP'} if !defined $dir;
$dir = File::Temp::tempdir( CLEANUP => 1 ) if !defined $dir;
chdir($dir) or die("can't chdir to $dir");
for my $mod (@modules) {
my $cmd = qq($^X -w -M"$mod" -e 1 2>&1);
for my $envprefix ('', 'env PERL_DL_NONLAZY=1 ') {
my $cmd = qq($envprefix $^X -w -M"$mod" -e 1 2>&1);
my @out = qx($cmd);
note(@out) if @out;
ok(!$?, "$cmd exited successfully");
ok(!@out, "$cmd produced no output");
@out = grep { !/$whitelist/ } @out if defined $whitelist;
ok(!@out, "$cmd produced no (non-whitelisted) output");
}
}

Loading…
Cancel
Save