]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfs/262: update filter to deal with long device name correctly
authorEryu Guan <eguan@redhat.com>
Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)
committerDave Chinner <david@fromorbit.com>
Tue, 14 Oct 2014 11:59:38 +0000 (22:59 +1100)
If the device name is too long, the output of xfs_quota -c "df" will be
broke into two lines as

Filesystem           1K-blocks       Used  Available  Use% Pathname
/dev/mapper/rhel_hp--dl388eg8--01-testlv2
                      15718400      32932   15685468    0% /mnt/testarea/scratch
/dev/mapper/rhel_hp--dl388eg8--01-testlv2
                        512000          0     512000    0% /mnt/testarea/scratch/test

and _filter_quota_rpt() couldn't catch the correct available number and
test will fail as

[root@hp-dl388g8-01 xfstests]# diff -u tests/xfs/262.out /root/xfstests/results//xfs/262.out.bad
--- tests/xfs/262.out   2014-10-08 20:16:19.000000000 +0800
+++ /root/xfstests/results//xfs/262.out.bad  2014-10-09 14:29:38.795813323 +0800
@@ -1,2 +1,4 @@
 QA output created by 262
 Silence is golden.
+hard limit 0 bytes, expected 524288000
+hard limit 0 bytes, expected 524288000

Update the filter so it could catch the correct value.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
tests/xfs/262

index 6040f620cd99aa8dcc65851ebbfabfce4332e092..9d8b8389c1d3aaa6eb555e068b60636199c269bf 100755 (executable)
@@ -76,6 +76,8 @@ _require_scratch
 # both the "df" and the "report" output.  For "report", the line we're
 # interested in contains our project name in the first field.  For "df"
 # it contains our project directory in the last field.
+# But if the device name is too long, the "df" output is broke into two
+# lines, the fourth field is not correct, so take $(nf-2) of "df"
 _filter_quota_rpt() {
        awk '
        BEGIN {
@@ -96,9 +98,15 @@ _filter_quota_rpt() {
                return result;
        }
        {
-               if ($1 !~ proj_name && $nf !~ proj_dir)
+               if ($1 =~ proj_name) {
+                       # this is the "report" output
+                       bsize = byte_size($4);
+               } else if ($nf =~ proj_dir) {
+                       # this is the "df" output
+                       bsize = byte_size($(nf-2));
+               } else {
                        next;
-               bsize = byte_size($4);
+               }
                if (bsize != qlimit)
                        printf("hard limit %d bytes, expected %d\n",
                                bsize, qlimit);