[debhelper-devel] [debhelper] 03/04: autopkgtest-pkg-perl: fix smoke test.

Niels Thykier nthykier at moszumanska.debian.org
Sat Jul 15 19:18:48 UTC 2017


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

nthykier pushed a commit to branch master
in repository debhelper.

commit 3093ccb0d619bdd9f1fed2e6ec7678ba94da013d
Author: gregor herrmann <gregoa at debian.org>
Date:   Sat Jul 15 18:34:54 2017 +0200

    autopkgtest-pkg-perl: fix smoke test.
    
    autopkgtest-pkg-perl's smoke test fails all over the place because
    debhelper's testsuite has many assumptions that it is run from the source
    tree, while autopkgtest-pkg-perl's smoke test copies (by default) the t/
    directory to a new empty directory and runs the tests from there.
    
    Add debian/tests/pkg-perl/smoke-files to copy more files from the source
    tree which are used in tests.
    
    Add debian/tests/pkg-perl/smoke-skip to skip t/size.t which fails when run
    under autopkgtest-pkg-perl because it tests all /usr/bin/dh_* helpers, and
    at least dh_autotools-dev_updateconfig is too large.
    
    Change t/buildsystems/03-bs-auto-buildable.t,
    t/buildsystems/buildsystem_tests.t, t/override_target.t, t/size.t, and
    t/syntax/syntax-progs.t to look for scripts and modules not in the source
    tree but in the installed directories when run under autopkgtest.
    
    With these changes, the test suite passes both during build and during
    autokpkgtest.
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/tests/pkg-perl/smoke-files     | 4 ++++
 debian/tests/pkg-perl/smoke-skip      | 5 +++++
 t/buildsystems/03-bs-auto-buildable.t | 4 +++-
 t/buildsystems/buildsystem_tests.t    | 2 +-
 t/override_target.t                   | 3 ++-
 t/size.t                              | 3 ++-
 t/syntax/syntax-progs.t               | 8 ++++++--
 7 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/debian/tests/pkg-perl/smoke-files b/debian/tests/pkg-perl/smoke-files
new file mode 100644
index 0000000..2a0aedd
--- /dev/null
+++ b/debian/tests/pkg-perl/smoke-files
@@ -0,0 +1,4 @@
+t/
+debian/compat
+debian/control
+debian/changelog
diff --git a/debian/tests/pkg-perl/smoke-skip b/debian/tests/pkg-perl/smoke-skip
new file mode 100644
index 0000000..c006e7a
--- /dev/null
+++ b/debian/tests/pkg-perl/smoke-skip
@@ -0,0 +1,5 @@
+# If we set the path to /usr/bin when run under autopkgtest,
+# other dh_* commands are tested as well. This might be nice
+# or not but it currently fails for dh_autotools-dev_updateconfig.
+# So let's skip t/size.t for now.
+t/size.t
diff --git a/t/buildsystems/03-bs-auto-buildable.t b/t/buildsystems/03-bs-auto-buildable.t
index 77845ce..b2c82e2 100755
--- a/t/buildsystems/03-bs-auto-buildable.t
+++ b/t/buildsystems/03-bs-auto-buildable.t
@@ -59,7 +59,9 @@ my %options = (
 	'sourcedir' => $sourcedir,
 );
 make_path($sourcedir, $builddir);
-my @bs = load_all_buildsystems([ $Test::DH::ROOT_DIR ], %options);
+use Config;
+my $libpath = $ENV{AUTOPKGTEST_TMP} ? $Config{vendorlib} : $Test::DH::ROOT_DIR;
+my @bs = load_all_buildsystems([ $libpath ], %options);
 my %bs;
 my @names = map { $_->NAME() } @bs;
 
diff --git a/t/buildsystems/buildsystem_tests.t b/t/buildsystems/buildsystem_tests.t
index aae8087..ac39b6d 100755
--- a/t/buildsystems/buildsystem_tests.t
+++ b/t/buildsystems/buildsystem_tests.t
@@ -17,7 +17,7 @@ use_ok( 'Debian::Debhelper::Dh_Lib' );
 use_ok( 'Debian::Debhelper::Buildsystem' );
 use_ok( 'Debian::Debhelper::Dh_Buildsystems' );
 
-my $TOPDIR = "../..";
+my $TOPDIR = $ENV{AUTOPKGTEST_TMP} ? '/usr/bin' : '../..';
 my @STEPS = qw(configure build test install clean);
 my $BS_CLASS = 'Debian::Debhelper::Buildsystem';
 
diff --git a/t/override_target.t b/t/override_target.t
index b56c986..2ef0baa 100755
--- a/t/override_target.t
+++ b/t/override_target.t
@@ -8,10 +8,11 @@ plan(tests => 1);
 system("mkdir -p t/tmp/debian");
 system("cp debian/control debian/compat debian/changelog t/tmp/debian");
 open (OUT, ">", "t/tmp/debian/rules") || die "$!";
+my $binpath = $ENV{AUTOPKGTEST_TMP} ? '/usr/bin' : '../..';
 print OUT <<EOF;
 #!/usr/bin/make -f
 %:
-	PATH=../..:\$\$PATH PERL5LIB=../.. ../../dh \$@ --without autoreconf
+	PATH=../..:\$\$PATH PERL5LIB=../.. $binpath/dh \$@ --without autoreconf
 
 override_dh_update_autotools_config override_dh_strip_nondeterminism:
 
diff --git a/t/size.t b/t/size.t
index 79564af..5a16db4 100755
--- a/t/size.t
+++ b/t/size.t
@@ -7,7 +7,8 @@ use strict;
 use warnings;
 use Test::More;
 
-my @progs=grep { -x $_ } glob("dh_*");
+my $binpath = $ENV{AUTOPKGTEST_TMP} ? '/usr/bin' : '.';
+my @progs=grep { -x $_ } glob("$binpath/dh_*");
 
 plan(tests => (@progs + @progs));
 
diff --git a/t/syntax/syntax-progs.t b/t/syntax/syntax-progs.t
index 0dbdb2a..0317c6e 100755
--- a/t/syntax/syntax-progs.t
+++ b/t/syntax/syntax-progs.t
@@ -8,11 +8,15 @@ use lib dirname(dirname(__FILE__));
 # Need Test::More to set PERL5LIB
 use Test::DH;
 
+use Config;
+my $binpath = $ENV{AUTOPKGTEST_TMP} ? '/usr/bin' : '.';
+my $libpath = $ENV{AUTOPKGTEST_TMP} ? $Config{vendorlib} : '.';
+
 my @targets;
 if ($0 =~ m{syntax-progs\.t$}) {
-	@targets = grep { -x $_ } glob("dh_*"), "dh";
+	@targets = grep { -x $_ } glob("$binpath/dh_*"), "$binpath/dh";
 } else {
-	@targets = (glob("Debian/Debhelper/*.pm"), glob("Debian/Debhelper/*/*.pm"));
+	@targets = (glob("$libpath/Debian/Debhelper/*.pm"), glob("$libpath/Debian/Debhelper/*/*.pm"));
 }
 
 plan(tests => scalar(@targets));

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git




More information about the debhelper-devel mailing list