diff options
author | ngie <ngie@FreeBSD.org> | 2017-05-29 18:20:29 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2017-05-29 18:20:29 +0000 |
commit | da4d917b71db283f140ff28b592040e86ce40a77 (patch) | |
tree | bc030f7402bb6f8d435aee105ad03b163215bfff /tools | |
parent | 8cffbb101f23735f79c4a426e33a0872dfbebb16 (diff) | |
download | FreeBSD-src-da4d917b71db283f140ff28b592040e86ce40a77.zip FreeBSD-src-da4d917b71db283f140ff28b592040e86ce40a77.tar.gz |
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.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/regression/geom_gpt/gctl_test.t | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/tools/regression/geom_gpt/gctl_test.t b/tools/regression/geom_gpt/gctl_test.t index 4161b96..3846984 100644 --- a/tools/regression/geom_gpt/gctl_test.t +++ b/tools/regression/geom_gpt/gctl_test.t @@ -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`; |