It is now possible for 32 and 64 bit applications to require different mount
points. For example: powerpc 16G pages can only be used by 64 bit apps. To
handle this case, check for mount points in both a 32 and 64 bit context. Only
run tests for a word size with a valid mount point.
When cleaning up elflink share files, remove files from all detected mount
points.
Signed-off-by: Adam Litke <[EMAIL PROTECTED]>
---
tests/run_tests.sh | 44 ++++++++++++++++++++++++++++++++++++--------
1 files changed, 36 insertions(+), 8 deletions(-)
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index cab719f..fe2b26c 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -4,6 +4,7 @@ export QUIET_TEST=1
export HUGETLB_VERBOSE=2
unset HUGETLB_ELF
unset HUGETLB_MORECORE
+HUGETLBFS_MOUNTS=""
ENV=/usr/bin/env
@@ -13,16 +14,43 @@ function free_hpages() {
echo "$H"
}
-function get_and_set_hugetlbfs_path() {
- HUGETLB_PATH=$(PATH="obj32:obj64:$PATH"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:../obj32:../obj64" get_hugetlbfs_path)
- if [ $? != 0 ]; then
- echo "run_tests.sh: unable to find hugetlbfs mountpoint"
- exit 1
- fi
+# Check for valid hugetlbfs mountpoints
+# On error, adjust tests to be run or exit immediately. We must check for
+# mounts using both the 32 bit and 64 bit helpers because it is possible that
+# a mount point will only be usable with a certain word size. For example, a
+# mount with a 16GB configured page size is usable by 64 bit programs only.
+function check_hugetlbfs_path() {
+ newbits=""
+ skipbits=""
+
+ for b in $WORDSIZES; do
+ MP=$(PATH="obj$b:$PATH" LD_LIBRARY_PATH="$LD_LIBRARY_PATH:../obj$b" \
+ get_hugetlbfs_path)
+ if [ $? -ne 0 ]; then
+ skipbits="$skipbits $b"
+ else
+ HUGETLBFS_MOUNTS="$HUGETLBFS_MOUNTS $MP"
+ newbits="$newbits $b"
+ fi
+ done
+
+ if [ -z "$newbits" ]; then
+ echo "run_tests.sh: unable to find hugetlbfs mountpoint"
+ exit 1
+ fi
+ for b in $skipbits; do
+ echo -n "run_tests.sh: No suitable mountpoint exists for $b bit "
+ echo "programs. Disabling the $b word size."
+ done
+ WORDSIZES="$newbits"
}
function clear_hpages() {
- rm -rf "$HUGETLB_PATH"/elflink-uid-`id -u`
+ # It is not straightforward to know which mountpoint was used so clean
+ # up share files in all possible mount points
+ for dir in $HUGETLBFS_MOUNTS; do
+ rm -rf "$dir"/elflink-uid-`id -u`
+ done
}
TOTAL_HPAGES=$(grep 'HugePages_Total:' /proc/meminfo | cut -f2 -d:)
@@ -276,7 +304,7 @@ if [ -z "$WORDSIZES" ]; then
WORDSIZES="32 64"
fi
-get_and_set_hugetlbfs_path
+check_hugetlbfs_path
for set in $TESTSETS; do
case $set in
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libhugetlbfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel