aboutsummaryrefslogtreecommitdiff
path: root/tools/regression
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2017-04-22 23:30:02 +0000
committerEnji Cooper <ngie@FreeBSD.org>2017-04-22 23:30:02 +0000
commitd1f57d5900f0ef02414b41f2ebe92af63717d6a6 (patch)
tree2a7e21e57b73447e8f3431fa143e2891b5928a48 /tools/regression
parent9940eaaa17b17b1f4a106cd68130e27ec2832eca (diff)
downloadsrc-d1f57d5900f0ef02414b41f2ebe92af63717d6a6.tar.gz
src-d1f57d5900f0ef02414b41f2ebe92af63717d6a6.zip
gctl_test.t: improve error reporting with mdcfg and mount directives
If the commands had failed previously, it would press on and result in a series of cascading failures. Fail early and continue on to the next case instead of executing additional commands after a previously failed series of steps. MFC after: 5 weeks Sponsored by: Dell EMC Isilon
Notes
Notes: svn path=/head/; revision=317309
Diffstat (limited to 'tools/regression')
-rw-r--r--tools/regression/geom_gpt/gctl_test.t28
1 files changed, 19 insertions, 9 deletions
diff --git a/tools/regression/geom_gpt/gctl_test.t b/tools/regression/geom_gpt/gctl_test.t
index f760fe04747c..4161b968d22b 100644
--- a/tools/regression/geom_gpt/gctl_test.t
+++ b/tools/regression/geom_gpt/gctl_test.t
@@ -161,13 +161,15 @@ foreach my $key (sort keys %steps) {
$res =~ s/%dev%/$dev/g;
if ($action =~ "^gctl") {
+ my $errmsg = "";
system("$cmd $verbose $args | tee $out 2>&1");
- $st = `tail -1 $out`;
- if ($st =~ "^$res") {
- print "ok $nr \# gctl($key)\n";
- } else {
- print "not ok $nr \# gctl($key) - $st\n";
+ chomp($st = `tail -1 $out`);
+ if ($st ne $res) {
+ $errmsg = "\"$st\" (actual) != \"$res\" (expected)\n";
}
+ printf("%sok $nr \# gctl($key)%s\n",
+ ($errmsg eq "" ? "" : "not "),
+ ($errmsg eq "" ? "" : " - $errmsg"));
unlink $out;
} elsif ($action =~ "^mdcfg") {
if ($args =~ "^create") {
@@ -194,10 +196,18 @@ foreach my $key (sort keys %steps) {
}
unlink $out;
} elsif ($action =~ "^mount") {
- system("mkdir $mntpt_prefix-$args");
- system("newfs $args");
- system("mount -t ufs /dev/$args $mntpt_prefix-$args");
- print "ok $nr \# mount($key)\n";
+ my $errmsg = "";
+ mkdir("$mntpt_prefix-$args");
+ if (system("newfs /dev/$args") == 0) {
+ if (system("mount /dev/$args $mntpt_prefix-$args") != 0) {
+ $errmsg = "mount failed";
+ }
+ } else {
+ $errmsg = "newfs failed";
+ }
+ printf("%sok $nr # mount($key)%s\n",
+ ($errmsg eq "" ? "" : "not "),
+ ($errmsg eq "" ? "" : " - $errmsg"));
} elsif ($action =~ "^umount") {
system("umount $mntpt_prefix-$args");
system("rmdir $mntpt_prefix-$args");