From owner-svn-src-head@freebsd.org Sat Jun 10 20:56:33 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04338BF61B8; Sat, 10 Jun 2017 20:56:33 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C306E26B2; Sat, 10 Jun 2017 20:56:32 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5AKuVhW073928; Sat, 10 Jun 2017 20:56:31 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5AKuVJg073927; Sat, 10 Jun 2017 20:56:31 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201706102056.v5AKuVJg073927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 10 Jun 2017 20:56:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319806 - head/tools/regression/geom_gpt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jun 2017 20:56:33 -0000 Author: ngie Date: Sat Jun 10 20:56:31 2017 New Revision: 319806 URL: https://svnweb.freebsd.org/changeset/base/319806 Log: Improve handling with system state - Always unlink $cmd after exit via END block. - The tests don't function well if kern.geom.debugflags != 0. Save debugflags, then restore them at the end of the test. MFC after: 1 month Sponsored by: Dell EMC Isilon Modified: head/tools/regression/geom_gpt/gctl_test.t Modified: head/tools/regression/geom_gpt/gctl_test.t ============================================================================== --- head/tools/regression/geom_gpt/gctl_test.t Sat Jun 10 20:50:50 2017 (r319805) +++ head/tools/regression/geom_gpt/gctl_test.t Sat Jun 10 20:56:31 2017 (r319806) @@ -144,10 +144,20 @@ my $out = basename($cmd) . ".out"; # Make sure we have permission to use gctl... if (`$cmd` =~ "^FAIL Permission denied") { print "1..0 # SKIP insufficient permissions\n"; - unlink $cmd; exit 0; } +my $debugflags_oid = 'kern.geom.debugflags'; +chomp(my $old_geom_debugflags = `sysctl -n $debugflags_oid`); +if ($? != 0) { + print "1..0 # SKIP could not query $debugflags_oid\n"; + exit 0; +} +if (system("sysctl $debugflags_oid=0") != 0) { + print "1..0 # SKIP could not set $debugflags_oid=0\n"; + exit 0; +} + my $count = keys (%steps); print "1..$count\n"; @@ -227,4 +237,7 @@ foreach my $key (sort keys %steps) { } $nr += 1; } -exit 0; +END { + system("sysctl $debugflags_oid=$old_geom_debugflags"); + unlink($cmd); +}