[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Missing @INC path for pkg-perl-autopkgtest



Hi,

in the chordpro perl package I have some problems with the
autopkgtest-pkg-perl testsuite, because the upstream maintainer places
several modules (only used in chordpro locally) below
/usr/share/perl5/ChordPro/lib.

In the consequence other modules, that use these modules fail while
running the autopkgtest-pkg-perl testsuite, because they cannot locate
these modules.

Currently I exclude all modules that run into this issue via
debian/tests/pkg-perl/syntax-skip, but with the upcoming beta release
of chordpro this list will be massively extended, which in consequence
means, that most modules are no longer checked by the test suite.

As a first workaround I run autopkgtest with
 --env=PERL5LIB=/usr/sahre/perl5/ChordPro/lib
option, which solved the issue, but has to be done on every call of
autopkgtest, so it's not usable for automated testing.

My current workaround is to remove "Testsuite: autopkgtest-pkg-perl"
from debian/control and replace it by debian/test/control with the
following content:

Test-Command: env PERL5LIB=/usr/share/perl5/ChordPro/lib /usr/share/pkg-perl-autopkgtest/runner build-deps
Depends: @, @builddeps@, pkg-perl-autopkgtest
Restrictions: skippable
Features: test-name=autodep8-perl-build-deps

Test-Command: /usr/share/pkg-perl-autopkgtest/runner runtime-deps
Depends: @, pkg-perl-autopkgtest
Restrictions: skippable, superficial
Features: test-name=autodep8-perl

Test-Command: env PERL5LIB=/usr/share/perl5/ChordPro/lib /usr/share/pkg-perl-autopkgtest/runner runtime-deps-and-recommends
Depends: @, @recommends@, pkg-perl-autopkgtest
Restrictions: skippable, superficial
Features: test-name=autodep8-perl-recommends

This does exactly what I want, but has the disadvantage, that I have
to watch changes in /usr/share/autodep8/support/perl/detect and merge
them here manually, so this isn't a good solution.

What do you think about this problem?  Does it make sense to extend
pkg-perl-tools/autopkgtest to honor some debian/test/pkg-perl/set-env
variable?  While writing this, I noted, that there already exists
debian/tests/pkg-perl/smoke-env for this, but this is only used in the
build-deps test.

Would you accept a merge request for pkg-perl-tools, that reads
debian/tests/pkg-perl/syntax-env in
runtime-deps-and-recommends.d/syntax.t like this?

--- a/autopkgtest/scripts/runtime-deps-and-recommends.d/syntax.t
+++ b/autopkgtest/scripts/runtime-deps-and-recommends.d/syntax.t
@@ -18,6 +18,22 @@ getopts('h', \%opts)
 
 usage(0) if $opts{h};
 
+sub readandsetenv {
+    my $file = "debian/tests/pkg-perl/syntax-env";
+    -r $file or return ();
+    open (E, '<', $file)
+        or BAIL_OUT("$file exists but can't be read");
+    while (<E>) {
+        chomp;
+        if (/^(.+)=(.*)$/) {
+            $ENV{$1} = $2;
+        } else {
+            BAIL_OUT("syntax error in $file: $_");
+        }
+    }
+    close E;
+}
+
 sub getpackages {
     my @p;
     my $c = "debian/control";
@@ -61,6 +77,8 @@ sub readfile {
     return @ret;
 }
 
+readandsetenv();
+
 my @packages = @ARGV ? @ARGV : getpackages();
 
 usage() if !@packages;


Awaiting your feedback about this idea
Roland


Reply to: