Add disk usage monitoring to tests. This triggers a WARN if, during
the running of a test the rate of disk space usage on / exceeds a
fixed threshold.
The monitoring defaults to off, but you can turn it on for
subsequent tests by calling job.monitor_disk_usage.
Signed-off-by: John Admanski <[email protected]>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@1487 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/bin/autotest_utils.py b/client/bin/autotest_utils.py
index 89139c0..8b2df8d 100755
--- a/client/bin/autotest_utils.py
+++ b/client/bin/autotest_utils.py
@@ -533,9 +533,14 @@
def freespace(path):
- # Find free space available in bytes
+ """Return the disk free space, in bytes"""
s = os.statvfs(path)
- return s[statvfs.F_BAVAIL] * long(s[statvfs.F_BSIZE])
+ return s.f_bavail * s.f_bsize
+
+
+def disk_block_size(path):
+ """Return the disk block size, in bytes"""
+ return os.statvfs(path).f_bsize
def get_cpu_family():