[pkg-perl-tools] 03/09: use.t: support a whitelist regexp in d/t/p/use-whitelist

Niko Tyni ntyni at moszumanska.debian.org
Sat Dec 3 21:01:28 UTC 2016


This is an automated email from the git hooks/post-receive script.

ntyni pushed a commit to branch ntyni/autopkgtest
in repository pkg-perl-tools.

commit 906eb0e740dd309b9c7c7a76ed94c0050406940b
Author: Niko Tyni <ntyni at debian.org>
Date:   Sun Nov 27 21:26:04 2016 +0200

    use.t: support a whitelist regexp in d/t/p/use-whitelist
    
    Closes: #845771
---
 autopkgtest/README.autopkgtest           |  3 +++
 autopkgtest/scripts/runtime-deps.d/use.t | 12 +++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/autopkgtest/README.autopkgtest b/autopkgtest/README.autopkgtest
index 5e12b91..63677d2 100644
--- a/autopkgtest/README.autopkgtest
+++ b/autopkgtest/README.autopkgtest
@@ -42,6 +42,9 @@ If the runtime-deps.d/use.t test fails to get the main module of your
 package right, you can customize that by putting the right name in
 'debian/tests/pkg-perl/use-name'.
 
+If a module intentionally produces output when used, you can whitelist
+that output as a regexp in 'debian/tests/pkg-perl/use-whitelist'.
+
 If there are just a few modules that fail syntax.t, you can ignore those
 by adding them to 'debian/tests/pkg-perl/syntax-skip'. The lines are
 matched as fixed substrings (not regular expressions.) Empty lines and
diff --git a/autopkgtest/scripts/runtime-deps.d/use.t b/autopkgtest/scripts/runtime-deps.d/use.t
index e34f3a5..b1a20b5 100755
--- a/autopkgtest/scripts/runtime-deps.d/use.t
+++ b/autopkgtest/scripts/runtime-deps.d/use.t
@@ -72,8 +72,17 @@ sub getmeta {
     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;
@@ -83,5 +92,6 @@ for my $mod (@modules) {
     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");
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/pkg-perl-tools.git



More information about the Pkg-perl-cvs-commits mailing list