diff options
author | ngie <ngie@FreeBSD.org> | 2017-05-29 18:19:32 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2017-05-29 18:19:32 +0000 |
commit | e7cb3e947cdbee039483e5d0a8fb60576804ccb8 (patch) | |
tree | 710bf83d5ae4456ebf4a9d3a6bf9d07be4b89344 /tools/regression | |
parent | c66b4daaa1f01f6177f69ec8d846126091a29b94 (diff) | |
download | FreeBSD-src-e7cb3e947cdbee039483e5d0a8fb60576804ccb8.zip FreeBSD-src-e7cb3e947cdbee039483e5d0a8fb60576804ccb8.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/regression')
-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`; |