From owner-svn-src-stable-10@freebsd.org Fri Jan 15 02:13:56 2016 Return-Path: Delivered-To: svn-src-stable-10@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 DB2B2A8225D; Fri, 15 Jan 2016 02:13:56 +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 8EDD11ED0; Fri, 15 Jan 2016 02:13:56 +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 u0F2Dtpe037320; Fri, 15 Jan 2016 02:13:55 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0F2DtQX037319; Fri, 15 Jan 2016 02:13:55 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201601150213.u0F2DtQX037319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 15 Jan 2016 02:13:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r294063 - stable/10/tools/regression X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jan 2016 02:13:57 -0000 Author: ngie Date: Fri Jan 15 02:13:55 2016 New Revision: 294063 URL: https://svnweb.freebsd.org/changeset/base/294063 Log: MFC r293028,r293029: r293028: - Use geom load instead of g load; g doesn't exist for all geom classes, e.g. geom_uzip(4) - These tests require root. Skip all of the tests if they're run as non-root r293029: Add functions for managing md(4) devices and cleaning up said md(4) devices These will be used soon in the various test scripts that source geom_subr.sh Modified: stable/10/tools/regression/geom_subr.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/regression/geom_subr.sh ============================================================================== --- stable/10/tools/regression/geom_subr.sh Fri Jan 15 01:34:43 2016 (r294062) +++ stable/10/tools/regression/geom_subr.sh Fri Jan 15 02:13:55 2016 (r294063) @@ -1,7 +1,12 @@ #!/bin/sh # $FreeBSD$ -kldstat -q -m g_${class} || g${class} load || exit 1 +if [ $(id -u) -ne 0 ]; then + echo 'Tests must be run as root' + echo 'Bail out!' + exit 1 +fi +kldstat -q -m g_${class} || geom ${class} load || exit 1 devwait() { @@ -12,3 +17,32 @@ devwait() sleep 0.2 done } + +# Need to keep track of the test md devices to avoid the scenario where a test +# failing will cause the other tests to bomb out, or a test failing will leave +# a large number of md(4) devices lingering around +: ${TMPDIR=/tmp} +export TMPDIR +TEST_MDS_FILE=${TMPDIR}/test_mds + +attach_md() +{ + local test_md + + test_md=$(mdconfig -a "$@") || exit + echo $test_md >> $TEST_MDS_FILE || exit + echo $test_md +} + +geom_test_cleanup() +{ + local test_md + + if [ -f $TEST_MDS_FILE ]; then + while read test_md; do + # The "#" tells the TAP parser this is a comment + echo "# Removing test memory disk: $test_md" + mdconfig -d -u $test_md + done < $TEST_MDS_FILE + fi +}