Revert "fstests: Don't use gawk's strtonum"
authorEryu Guan <guaneryu@gmail.com>
Sun, 15 Dec 2019 16:10:55 +0000 (00:10 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 15 Dec 2019 16:10:55 +0000 (00:10 +0800)
This reverts commit 37520a314bd472ed720ed0611c6b69e418be9b61.

This commit has been reported to regress, at least, xfs/139 and
btrfs/09[58]. Let's revert it for now.

Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/filter
tests/generic/386
tests/xfs/009

index 6140e58368d74c3e3e116cb9f3a58fe8edede350..2477f3860151cc3bcbc7d0247109699514b5b068 100644 (file)
@@ -241,9 +241,9 @@ _filter_xfs_io_units_modified()
                /wrote/ {
                        split($2, bytes, "/")
 
-                       bytes_written = bytes[1]
+                       bytes_written = strtonum(bytes[1])
 
-                       offset = $NF
+                       offset = strtonum($NF)
 
                        unit_start = offset / unit_size
                        unit_start = int(unit_start)
@@ -487,16 +487,14 @@ _filter_busy_mount()
 _filter_od()
 {
        BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT)
-       while read line; do
-               if test "$line" = '*'
-               then
-                       printf '*\n'
-                       continue
-               fi
-
-               offset="${line%% *}"
-               printf '%o%s\n' $((offset / BLOCK_SIZE)) "${line#$offset}"
-       done
+       $AWK_PROG -v block_size=$BLOCK_SIZE '
+               /^[0-9]+/ {
+                       offset = strtonum("0"$1);
+                       $1 = sprintf("%o", offset / block_size);
+                       print $0;
+               }
+               /\*/
+       '
 }
 
 # Remove quotes from failed mknod calls. Starting with Coreutils v8.25,
index e513a42398e28edfe858bd4be567745750ad4e22..0c44c80e22c2ac0203bc3930542c1cb6e7647d65 100755 (executable)
@@ -75,7 +75,7 @@ _filter_quota_rpt() {
        # This function parses the human-readable values produced
        # by xfs_quota output
        function byte_size(value,  result) {
-               result = value;
+               result = strtonum(value);
                unit = value;
                gsub("[0-9][0-9]*", "", unit);
                shift = index("KMGTPE", unit);
index 956c47729f4709dc18936daa7dfd2d20e25ad018..6a31514cc0d7fcefe70cabf082e00b49f28421ec 100755 (executable)
@@ -66,12 +66,12 @@ _block_filter()
 
        /CMD/ {
                split($3, off, "=")
-               offset = off[2]
+               offset = strtonum(off[2])
                if (offset != -1)
                        offset = offset / bsize
 
                split($4, len, "=")
-               nr_blocks = len[2]
+               nr_blocks = strtonum(len[2])
                if (nr_blocks != -1)
                        nr_blocks = nr_blocks / bsize
 
@@ -82,13 +82,13 @@ _block_filter()
 
        /MAP/ {
                split($2, off, "=")
-               offset = off[2]
+               offset = strtonum(off[2])
                if (offset != -1)
                        offset = offset / bsize
 
                split($3, len, "=")
 
-               nr_blocks = len[2]
+               nr_blocks = strtonum(len[2])
 
                if (nr_blocks != -1)
                        nr_blocks = nr_blocks / bsize
@@ -100,7 +100,7 @@ _block_filter()
 
        /TRUNCATE/ {
                split($2, off, "=")
-               offset = off[2] / bsize
+               offset = strtonum(off[2]) / bsize
 
                printf("    %s off=%s\n", $1, offset)