Description: Recalculate the number of free hugepages before using it
has a parameter in run_tests.sh. The number may change due to the
sharing tests or other things running in the system. This is to work
around both cases.

Signed-off-by: Nishanth Aravamudan <[EMAIL PROTECTED]>

diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 7231f9f..2647100 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -9,8 +9,6 @@ ENV=/usr/bin/env
 
 TOTAL_HPAGES=$(grep 'HugePages_Total:' /proc/meminfo | cut -f2 -d:)
 [ -z "$TOTAL_HPAGES" ] && TOTAL_HPAGES=0
-FREE_HPAGES=$(grep 'HugePages_Free:' /proc/meminfo | cut -f2 -d:)
-[ -z "$FREE_HPAGES" ] && FREE_HPAGES=0
 HPAGE_SIZE=$(grep 'Hugepagesize:' /proc/meminfo | awk '{print $2}')
 [ -z "$HPAGE_SIZE" ] && HPAGE_SIZE=0
 HPAGE_SIZE=$(( $HPAGE_SIZE * 1024 ))
@@ -104,6 +102,8 @@ functional_tests () {
     run_test truncate
     run_test shared
     run_test mprotect
+    FREE_HPAGES=$(grep 'HugePages_Free:' /proc/meminfo | cut -f2 -d:)
+    [ -z "$FREE_HPAGES" ] && FREE_HPAGES=0
     run_test mlock $FREE_HPAGES
 
 # Specific kernel bug tests
@@ -142,11 +142,15 @@ functional_tests () {
     FREE_HPAGES=$(grep 'HugePages_Free:' /proc/meminfo | cut -f2 -d:)
     [ -z "$FREE_HPAGES" ] && FREE_HPAGES=0
     run_test chunk-overcommit $FREE_HPAGES
+    FREE_HPAGES=$(grep 'HugePages_Free:' /proc/meminfo | cut -f2 -d:)
+    [ -z "$FREE_HPAGES" ] && FREE_HPAGES=0
     run_test alloc-instantiate-race $FREE_HPAGES
 }
 
 stress_tests () {
     ITERATIONS=10           # Number of iterations for looping tests
+    FREE_HPAGES=$(grep 'HugePages_Free:' /proc/meminfo | cut -f2 -d:)
+    [ -z "$FREE_HPAGES" ] && FREE_HPAGES=0
     NRPAGES=$FREE_HPAGES
 
     run_test mmap-gettest ${ITERATIONS} ${NRPAGES}

-- 
Nishanth Aravamudan <[EMAIL PROTECTED]>
IBM Linux Technology Center

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to