[dpkg] 187/200: test: Use the detected perl interpreter instead of a random one from PATH

Ximin Luo infinity0 at debian.org
Wed Apr 5 15:17:39 UTC 2017


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

infinity0 pushed a commit to branch master
in repository dpkg.

commit a390de3632925cf1271523a8672dfb642caa68eb
Author: Guillem Jover <guillem at debian.org>
Date:   Sat Feb 11 20:01:14 2017 +0100

    test: Use the detected perl interpreter instead of a random one from PATH
    
    We check for a specific version of perl and store that in the PERL
    variable. But the shebangs on several test scripts hardcode a specific
    perl that might not be present or might not be recent enough. Always
    invoke perl scripts explicitly with PERL, or implicitly by letting the
    currently running interpreter use itself.
---
 check.am                      | 3 ++-
 debian/changelog              | 2 ++
 scripts/t/dpkg_buildpackage.t | 3 ++-
 scripts/t/dpkg_source.t       | 2 +-
 scripts/t/merge_changelogs.t  | 2 +-
 scripts/t/mk.t                | 4 ++--
 6 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/check.am b/check.am
index 48e4a26..30d194b 100644
--- a/check.am
+++ b/check.am
@@ -15,7 +15,8 @@ TEST_PARALLEL ?= 1
 TEST_RUNNER = '\
 	my $$harness = TAP::Harness->new({ \
 	    exec => sub { my (undef, $$test) = @_; \
-	                  return -x $$test ? [ $$test ] : undef }, \
+	        return [ $$test ] if $$test !~ "\.t\$$" and -x $$test; \
+	        return }, \
 	    lib => [ "$(top_srcdir)/scripts", "$(top_srcdir)/dselect/methods"  ], \
 	    color => 1, \
 	    verbosity => $(TEST_VERBOSE), \
diff --git a/debian/changelog b/debian/changelog
index a5fc775..eea8f25 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -37,6 +37,8 @@ dpkg (1.18.23) UNRELEASED; urgency=medium
       BSD systems.
     - Do not fail on missing compression libraries or headers on automatic
       detection mode. Regression introduced in dpkg 1.18.14.
+  * Test suite:
+    - Use the detected perl interpreter instead of a random one from PATH.
 
  -- Guillem Jover <guillem at debian.org>  Wed, 01 Feb 2017 06:28:28 +0100
 
diff --git a/scripts/t/dpkg_buildpackage.t b/scripts/t/dpkg_buildpackage.t
index 5c3a540..faae2cb 100644
--- a/scripts/t/dpkg_buildpackage.t
+++ b/scripts/t/dpkg_buildpackage.t
@@ -184,7 +184,8 @@ sub test_build
     my $stderr;
 
     chdir $dirname;
-    spawn(exec => [ "$srcdir/dpkg-buildpackage.pl", '--host-arch=amd64',
+    spawn(exec => [ $ENV{PERL}, "$srcdir/dpkg-buildpackage.pl",
+                    '--host-arch=amd64',
                     '--unsigned-source', '--unsigned-changes',
                     '--unsigned-buildinfo',
                     "--build=$typename", '--check-command=' ],
diff --git a/scripts/t/dpkg_source.t b/scripts/t/dpkg_source.t
index 2de0c0d..cdbedce 100644
--- a/scripts/t/dpkg_source.t
+++ b/scripts/t/dpkg_source.t
@@ -134,7 +134,7 @@ sub test_build_source
     my ($name) = shift;
     my $stderr;
 
-    spawn(exec => [ "$srcdir/dpkg-source.pl", '--build', $name ],
+    spawn(exec => [ $ENV{PERL}, "$srcdir/dpkg-source.pl", '--build', $name ],
           error_to_string => \$stderr,
           wait_child => 1, nocheck => 1);
 
diff --git a/scripts/t/merge_changelogs.t b/scripts/t/merge_changelogs.t
index a9221c7..dfb7521 100644
--- a/scripts/t/merge_changelogs.t
+++ b/scripts/t/merge_changelogs.t
@@ -31,7 +31,7 @@ my $res;
 sub test_merge {
     my ($expected_file, @options) = @_;
     my $fh = File::Temp->new();
-    spawn(exec => ["$srcdir/dpkg-mergechangelogs.pl", @options],
+    spawn(exec => [ $ENV{PERL}, "$srcdir/dpkg-mergechangelogs.pl", @options ],
 	  to_handle => $fh, error_to_file => '/dev/null',
 	  wait_child => 1, nocheck => 1);
     my $res = compare($expected_file, $fh->filename);
diff --git a/scripts/t/mk.t b/scripts/t/mk.t
index 62d6124..01ce0fa 100644
--- a/scripts/t/mk.t
+++ b/scripts/t/mk.t
@@ -65,7 +65,7 @@ sub cmd_get_vars {
 
 # Test makefiles.
 
-my %arch = cmd_get_vars("$srcdir/dpkg-architecture.pl", '-f');
+my %arch = cmd_get_vars($ENV{PERL}, "$srcdir/dpkg-architecture.pl", '-f');
 
 delete $ENV{$_} foreach keys %arch;
 $ENV{"TEST_$_"} = $arch{$_} foreach keys %arch;
@@ -73,7 +73,7 @@ test_makefile('architecture.mk');
 $ENV{$_} = $arch{$_} foreach keys %arch;
 test_makefile('architecture.mk');
 
-my %buildflag = cmd_get_vars("$srcdir/dpkg-buildflags.pl");
+my %buildflag = cmd_get_vars($ENV{PERL}, "$srcdir/dpkg-buildflags.pl");
 
 delete $ENV{$_} foreach keys %buildflag;
 $ENV{"TEST_$_"} = $buildflag{$_} foreach keys %buildflag;

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



More information about the Reproducible-commits mailing list