public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in sys-libs/libhugetlbfs: ChangeLog libhugetlbfs-2.6.ebuild
@ 2009-10-31  7:59 Robin H. Johnson (robbat2)
  0 siblings, 0 replies; 2+ messages in thread
From: Robin H. Johnson (robbat2) @ 2009-10-31  7:59 UTC (permalink / raw
  To: gentoo-commits

robbat2     09/10/31 07:59:56

  Modified:             ChangeLog
  Added:                libhugetlbfs-2.6.ebuild
  Log:
  Version bump so it can be used for new memcached fun. src_test needs some work still.
  (Portage version: 2.2_rc46/cvs/Linux x86_64)

Revision  Changes    Path
1.3                  sys-libs/libhugetlbfs/ChangeLog

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/libhugetlbfs/ChangeLog?rev=1.3&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/libhugetlbfs/ChangeLog?rev=1.3&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/libhugetlbfs/ChangeLog?r1=1.2&r2=1.3

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/sys-libs/libhugetlbfs/ChangeLog,v
retrieving revision 1.2
retrieving revision 1.3
diff -p -w -b -B -u -u -r1.2 -r1.3
--- ChangeLog	5 Feb 2008 21:39:00 -0000	1.2
+++ ChangeLog	31 Oct 2009 07:59:56 -0000	1.3
@@ -1,6 +1,13 @@
 # ChangeLog for sys-libs/libhugetlbfs
-# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-libs/libhugetlbfs/ChangeLog,v 1.2 2008/02/05 21:39:00 tgall Exp $
+# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/libhugetlbfs/ChangeLog,v 1.3 2009/10/31 07:59:56 robbat2 Exp $
+
+*libhugetlbfs-2.6 (31 Oct 2009)
+
+  31 Oct 2009; Robin H. Johnson <robbat2@gentoo.org>
+  +libhugetlbfs-2.6.ebuild, +files/libhugetlbfs-2.6-noexec-stack.patch:
+  Version bump so it can be used for new memcached fun. src_test needs some
+  work still.
 
 *libhugetlbfs-1.2 (5 Feb 2008)
 



1.1                  sys-libs/libhugetlbfs/libhugetlbfs-2.6.ebuild

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/libhugetlbfs/libhugetlbfs-2.6.ebuild?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/libhugetlbfs/libhugetlbfs-2.6.ebuild?rev=1.1&content-type=text/plain

Index: libhugetlbfs-2.6.ebuild
===================================================================
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-libs/libhugetlbfs/libhugetlbfs-2.6.ebuild,v 1.1 2009/10/31 07:59:56 robbat2 Exp $

EAPI=2
inherit eutils multilib toolchain-funcs

DESCRIPTION="easy hugepage access"
HOMEPAGE="http://libhugetlbfs.ozlabs.org/"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc64 ~x86"
IUSE=""

DEPEND=""

# testsuite requires specific kernel options, and LOTS of free memory.
# with 16GiB of RAM available, I hit swap :-) - robbat2
RESTRICT=test

src_prepare() {
	epatch "${FILESDIR}"/${PN}-2.6-noexec-stack.patch
	sed -i \
		-e '/^PREFIX/s:/local::' \
		-e '1iBUILDTYPE = NATIVEONLY' \
		-e '1iV = 1' \
		-e "/^LIB\(32\)/s:=.*:= $(get_libdir):" \
		-e '/^CC\(32\|64\)/s:=.*:= $(CC):' \
		Makefile
	if [ "$(get_libdir)" == "lib64" ]; then
		sed -i \
			-e "/^LIB\(32\)/s:=.*:= lib32:" \
				Makefile
	fi
}

src_configure() {
	:
}

src_compile() {
	tc-export AR CC
	emake libs tools || die
}

src_install() {
	emake install DESTDIR="${D}" || die
	dodoc HOWTO NEWS README
	rm "${D}"/usr/bin/oprofile*
}

src_test() {
	emake tests || die "Failed to build tests"
	hugeadm='obj/hugeadm'
	${hugeadm} --create-mounts
	PAGESIZES="$(${hugeadm} --page-sizes-all)"
	MIN_HUGEPAGE_RAM=$((64*1024*1024))
	ALLOCATED=''
	for p in ${PAGESIZES} ; do
		pagecount=$((${MIN_HUGEPAGE_RAM}/${p}))
		${hugeadm} \
		--pool-pages-min ${p}:+${pagecount} \
		--pool-pages-max ${p}:+${pagecount} \
		&& ALLOCATED="${ALLOCATED} ${p}:${pagecount}" \
		|| die "Failed to set pages"
	done
	cd "${S}"/tests
	TESTOPTS="-t func"
	case $ARCH in
		amd64|ppc64)
			TESTOPTS="${TESTOPTS} -b 64"
			;;
		x86)
			TESTOPTS="${TESTOPTS} -b 32"
			;;
	esac
	./run_tests.py ${TESTOPTS}
	# TODO: undo the allocation here.
	for p in ${ALLOCATED} ; do
		:
	done
}








