gctl_test.t: minor tweaks

- Declare $count with the `my` scope operator to permit `use strict`.
- Add `use strict`.
- Use `use warnings` instead of using `-w` in the shebang.
- Don't unlink $cmd when done (prevents unnecessary rebuilding).
- Improve the error message when running with insufficient permissions, e.g.,
  non-root.

MFC after:	5 weeks
Sponsored by:	Dell EMC Isilon
This commit is contained in:
Enji Cooper 2017-04-22 22:40:39 +00:00
parent 4e47dd1885
commit acca703a09

View File

@ -1,4 +1,4 @@
#!/usr/bin/env perl -w
#!/usr/bin/env perl
#
# Copyright (c) 2005, 2006 Marcel Moolenaar
# All rights reserved.
@ -26,6 +26,9 @@
#
# $FreeBSD$
use strict;
use warnings;
my $disk = "/tmp/disk-$$";
my $mntpt = "/tmp/mount-$$";
@ -138,12 +141,12 @@ my $out = "/tmp/$cmd.out";
# Make sure we have permission to use gctl...
if (`$cmd` =~ "^FAIL Permission denied") {
print "1..0 # SKIP not enough permission\n";
print "1..0 # SKIP insufficient permissions\n";
unlink $cmd;
exit 0;
}
$count = keys (%steps);
my $count = keys (%steps);
print "1..$count\n";
my $nr = 1;
@ -200,6 +203,4 @@ foreach my $key (sort keys %steps) {
}
$nr += 1;
}
unlink $cmd;
exit 0;