Skip to contentSkip to conversation

master - tests: check for free space in test dir

PATCH Zdenek Kabelac 1 participant 1 message Sep 20, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2fd2b197ab5962bc0a1e7eb25bba120d7501032f
Commit:        2fd2b197ab5962bc0a1e7eb25bba120d7501032f
Parent:        a02db1c45ab571d0c614d269a713b56cd47c2e1e
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Mon Sep 11 14:33:07 2017 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Sep 20 15:14:16 2017 +0200

tests: check for free space in test dir

Avoid starting test, when test dir has less then 50M of free space. Better to crash early before letting die machine on weird crash in OOM cases...

Also show free disk space when test starts

---
 test/lib/inittest.sh |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
test/lib/inittest.sh +6 -0
index d5ca6fd..7b0bc13 100644
@@ -124,11 +124,17 @@ fi
 
 echo "$TESTNAME" >TESTNAME
 
+# Require 50M of free space in testdir
+test $(df -k . | awk '/\// {print $4}') -gt 51200  ||
+	die "Testing requires more then 50M of free space in directory $TESTDIR!\n$(df -H)"
+
 echo "Kernel is $(uname -a)"
 # Report SELinux mode
 echo "Selinux mode is $(getenforce 2>/dev/null || echo not installed)."
 free -m || true
 
+df -h || true
+
 # Set vars from utils now that we have TESTDIR/PREFIX/...
 prepare_test_vars