public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Mike Frysinger (vapier)" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-projects commit in portage-utils/tests: init.sh
Date: Mon, 12 Dec 2011 21:04:24 +0000 (UTC)	[thread overview]
Message-ID: <20111212210424.060E12004C@flycatcher.gentoo.org> (raw)

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=1.4&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/tests/init.sh?rev=1.4&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/tests/init.sh?r1=1.3&r2=1.4

Index: init.sh
===================================================================
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=$PWD
-while [[ $d != "/" ]] ; do
-	[[ -e $d/q ]] && break
-	d=${d%/*}
-done
-PATH=$d:$PATH
-unset d
+setup_path() {
+	local d=$PWD
+	while [[ $d != "/" ]] ; do
+		[[ -e $d/q ]] && break
+		d=${d%/*}
+	done
+	PATH=$d:$PATH
+}
+setup_path
+
+# matches tests/subdir.mk
+setup_env() {
+	local a=${0%/*}
+	a=${a##*/}
+
+	: ${b:=.}
+	: ${s:=.}
+	: ${atb:=${PWD}/../..}
+	: ${ats:=${PWD}/../..}
+	: ${ab:=${atb}/tests/${a}}
+	: ${as:=${ats}/tests/${a}}
+}
+setup_env
 
 # clean any random vars from the host system
 unset ROOT PORTAGE_CONFIGROOT PORTAGE_QUIET
@@ -17,13 +33,28 @@
 }
 die() { fail "$@" ; }
 
+skip() {
+	echo "SKIPPED: $*"
+	exit 0
+}
+
 pass() {
 	echo "PASSED"
 	exit 0
 }
 
 mktmpdir() {
-	local d=${1:-tmp}
-	rm -rf "$d" && mkdir "$d" && cd "$d" \
-		|| fail "could not make tmp dir '$1'"
+	local d=${1:-${ab}/tmp}
+	rm -rf "$d" && \
+	mkdir -p "$d" && \
+	pushd "$d" >/dev/null \
+		|| fail "could not make tmp dir '$d'"
+}
+_cleantmpdir() {
+	local cmd=$1; shift
+	local d=${1:-${ab}/tmp}
+	popd >/dev/null
+	${cmd} "${d}" || fail "could not clean tmp dir '$d'"
 }
+cleantmpdir() { _cleantmpdir "rm -rf" "$@" ; }
+trimtmpdir() { _cleantmpdir "rmdir" "$@" ; }






             reply	other threads:[~2011-12-12 21:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-12 21:04 Mike Frysinger (vapier) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-10-28  5:58 [gentoo-commits] gentoo-projects commit in portage-utils/tests: init.sh Mike Frysinger (vapier)
2011-12-22 19:30 Mike Frysinger (vapier)
2011-12-18  6:49 Mike Frysinger (vapier)
2011-03-17  3:16 Mike Frysinger (vapier)
2011-03-01  4:58 Mike Frysinger (vapier)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111212210424.060E12004C@flycatcher.gentoo.org \
    --to=vapier@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox