Subject: testfs.sh patch
From: Ghislain Adnet <gadnet@aqueos.com>
Date: Thu, 16 Nov 2017 10:28:51 +0100

hi,

I got some red alerts on testfs. I setup the thing like in

http://linux-vserver.org/Test_Scripts


and run

bash ./testfs.sh -t -D /dev/loop0 -M /mnt/  -v -x -y -z -F ext4
Linux-VServer FS Test [V0.23] Copyright (C) 2005-2009 H.Poetzl
Linux 4.1.46-vs2.3.8.6aq x86_64/0.30.216
VCI:  0002:0308 236 13113f11 (ID24)
---
testing ext4 filesystem ...
mke2fs 1.42.12 (29-Aug-2014)
[000]. [001]. [002]. (ext4 format)
tag related tests ...
[011]. [012]. [014]. [015]. [019].
[020]. [021]. [022]. [023]. [024]. [025]. [026]. [027]. [028].
[033]. [034]. [035]. [037]. [045]. [047].
xattr related tests ...
[101]. [103]. [104]. [106]. [107]. [109].
[112]. [113]. [114]. [115]. [116]. [118]. [119].
[122]. [123]. [124]. [125]. [127]. [128]. [129].
[131]. [132]. [133]. [134]. [135]. [138]. [139].
[148]. [149].
disk limit related tests ...
[201]. [202]. [203]* [204]. [205]* [206]. [207]. [208]*
[211]. [212]. [213]* [222]. [223]* [231]* [232]. [233]* [239].
[999].

so in

disk limit related tests ...
 [203]* . [205]* [208]*
 [213]*  [223]* [231]*  [233]*

are red.


        eexec 203       0 "do_dlimit_verify $MNT $tags"
        eexec 205       0 "do_dlimit_verify $MNT $tags"
        eexec 208       0 "do_dlimit_verify $MNT $tags"
        eexec 213       0 "do_dlimit_verify $MNT $tags"
        eexec 223       0 "do_dlimit_verify $MNT $tags"
        eexec 231       0 "do_dlimit_verify $MNT $tags"
        eexec 233       0 "do_dlimit_verify $MNT $tags"

the issue is that df is expected to give a number but is given xxxK with the K at then
end. with this patch:

--- testfs.sh   2009-11-30 19:46:52.000000000 +0100
+++ testfs-ok.sh        2017-11-16 10:24:16.794163841 +0100
@@ -279,9 +279,9 @@
     local space_used=0
     local inodes_used=0

-    _DLIMIT_DF_SPACE=`df "$path" |
+    _DLIMIT_DF_SPACE=`df -k "$path" |
        awk '$3 ~ /^[0-9]+$/ { if (NF == 5) { print $2 } else { print $3 } }'`
-    _DLIMIT_DF_INODE=`df -i "$path" |
+    _DLIMIT_DF_INODE=`df -k -i "$path" |
        awk '$3 ~ /^[0-9]+$/ { if (NF == 5) { print $2 } else { print $3 } }'`
     eval `vdlimit --xid "$xid" "$path" | grep _used=`

@@ -300,9 +300,9 @@
     local df_space=0
     local df_inode=0

-    df_space=`df "$path" |
+    df_space=`df -k "$path" |
        awk '$3 ~ /^[0-9]+$/ { if (NF == 5) { print $2 } else { print $3 } }'`
-    df_inode=`df -i "$path" |
+    df_inode=`df -k -i "$path" |
        awk '$3 ~ /^[0-9]+$/ { if (NF == 5) { print $2 } else { print $3 } }'`
     eval `vdlimit --xid "$xid" "$path" | grep _used=` || ret=1



it works well. I just added -k to force the unit


best regards,
Ghislain.