Gentoo Archives: gentoo-commits

From: "Robin H. Johnson (robbat2)" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-libs/libhugetlbfs: ChangeLog libhugetlbfs-2.6.ebuild
Date: Wed, 04 Nov 2009 04:08:52
Message-Id: E1N5XAv-0005gm-4d@stork.gentoo.org
1 robbat2 09/11/04 04:08:49
2
3 Modified: ChangeLog libhugetlbfs-2.6.ebuild
4 Log:
5 Fully wire up the upstream testsuite.
6 (Portage version: 2.2_rc48/cvs/Linux x86_64)
7
8 Revision Changes Path
9 1.4 sys-libs/libhugetlbfs/ChangeLog
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/libhugetlbfs/ChangeLog?rev=1.4&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/libhugetlbfs/ChangeLog?rev=1.4&content-type=text/plain
13 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/libhugetlbfs/ChangeLog?r1=1.3&r2=1.4
14
15 Index: ChangeLog
16 ===================================================================
17 RCS file: /var/cvsroot/gentoo-x86/sys-libs/libhugetlbfs/ChangeLog,v
18 retrieving revision 1.3
19 retrieving revision 1.4
20 diff -p -w -b -B -u -u -r1.3 -r1.4
21 --- ChangeLog 31 Oct 2009 07:59:56 -0000 1.3
22 +++ ChangeLog 4 Nov 2009 04:08:48 -0000 1.4
23 @@ -1,6 +1,10 @@
24 # ChangeLog for sys-libs/libhugetlbfs
25 # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
26 -# $Header: /var/cvsroot/gentoo-x86/sys-libs/libhugetlbfs/ChangeLog,v 1.3 2009/10/31 07:59:56 robbat2 Exp $
27 +# $Header: /var/cvsroot/gentoo-x86/sys-libs/libhugetlbfs/ChangeLog,v 1.4 2009/11/04 04:08:48 robbat2 Exp $
28 +
29 + 04 Nov 2009; Robin H. Johnson <robbat2@g.o>
30 + libhugetlbfs-2.6.ebuild, +files/libhugetlbfs-2.6-fixup-testsuite.patch:
31 + Fully wire up the upstream testsuite.
32
33 *libhugetlbfs-2.6 (31 Oct 2009)
34
35
36
37
38 1.3 sys-libs/libhugetlbfs/libhugetlbfs-2.6.ebuild
39
40 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/libhugetlbfs/libhugetlbfs-2.6.ebuild?rev=1.3&view=markup
41 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/libhugetlbfs/libhugetlbfs-2.6.ebuild?rev=1.3&content-type=text/plain
42 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-libs/libhugetlbfs/libhugetlbfs-2.6.ebuild?r1=1.2&r2=1.3
43
44 Index: libhugetlbfs-2.6.ebuild
45 ===================================================================
46 RCS file: /var/cvsroot/gentoo-x86/sys-libs/libhugetlbfs/libhugetlbfs-2.6.ebuild,v
47 retrieving revision 1.2
48 retrieving revision 1.3
49 diff -p -w -b -B -u -u -r1.2 -r1.3
50 --- libhugetlbfs-2.6.ebuild 1 Nov 2009 01:24:51 -0000 1.2
51 +++ libhugetlbfs-2.6.ebuild 4 Nov 2009 04:08:48 -0000 1.3
52 @@ -1,6 +1,6 @@
53 # Copyright 1999-2009 Gentoo Foundation
54 # Distributed under the terms of the GNU General Public License v2
55 -# $Header: /var/cvsroot/gentoo-x86/sys-libs/libhugetlbfs/libhugetlbfs-2.6.ebuild,v 1.2 2009/11/01 01:24:51 mr_bones_ Exp $
56 +# $Header: /var/cvsroot/gentoo-x86/sys-libs/libhugetlbfs/libhugetlbfs-2.6.ebuild,v 1.3 2009/11/04 04:08:48 robbat2 Exp $
57
58 EAPI=2
59 inherit eutils multilib toolchain-funcs
60 @@ -16,12 +16,9 @@ IUSE=""
61
62 DEPEND=""
63
64 -# testsuite requires specific kernel options, and LOTS of free memory.
65 -# with 16GiB of RAM available, I hit swap :-) - robbat2
66 -RESTRICT=test
67 -
68 src_prepare() {
69 epatch "${FILESDIR}"/${PN}-2.6-noexec-stack.patch
70 + epatch "${FILESDIR}"/${PN}-2.6-fixup-testsuite.patch
71 sed -i \
72 -e '/^PREFIX/s:/local::' \
73 -e '1iBUILDTYPE = NATIVEONLY' \
74 @@ -51,21 +48,73 @@ src_install() {
75 rm "${D}"/usr/bin/oprofile*
76 }
77
78 +src_test_alloc_one() {
79 + hugeadm="$1"
80 + sign="$2"
81 + pagesize="$3"
82 + pagecount="$4"
83 + ${hugeadm} \
84 + --pool-pages-max ${pagesize}:${sign}${pagecount} \
85 + && \
86 + ${hugeadm} \
87 + --pool-pages-min ${pagesize}:${sign}${pagecount}
88 + return $?
89 +}
90 +
91 +# die is NOT allowed in this src_test block after the marked point, so that we
92 +# can clean up memory allocation. You'll leak at LEAST 64MiB per run otherwise.
93 src_test() {
94 - emake tests || die "Failed to build tests"
95 + [[ $UID -eq 0 ]] || die "Need FEATURES=-userpriv to run this testsuite"
96 + einfo "Building testsuite"
97 + emake -j1 tests || die "Failed to build tests"
98 +
99 hugeadm='obj/hugeadm'
100 - ${hugeadm} --create-mounts
101 - PAGESIZES="$(${hugeadm} --page-sizes-all)"
102 + allocated=''
103 + rc=0
104 + # the testcases need 64MiB per pagesize.
105 MIN_HUGEPAGE_RAM=$((64*1024*1024))
106 - ALLOCATED=''
107 - for p in ${PAGESIZES} ; do
108 - pagecount=$((${MIN_HUGEPAGE_RAM}/${p}))
109 - ${hugeadm} \
110 - --pool-pages-min ${p}:+${pagecount} \
111 - --pool-pages-max ${p}:+${pagecount} \
112 - && ALLOCATED="${ALLOCATED} ${p}:${pagecount}" \
113 - || die "Failed to set pages"
114 +
115 + einfo "Planning allocation"
116 + PAGESIZES="$(${hugeadm} --page-sizes-all)"
117 +
118 + # Need to do this before we can create the mountpoints.
119 + for pagesize in ${PAGESIZES} ; do
120 + # The kernel depends on the location :-(
121 + mkdir -p /var/lib/hugetlbfs/pagesize-${pagesize}
122 + addwrite /var/lib/hugetlbfs/pagesize-${pagesize}
123 + done
124 + addwrite /proc/sys/vm/
125 + addwrite /proc/sys/kernel/shmall
126 + addwrite /proc/sys/kernel/shmmax
127 + addwrite /proc/sys/kernel/shmmni
128 +
129 + einfo "Checking HugeTLB mountpoints"
130 + ${hugeadm} --create-mounts || die "Failed to set up hugetlb mountpoints."
131 +
132 + # -----------------------------------------------------
133 + # --------- die is unsafe after this point. -----------
134 + # -----------------------------------------------------
135 +
136 + einfo "Starting allocation"
137 + for pagesize in ${PAGESIZES} ; do
138 + pagecount=$((${MIN_HUGEPAGE_RAM}/${pagesize}))
139 + einfo " ${pagecount} @ ${pagesize}"
140 + addwrite /var/lib/hugetlbfs/pagesize-${pagesize}
141 + src_test_alloc_one "$hugeadm" "+" "${pagesize}" "${pagecount}"
142 + rc=$?
143 + if [[ $rc -eq 0 ]]; then
144 + allocated="${allocated} ${pagesize}:${pagecount}"
145 + else
146 + eerror "Failed to add ${pagecount} pages of size ${pagesize}"
147 + fi
148 done
149 +
150 + einfo "Allocation status"
151 + ${hugeadm} --pool-list
152 +
153 + if [[ -n "${allocated}" ]]; then
154 + # All our allocations worked, so time to run.
155 + einfo "Starting tests"
156 cd "${S}"/tests
157 TESTOPTS="-t func"
158 case $ARCH in
159 @@ -76,9 +125,27 @@ src_test() {
160 TESTOPTS="${TESTOPTS} -b 32"
161 ;;
162 esac
163 + # This needs a bit of work to give a nice exit code still.
164 ./run_tests.py ${TESTOPTS}
165 - # TODO: undo the allocation here.
166 - for p in ${ALLOCATED} ; do
167 - :
168 + rc=$?
169 + else
170 + eerror "Failed to make HugeTLB allocations."
171 + rc=1
172 + fi
173 +
174 + einfo "Cleaning up memory"
175 + cd "${S}"
176 + # Cleanup memory allocation
177 + for alloc in ${allocated} ; do
178 + pagesize="${alloc/:*}"
179 + pagecount="${alloc/*:}"
180 + einfo " ${pagecount} @ ${pagesize}"
181 + src_test_alloc_one "$hugeadm" "-" "${pagesize}" "${pagecount}"
182 done
183 +
184 + # ---------------------------------------------------------
185 + # --------- die is safe again after this point. -----------
186 + # ---------------------------------------------------------
187 +
188 + return $rc
189 }