^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gentoo-commits] gentoo-x86 commit in sys-libs/libhugetlbfs: ChangeLog libhugetlbfs-2.6.ebuild
@ 2009-11-04  4:08 Robin H. Johnson (robbat2)
  0 siblings, 0 replies; 2+ messages in thread
From: Robin H. Johnson (robbat2) @ 2009-11-04  4:08 UTC (permalink / raw
  To: gentoo-commits

robbat2     09/11/04 04:08:49

  Modified:             ChangeLog libhugetlbfs-2.6.ebuild
  Log:
  Fully wire up the upstream testsuite.
  (Portage version: 2.2_rc48/cvs/Linux x86_64)

Revision  Changes    Path
1.4                  sys-libs/libhugetlbfs/ChangeLog

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/libhugetlbfs/ChangeLog?rev=1.4&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/libhugetlbfs/ChangeLog?rev=1.4&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/libhugetlbfs/ChangeLog?r1=1.3&r2=1.4

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/sys-libs/libhugetlbfs/ChangeLog,v
retrieving revision 1.3
retrieving revision 1.4
diff -p -w -b -B -u -u -r1.3 -r1.4
--- ChangeLog	31 Oct 2009 07:59:56 -0000	1.3
+++ ChangeLog	4 Nov 2009 04:08:48 -0000	1.4
@@ -1,6 +1,10 @@
 # ChangeLog for sys-libs/libhugetlbfs
 # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-libs/libhugetlbfs/ChangeLog,v 1.3 2009/10/31 07:59:56 robbat2 Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/libhugetlbfs/ChangeLog,v 1.4 2009/11/04 04:08:48 robbat2 Exp $
+
+  04 Nov 2009; Robin H. Johnson <robbat2@gentoo.org>
+  libhugetlbfs-2.6.ebuild, +files/libhugetlbfs-2.6-fixup-testsuite.patch:
+  Fully wire up the upstream testsuite.
 
 *libhugetlbfs-2.6 (31 Oct 2009)
 



1.3                  sys-libs/libhugetlbfs/libhugetlbfs-2.6.ebuild

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/libhugetlbfs/libhugetlbfs-2.6.ebuild?rev=1.3&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/libhugetlbfs/libhugetlbfs-2.6.ebuild?rev=1.3&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/libhugetlbfs/libhugetlbfs-2.6.ebuild?r1=1.2&r2=1.3

Index: libhugetlbfs-2.6.ebuild
===================================================================
RCS file: /var/cvsroot/gentoo-x86/sys-libs/libhugetlbfs/libhugetlbfs-2.6.ebuild,v
retrieving revision 1.2
retrieving revision 1.3
diff -p -w -b -B -u -u -r1.2 -r1.3
--- libhugetlbfs-2.6.ebuild	1 Nov 2009 01:24:51 -0000	1.2
+++ libhugetlbfs-2.6.ebuild	4 Nov 2009 04:08:48 -0000	1.3
@@ -1,6 +1,6 @@
 # Copyright 1999-2009 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-libs/libhugetlbfs/libhugetlbfs-2.6.ebuild,v 1.2 2009/11/01 01:24:51 mr_bones_ Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/libhugetlbfs/libhugetlbfs-2.6.ebuild,v 1.3 2009/11/04 04:08:48 robbat2 Exp $
 
 EAPI=2
 inherit eutils multilib toolchain-funcs
@@ -16,12 +16,9 @@ IUSE=""
 
 DEPEND=""
 
-# testsuite requires specific kernel options, and LOTS of free memory.
-# with 16GiB of RAM available, I hit swap :-) - robbat2
-RESTRICT=test
-
 src_prepare() {
 	epatch "${FILESDIR}"/${PN}-2.6-noexec-stack.patch
+	epatch "${FILESDIR}"/${PN}-2.6-fixup-testsuite.patch
 	sed -i \
 		-e '/^PREFIX/s:/local::' \
 		-e '1iBUILDTYPE = NATIVEONLY' \
@@ -51,21 +48,73 @@ src_install() {
 	rm "${D}"/usr/bin/oprofile*
 }
 
+src_test_alloc_one() {
+	hugeadm="$1"
+	sign="$2"
+	pagesize="$3"
+	pagecount="$4"
+	${hugeadm} \
+		--pool-pages-max ${pagesize}:${sign}${pagecount} \
+	&& \
+	${hugeadm} \
+		--pool-pages-min ${pagesize}:${sign}${pagecount}
+	return $?
+}
+
+# die is NOT allowed in this src_test block after the marked point, so that we
+# can clean up memory allocation. You'll leak at LEAST 64MiB per run otherwise.
 src_test() {
-	emake tests || die "Failed to build tests"
+	[[ $UID -eq 0 ]] || die "Need FEATURES=-userpriv to run this testsuite"
+	einfo "Building testsuite"
+	emake -j1 tests || die "Failed to build tests"
+
 	hugeadm='obj/hugeadm'
-	${hugeadm} --create-mounts
-	PAGESIZES="$(${hugeadm} --page-sizes-all)"
+	allocated=''
+	rc=0
+	# the testcases need 64MiB per pagesize.
 	MIN_HUGEPAGE_RAM=$((64*1024*1024))
-	ALLOCATED=''
-	for p in ${PAGESIZES} ; do
-		pagecount=$((${MIN_HUGEPAGE_RAM}/${p}))
-		${hugeadm} \
-		--pool-pages-min ${p}:+${pagecount} \
-		--pool-pages-max ${p}:+${pagecount} \
-		&& ALLOCATED="${ALLOCATED} ${p}:${pagecount}" \
-		|| die "Failed to set pages"
+	
+	einfo "Planning allocation"
+	PAGESIZES="$(${hugeadm} --page-sizes-all)"
+	
+	# Need to do this before we can create the mountpoints.
+	for pagesize in ${PAGESIZES} ; do
+		# The kernel depends on the location :-(
+		mkdir -p /var/lib/hugetlbfs/pagesize-${pagesize}
+		addwrite /var/lib/hugetlbfs/pagesize-${pagesize}
+	done
+	addwrite /proc/sys/vm/
+	addwrite /proc/sys/kernel/shmall
+	addwrite /proc/sys/kernel/shmmax
+	addwrite /proc/sys/kernel/shmmni
+
+	einfo "Checking HugeTLB mountpoints"
+	${hugeadm} --create-mounts || die "Failed to set up hugetlb mountpoints."
+	
+	# -----------------------------------------------------
+	# --------- die is unsafe after this point. -----------
+	# -----------------------------------------------------
+
+	einfo "Starting allocation"
+	for pagesize in ${PAGESIZES} ; do
+		pagecount=$((${MIN_HUGEPAGE_RAM}/${pagesize}))
+		einfo "  ${pagecount} @ ${pagesize}"
+		addwrite /var/lib/hugetlbfs/pagesize-${pagesize}
+		src_test_alloc_one "$hugeadm" "+" "${pagesize}" "${pagecount}"
+		rc=$?
+		if [[ $rc -eq 0 ]]; then
+			allocated="${allocated} ${pagesize}:${pagecount}"
+		else
+			eerror "Failed to add ${pagecount} pages of size ${pagesize}"
+		fi
 	done
+
+	einfo "Allocation status"
+	${hugeadm} --pool-list
+
+	if [[ -n "${allocated}" ]]; then
+		# All our allocations worked, so time to run.
+		einfo "Starting tests"
 	cd "${S}"/tests
 	TESTOPTS="-t func"
 	case $ARCH in
@@ -76,9 +125,27 @@ src_test() {
 			TESTOPTS="${TESTOPTS} -b 32"
 			;;
 	esac
+		# This needs a bit of work to give a nice exit code still.
 	./run_tests.py ${TESTOPTS}
-	# TODO: undo the allocation here.
-	for p in ${ALLOCATED} ; do
-		:
+		rc=$?
+	else
+		eerror "Failed to make HugeTLB allocations."
+		rc=1
+	fi
+
+	einfo "Cleaning up memory"
+	cd "${S}"
+	# Cleanup memory allocation
+	for alloc in ${allocated} ; do
+		pagesize="${alloc/:*}"
+		pagecount="${alloc/*:}"
+		einfo "  ${pagecount} @ ${pagesize}"
+		src_test_alloc_one "$hugeadm" "-" "${pagesize}" "${pagecount}"
 	done
+	
+	# ---------------------------------------------------------
+	# --------- die is safe again after this point. -----------
+	# ---------------------------------------------------------
+
+	return $rc
 }






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-04  4:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-04  4:08 [gentoo-commits] gentoo-x86 commit in sys-libs/libhugetlbfs: ChangeLog libhugetlbfs-2.6.ebuild Robin H. Johnson (robbat2)
  -- strict thread matches above, loose matches on Subject: below --
2009-10-31  7:59 Robin H. Johnson (robbat2)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox