From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RaD39-0006Nt-RK for garchives@archives.gentoo.org; Mon, 12 Dec 2011 21:04:40 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 934C621C170; Mon, 12 Dec 2011 21:04:26 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 5BD1221C170 for ; Mon, 12 Dec 2011 21:04:26 +0000 (UTC) Received: from flycatcher.gentoo.org (flycatcher.gentoo.org [81.93.255.6]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 390BF1B402C for ; Mon, 12 Dec 2011 21:04:25 +0000 (UTC) Received: by flycatcher.gentoo.org (Postfix, from userid 559) id 060E12004C; Mon, 12 Dec 2011 21:04:24 +0000 (UTC) From: "Mike Frysinger (vapier)" To: gentoo-commits@lists.gentoo.org Reply-To: gentoo-dev@lists.gentoo.org, vapier@gentoo.org Subject: [gentoo-commits] gentoo-projects commit in portage-utils/tests: init.sh X-VCS-Repository: gentoo-projects X-VCS-Files: init.sh X-VCS-Directories: portage-utils/tests X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger Content-Type: text/plain; charset=utf8 Message-Id: <20111212210424.060E12004C@flycatcher.gentoo.org> Date: Mon, 12 Dec 2011 21:04:24 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 9117a40c-84a5-4763-a6ee-10455167410a X-Archives-Hash: 5c558b27c376e99617fee2d4221c7ec1 vapier 11/12/12 21:04:24 Modified: init.sh Log: first pass at integrating the testsuite into autotools code Revision Changes Path 1.4 portage-utils/tests/init.sh file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils= /tests/init.sh?rev=3D1.4&view=3Dmarkup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils= /tests/init.sh?rev=3D1.4&content-type=3Dtext/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils= /tests/init.sh?r1=3D1.3&r2=3D1.4 Index: init.sh =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /var/cvsroot/gentoo-projects/portage-utils/tests/init.sh,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- init.sh 17 Mar 2011 03:16:45 -0000 1.3 +++ init.sh 12 Dec 2011 21:04:23 -0000 1.4 @@ -1,10 +1,26 @@ -d=3D$PWD -while [[ $d !=3D "/" ]] ; do - [[ -e $d/q ]] && break - d=3D${d%/*} -done -PATH=3D$d:$PATH -unset d +setup_path() { + local d=3D$PWD + while [[ $d !=3D "/" ]] ; do + [[ -e $d/q ]] && break + d=3D${d%/*} + done + PATH=3D$d:$PATH +} +setup_path + +# matches tests/subdir.mk +setup_env() { + local a=3D${0%/*} + a=3D${a##*/} + + : ${b:=3D.} + : ${s:=3D.} + : ${atb:=3D${PWD}/../..} + : ${ats:=3D${PWD}/../..} + : ${ab:=3D${atb}/tests/${a}} + : ${as:=3D${ats}/tests/${a}} +} +setup_env =20 # clean any random vars from the host system unset ROOT PORTAGE_CONFIGROOT PORTAGE_QUIET @@ -17,13 +33,28 @@ } die() { fail "$@" ; } =20 +skip() { + echo "SKIPPED: $*" + exit 0 +} + pass() { echo "PASSED" exit 0 } =20 mktmpdir() { - local d=3D${1:-tmp} - rm -rf "$d" && mkdir "$d" && cd "$d" \ - || fail "could not make tmp dir '$1'" + local d=3D${1:-${ab}/tmp} + rm -rf "$d" && \ + mkdir -p "$d" && \ + pushd "$d" >/dev/null \ + || fail "could not make tmp dir '$d'" +} +_cleantmpdir() { + local cmd=3D$1; shift + local d=3D${1:-${ab}/tmp} + popd >/dev/null + ${cmd} "${d}" || fail "could not clean tmp dir '$d'" } +cleantmpdir() { _cleantmpdir "rm -rf" "$@" ; } +trimtmpdir() { _cleantmpdir "rmdir" "$@" ; }