Skip to contentSkip to conversation

master - tests: watch out for RAM size

PATCH Zdenek Kabelac 1 participant 1 message May 1, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f48a4c391c2f7f92765f6608a60e79b008ead890
Commit:        f48a4c391c2f7f92765f6608a60e79b008ead890
Parent:        11e0dc40dcae9021bb52d60403fd1a3b8b40c58c
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Thu Apr 30 11:55:38 2015 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Fri May 1 15:07:58 2015 +0200

tests: watch out for RAM size

Reduce mem-requirements on low memory boxes,
activate less volumes if machine is below 0.5G.

Also print mem size at test header.

---
 test/lib/aux.sh             |    7 +++++++
 test/lib/inittest.sh        |    1 +
 test/shell/vgchange-many.sh |    2 ++
 3 files changed, 10 insertions(+), 0 deletions(-)
test/lib/aux.sh +7 -0
index 67df0f5..6fceb68 100644
@@ -1066,6 +1066,13 @@ wait_pvmove_lv_ready() {
 	done
 }
 
+# return total memory size in kB units
+total_mem() {
+	while IFS=":" read -r a b ; do
+		case "$a" in MemTotal*) echo ${b%% kB} ; break ;; esac
+	done < /proc/meminfo
+}
+
 test -z "$LVM_TEST_AUX_TRACE" || set -x
 
 test -f DEVICES && devs=$(< DEVICES)
test/lib/inittest.sh +1 -0
index 96dfff2..dd4f060 100644
@@ -78,6 +78,7 @@ echo "$TESTNAME" >TESTNAME
 echo "Kernel is $(uname -a)"
 # Report SELinux mode
 echo "Selinux mode is $(getenforce 2>/dev/null || echo not installed)."
+free -h
 
 # Set vars from utils now that we have TESTDIR/PREFIX/...
 prepare_test_vars
test/shell/vgchange-many.sh +2 -0
index 16e0516..cbb4363 100644
@@ -16,6 +16,8 @@
 
 # Number of LVs to create
 DEVICES=1000
+# On low-memory boxes let's not stress too much
+test "$(aux total_mem)" -gt 524288 || DEVICES=256
 
 aux prepare_pvs 1 400