1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
Description: Add switch to use installed perl5i libraries in test suite under autopkgtest
Author: Axel Beckert <abe@debian.org>
Bug-Debian: https://bugs.debian.org/785043
--- a/t/command_line_wrapper.t
+++ b/t/command_line_wrapper.t
@@ -10,13 +10,13 @@
use Test::More;
my $perl5i;
-my $script_dir = File::Spec->catdir("blib", "script");
+my $script_dir = File::Spec->catdir(defined($ENV{ADTTMP}) ? ('/usr', 'bin') : ("blib", "script"));
for my $wrapper (qw(perl5i perl5i.bat)) {
$perl5i = File::Spec->catfile($script_dir, $wrapper);
last if -e $perl5i;
}
-my $perl5icmd = qq[$perl5i "-Ilib"];
-my @perl5icmd = ($perl5i, "-Ilib");
+my $perl5icmd = defined($ENV{ADTTMP}) ? qq[$perl5i] : qq[$perl5i "-Ilib"];
+my @perl5icmd = defined($ENV{ADTTMP}) ? ($perl5i) : ($perl5i, "-Ilib");
ok -e $perl5i, "perl5i command line wrapper was built";
@@ -61,7 +61,7 @@
# Check it doesn't have strict vars on
is capture {system @perl5icmd, '-e', q($fun="yay"; say $fun;)}, "yay\n", 'no strict vars for perl5i';
-is capture {system ($^X, '-Ilib', '-Mperl5i::latest', '-e', q|$fun="yay"; say $fun;|)},
+is capture {system ($^X, defined($ENV{ADTTMP}) ? () : ('-Ilib'), '-Mperl5i::latest', '-e', q|$fun="yay"; say $fun;|)},
"yay\n", q{no strict vars for perl -Mperl5i::latest -e '...'};
# It acts like Perl when given weird arguments.
--- a/t/perl5i.t
+++ b/t/perl5i.t
@@ -11,7 +11,7 @@
like $@, qr/perl5i will break compatibility/;
# but -Mperl5i on the command line means -Mperl5i::latest, and it A-OK
-is capture {system ($^X, '-Ilib', '-Mperl5i', '-e', q|say 'OK!'|)},
+is capture {system ($^X, defined($ENV{ADTTMP}) ? () : ('-Ilib'), '-Mperl5i', '-e', q|say 'OK!'|)},
"OK!\n", q{perl -Mperl5i -e '...' means -Mperl5i::latest};
done_testing();
|