aboutsummaryrefslogtreecommitdiffstats
path: root/t/helper.pm
diff options
context:
space:
mode:
Diffstat (limited to 't/helper.pm')
-rw-r--r--t/helper.pm9
1 files changed, 7 insertions, 2 deletions
diff --git a/t/helper.pm b/t/helper.pm
index 538a9ae..10331a1 100644
--- a/t/helper.pm
+++ b/t/helper.pm
@@ -2,7 +2,11 @@ package helper;
use strict;
use base 'Exporter';
-our @EXPORT = qw(can_create_fake_media create_fake_media find_mount_point remove_fake_media );
+our @EXPORT = qw(can_create_fake_media create_fake_media find_mount_point get_at_command remove_fake_media );
+
+sub get_at_command() {
+ 'at -M now';
+}
sub can_create_fake_media() {
system("modprobe -n scsi_debug") == 0;
@@ -18,7 +22,8 @@ sub create_fake_media {
or die "Unexpected number of scsi_debug devices\n";
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
+ my $at = get_at_command();
+ system("echo 'sleep $o_delay; dd if=t/cdroms-test.iso of=/dev/$device conv=nocreat' | $at >& /dev/null") == 0
or die "Failed to schedule copy of ISO to fake SCSI device\n";
} else {
system("dd if=t/cdroms-test.iso of=/dev/$device conv=nocreat >& /dev/null") == 0