diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2020-05-06 11:26:07 +0200 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2020-05-06 11:31:34 +0200 |
commit | 69943197c142df344dd3a5d1e3202fabb1173813 (patch) | |
tree | d788e83ca6e5b43ccdedd6602926f249f5239794 | |
parent | 36f4c4853260bbdbfbfd7b1107bdf59bdaaff6e1 (diff) | |
download | perl-Hal-Cdroms-69943197c142df344dd3a5d1e3202fabb1173813.tar perl-Hal-Cdroms-69943197c142df344dd3a5d1e3202fabb1173813.tar.gz perl-Hal-Cdroms-69943197c142df344dd3a5d1e3202fabb1173813.tar.bz2 perl-Hal-Cdroms-69943197c142df344dd3a5d1e3202fabb1173813.tar.xz perl-Hal-Cdroms-69943197c142df344dd3a5d1e3202fabb1173813.zip |
perl_checker cleanups
-rw-r--r-- | t/helper.pm | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/t/helper.pm b/t/helper.pm index 58b049e..538a9ae 100644 --- a/t/helper.pm +++ b/t/helper.pm @@ -4,7 +4,7 @@ use strict; use base 'Exporter'; our @EXPORT = qw(can_create_fake_media create_fake_media find_mount_point remove_fake_media ); -sub can_create_fake_media { +sub can_create_fake_media() { system("modprobe -n scsi_debug") == 0; } @@ -16,7 +16,7 @@ sub create_fake_media { my @paths = glob("/sys/bus/pseudo/drivers/scsi_debug/adapter0/host*/target*/*:*/block/*"); @paths == 1 or die "Unexpected number of scsi_debug devices\n"; - my ($prefix, $device) = split("block/", $paths[0]); + my ($_prefix, $device) = split("block/", $paths[0]); if ($o_delay) { system("echo 'sleep $o_delay; dd if=t/cdroms-test.iso of=/dev/$device conv=nocreat' | at -M now >& /dev/null") == 0 or die "Failed to schedule copy of ISO to fake SCSI device\n"; @@ -27,7 +27,7 @@ sub create_fake_media { $device; } -sub remove_fake_media { +sub remove_fake_media() { my $tries = 0; while (system("modprobe -r -q scsi_debug") != 0) { ++$tries < 5 or die "Failed to remove scsi_debug kernel module\n"; @@ -38,6 +38,7 @@ sub remove_fake_media { sub find_mount_point { my ($device) = @_; open(my $fh, '<', '/proc/mounts') or die "Couldn't read /proc/mounts\n"; + local $_; while (<$fh>) { my ($device_path, $mount_point) = split(' ', $_); return $mount_point if $device_path eq "/dev/$device"; |