[debsums] 01/01: Make sure the tests test the installed package if run under autopkgtest

Axel Beckert abe at deuxchevaux.org
Wed Jul 1 22:35:58 UTC 2015


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

abe pushed a commit to branch master
in repository debsums.

commit 84c98831e9d35d86cdc60babef49a8b93305dd6e
Author: Axel Beckert <abe at deuxchevaux.org>
Date:   Thu Jul 2 00:34:21 2015 +0200

    Make sure the tests test the installed package if run under autopkgtest
---
 debian/changelog     |  2 ++
 debian/tests/debsums |  2 +-
 t/debsums.t          | 16 +++++++---------
 t/version-and-help.t | 16 +++++++---------
 4 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a2be9e6..2f1fd52 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,8 @@ debsums (2.1.1) UNRELEASED; urgency=medium
     + Add debian/tests/control and debian/tests/debsums.
     + Add an lintian override for the pkg-perl-specific lintian warning
       nonteam-testsuite-header.
+  * Make sure that the test suite tests the installed package if run under
+    autopkgtest.
 
  -- Axel Beckert <abe at debian.org>  Sun, 17 May 2015 22:09:20 +0200
 
diff --git a/debian/tests/debsums b/debian/tests/debsums
index 2ef724d..4b52ab4 100755
--- a/debian/tests/debsums
+++ b/debian/tests/debsums
@@ -1,2 +1,2 @@
 #!/bin/sh
-prove -v
+env DEBIAN_AS_INSTALLED_TESTING=1 prove -v
diff --git a/t/debsums.t b/t/debsums.t
index 7db7bc9..1c1d584 100644
--- a/t/debsums.t
+++ b/t/debsums.t
@@ -8,22 +8,20 @@ use warnings;
 use Test::More;
 use Test::Command::Simple;
 
-my $command;
 my $chroot;
 my @command;
 
 # Untaint stuff
 delete $ENV{PATH};
 
-# First check if we are testing a source package (debsums in current
-# directory) or an installed package (full path).
-foreach my $cmd (qw(./debsums /usr/bin/debsums)) {
-    if (-x $cmd) {
-        $command = $cmd;
-        last;
-    }
+# First check if we are testing a source package or an installed package.
+my $command = './debsums';
+if (exists $ENV{ADTTMP} or exists $ENV{DEBIAN_AS_INSTALLED_TESTING}) {
+    $command = '/usr/bin/debsums';
 }
-ok($command, "Command debsums found at $command");
+
+ok(-e $command, "Command debsums found at $command");
+ok(-x $command, "$command executable");
 
 foreach my $state (qw(clean dirty)) {
     my $exit_code = $state eq 'clean' ? 0 : 2;
diff --git a/t/version-and-help.t b/t/version-and-help.t
index 4c38e49..144f324 100644
--- a/t/version-and-help.t
+++ b/t/version-and-help.t
@@ -8,22 +8,20 @@ use warnings;
 use Test::More;
 use Test::Command::Simple;
 
-my $command;
 my $chroot;
 my @command;
 
 # Untaint stuff
 delete $ENV{PATH};
 
-# First check if we are testing a source package (debsums in current
-# directory) or an installed package (full path).
-foreach my $cmd (qw(./debsums /usr/bin/debsums)) {
-    if (-x $cmd) {
-        $command = $cmd;
-        last;
-    }
+# First check if we are testing a source package or an installed package.
+my $command = './debsums';
+if (exists $ENV{ADTTMP} or exists $ENV{DEBIAN_AS_INSTALLED_TESTING}) {
+    $command = '/usr/bin/debsums';
 }
-ok($command, "Command debsums found at $command");
+
+ok(-e $command, "Command debsums found at $command");
+ok(-x $command, "$command executable");
 
 run($command, '--version');
 is(stderr, '', 'STDERR is empty');

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



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