Browse Source

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.
Guillem Jover 4 years ago
parent
commit
a390de3632
6 changed files with 10 additions and 6 deletions
  1. 2 1
      check.am
  2. 2 0
      debian/changelog
  3. 2 1
      scripts/t/dpkg_buildpackage.t
  4. 1 1
      scripts/t/dpkg_source.t
  5. 1 1
      scripts/t/merge_changelogs.t
  6. 2 2
      scripts/t/mk.t

+ 2 - 1
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), \

+ 2 - 0
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@debian.org>  Wed, 01 Feb 2017 06:28:28 +0100
 

+ 2 - 1
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=' ],

+ 1 - 1
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);
 

+ 1 - 1
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);

+ 2 - 2
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;