pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

mk/tests: allow concurrent test runs



Module Name:	pkgsrc-wip
Committed By:	Roland Illig <rillig%NetBSD.org@localhost>
Pushed By:	rillig
Date:		Fri Mar 9 08:15:42 2018 +0000
Changeset:	b0558ddac5d08f153048976e94c22beb6df74ee0

Modified Files:
	mk/tests/test.subr

Log Message:
mk/tests: allow concurrent test runs

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=b0558ddac5d08f153048976e94c22beb6df74ee0

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 mk/tests/test.subr | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diffs:
diff --git a/mk/tests/test.subr b/mk/tests/test.subr
index 1bee0b305b..7ae4a22746 100644
--- a/mk/tests/test.subr
+++ b/mk/tests/test.subr
@@ -27,10 +27,13 @@ cvs_admin_set_date() {
 }
 
 setup_package() {
+	trap clean_up EXIT
+
 	pkgsrcdir=`cd "$srcdir/../../.." && exec pwd`
 	test -f "$pkgsrcdir/mk/bsd.pkg.mk" || die "This test must be run from inside pkgsrc"
 
-	pkgdir="$pkgsrcdir/mk-scm-tests/mk-scm-tests"
+	category=`uuidgen 2>/dev/null || echo "wip-mk-scm-${RANDOM-4}"`
+	pkgdir="$pkgsrcdir/$category/mk-scm-tests"
 	rm -rf "$pkgdir"
 	mkdir -p "$pkgdir"
 	cp "$srcdir/$1" "$pkgdir/Makefile"
@@ -47,6 +50,12 @@ setup_package() {
 	wrkdir=`package_make show-var VARNAME=WRKDIR`
 }
 
+clean_up() {
+	if [ "${category-}" ]; then
+		rm -rf "$pkgsrcdir/$category"
+	fi
+}
+
 # The standard test repository contains these commits:
 # - at 2017-01-01TZ, the file "today" contains "2017-01-01".
 #   - this commit is tagged v2017.


Home | Main Index | Thread Index | Old Index