diff options
author | Felipe Sateler <fsateler@debian.org> | 2018-08-15 23:51:56 -0300 |
---|---|---|
committer | Felipe Sateler <fsateler@debian.org> | 2018-08-15 23:51:56 -0300 |
commit | 7696f9178a99ad3f2543a8209b2371fe5a355d78 (patch) | |
tree | 4a415edbd0fa9ea51b30064240a259a32bc72f7a | |
parent | 5e68389bddd66b2dc2ee3f8296b24e041e0d1bf9 (diff) |
tests: only load Linux::Clone if not testing on real system
'use' directive is evaluated at compile time, so having it inside an 'if'
statement does not have the expected effect. Use the 'use if' directive instead.
This fixes running the autopkgtests in clean systems without Linux::Clone module
-rw-r--r-- | t/helpers.pm | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/t/helpers.pm b/t/helpers.pm index db0eb96..8600cd4 100644 --- a/t/helpers.pm +++ b/t/helpers.pm @@ -1,4 +1,5 @@ use File::Temp qw(tempdir); # in core since perl 5.6.1 +use if !$ENV{'TEST_ON_REAL_SYSTEM'}, "Linux::Clone"; # neither in core nor in Debian :-/ sub bind_mount_tmp { my ($dir) = @_; @@ -15,8 +16,6 @@ sub bind_mount_tmp { # thus do not bindmount a tmpdir on /lib/systemd. sub test_setup() { unless ($ENV{'TEST_ON_REAL_SYSTEM'}) { - use Linux::Clone; # neither in core nor in Debian :-/ - open(my $fh, '<', "/proc/$$/mountinfo") or BAIL_OUT("Cannot open(/proc/$$/mountinfo): $!"); |