Date: Mon, 29 May 2017 18:20:30 +0000 (UTC) From: Ngie Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r319154 - stable/10/tools/regression/geom_gpt Message-ID: <201705291820.v4TIKUOb029022@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Mon May 29 18:20:29 2017 New Revision: 319154 URL: https://svnweb.freebsd.org/changeset/base/319154 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/10/tools/regression/geom_gpt/gctl_test.t Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/regression/geom_gpt/gctl_test.t ============================================================================== --- stable/10/tools/regression/geom_gpt/gctl_test.t Mon May 29 18:19:32 2017 (r319153) +++ stable/10/tools/regression/geom_gpt/gctl_test.t Mon May 29 18:20:29 2017 (r319154) @@ -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`;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705291820.v4TIKUOb029022>