gctl_test.t: more tweaks to try and update the code and get it functional (again?)

- Make the logfile for $out be built off the basename for $cmd, instead of $cmd.
  (r317292 broke this assumption).
- Rename $mntpt to $mntpt_prefix for clarity, as this variable is a prefix for
  mountpoints.
- Reindent the umount directive block while here to match the rest of the code.

MFC after:	5 weeks
Sponsored by:	Dell EMC Isilon
This commit is contained in:
Enji Cooper 2017-04-22 23:27:40 +00:00
parent 414bf3a177
commit 9940eaaa17
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=317308

View File

@ -29,8 +29,10 @@
use strict; use strict;
use warnings; use warnings;
use File::Basename;
my $disk = "/tmp/disk-$$"; my $disk = "/tmp/disk-$$";
my $mntpt = "/tmp/mount-$$"; my $mntpt_prefix = "/tmp/mount-$$";
my %steps = ( my %steps = (
"000" => "gctl", "000" => "gctl",
@ -137,7 +139,7 @@ if ($st != 0) {
} }
chomp(my $cmd = `make '-V\${.OBJDIR}/\${PROG}'`); chomp(my $cmd = `make '-V\${.OBJDIR}/\${PROG}'`);
my $out = "/tmp/$cmd.out"; my $out = basename($cmd) . ".out";
# Make sure we have permission to use gctl... # Make sure we have permission to use gctl...
if (`$cmd` =~ "^FAIL Permission denied") { if (`$cmd` =~ "^FAIL Permission denied") {
@ -192,14 +194,14 @@ foreach my $key (sort keys %steps) {
} }
unlink $out; unlink $out;
} elsif ($action =~ "^mount") { } elsif ($action =~ "^mount") {
system("mkdir $mntpt-$args"); system("mkdir $mntpt_prefix-$args");
system("newfs $args"); system("newfs $args");
system("mount -t ufs /dev/$args $mntpt-$args"); system("mount -t ufs /dev/$args $mntpt_prefix-$args");
print "ok $nr \# mount($key)\n"; print "ok $nr \# mount($key)\n";
} elsif ($action =~ "^umount") { } elsif ($action =~ "^umount") {
system("umount $mntpt-$args"); system("umount $mntpt_prefix-$args");
system("rmdir $mntpt-$args"); system("rmdir $mntpt_prefix-$args");
print "ok $nr \# umount($key)\n"; print "ok $nr \# umount($key)\n";
} }
$nr += 1; $nr += 1;
} }