svn commit: r319806 - head/tools/regression/geom_gpt
Ngie Cooper
ngie at FreeBSD.org
Sat Jun 10 20:56:33 UTC 2017
Author: ngie
Date: Sat Jun 10 20:56:31 2017
New Revision: 319806
URL: https://svnweb.freebsd.org/changeset/base/319806
Log:
Improve handling with system state
- Always unlink $cmd after exit via END block.
- The tests don't function well if kern.geom.debugflags != 0. Save debugflags,
then restore them at the end of the test.
MFC after: 1 month
Sponsored by: Dell EMC Isilon
Modified:
head/tools/regression/geom_gpt/gctl_test.t
Modified: head/tools/regression/geom_gpt/gctl_test.t
==============================================================================
--- head/tools/regression/geom_gpt/gctl_test.t Sat Jun 10 20:50:50 2017 (r319805)
+++ head/tools/regression/geom_gpt/gctl_test.t Sat Jun 10 20:56:31 2017 (r319806)
@@ -144,10 +144,20 @@ my $out = basename($cmd) . ".out";
# Make sure we have permission to use gctl...
if (`$cmd` =~ "^FAIL Permission denied") {
print "1..0 # SKIP insufficient permissions\n";
- unlink $cmd;
exit 0;
}
+my $debugflags_oid = 'kern.geom.debugflags';
+chomp(my $old_geom_debugflags = `sysctl -n $debugflags_oid`);
+if ($? != 0) {
+ print "1..0 # SKIP could not query $debugflags_oid\n";
+ exit 0;
+}
+if (system("sysctl $debugflags_oid=0") != 0) {
+ print "1..0 # SKIP could not set $debugflags_oid=0\n";
+ exit 0;
+}
+
my $count = keys (%steps);
print "1..$count\n";
@@ -227,4 +237,7 @@ foreach my $key (sort keys %steps) {
}
$nr += 1;
}
-exit 0;
+END {
+ system("sysctl $debugflags_oid=$old_geom_debugflags");
+ unlink($cmd);
+}
More information about the svn-src-head
mailing list