svn commit: r319153 - stable/11/tools/regression/geom_gpt
Ngie Cooper
ngie at FreeBSD.org
Mon May 29 18:19:33 UTC 2017
Author: ngie
Date: Mon May 29 18:19:32 2017
New Revision: 319153
URL: https://svnweb.freebsd.org/changeset/base/319153
Log:
MFC r317313:
gctl_test.t: catch errors with the mdcfg directive
While here, add a note about certain testcases relying on `count=1024` in
the "create" portion.
Modified:
stable/11/tools/regression/geom_gpt/gctl_test.t
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/tools/regression/geom_gpt/gctl_test.t
==============================================================================
--- stable/11/tools/regression/geom_gpt/gctl_test.t Mon May 29 18:17:34 2017 (r319152)
+++ stable/11/tools/regression/geom_gpt/gctl_test.t Mon May 29 18:19:32 2017 (r319153)
@@ -172,20 +172,32 @@ foreach my $key (sort keys %steps) {
($errmsg eq "" ? "" : " - $errmsg"));
unlink $out;
} elsif ($action =~ "^mdcfg") {
+ my $errmsg = "";
if ($args =~ "^create") {
- system("dd if=/dev/zero of=$disk count=1024 2>&1");
- if ($args =~ "corrupted") {
- system("gpt create -p $disk");
+ # NOTE: `count=1024` affects $key => {"025" "054", "065"}.
+ if (system("dd if=/dev/zero of=$disk count=1024 2>&1") == 0) {
+ chomp($dev = `mdconfig -a -t vnode -f $disk`);
+ if ($? == 0) {
+ if (system("gpart create -s GPT $dev") != 0) {
+ $errmsg = "gpart create failed";
+ }
+ } else {
+ $errmsg = "mdconfig -a failed";
+ }
+ } else {
+ $errmsg = "dd failed";
}
- $dev = `mdconfig -a -t vnode -f $disk`;
- chomp $dev;
} elsif ($args =~ "^destroy") {
$dev =~ s/md/-u /g;
- system("mdconfig -d $dev");
+ if (system("mdconfig -d $dev") != 0) {
+ $errmsg = "mdconfig -d failed";
+ }
unlink $disk;
$dev = "n/a";
}
- print "ok $nr \# mdcfg($key)\n";
+ printf("%sok $nr # mdcfg($key)%s\n",
+ ($errmsg eq "" ? "" : "not "),
+ ($errmsg eq "" ? "" : " - $errmsg"));
} elsif ($action =~ "^conf") {
system("sysctl -b kern.geom.conftxt | grep -a $dev | sed -e s:$disk:DISK:g -e s:$dev:DEV:g | sort | md5 -p | tee $out 2>&1");
$st = `tail -1 $out`;
More information about the svn-src-stable-11
mailing list