summaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
authorEmmanuel Dreyfus <manu@netbsd.org>2014-08-07 17:01:18 +0200
committerHarshavardhana <harsha@harshavardhana.net>2014-08-18 01:09:39 -0700
commitba0f31b2a5c8bd35f99b1ba2a74c81a2c2ded200 (patch)
tree572eb19fb9cba596469fc529556c4708d1e0788c /tests/bugs
parentc80b5b915a6bf2c6506d789f8ab6f0dcbf3dc617 (diff)
Regression test portability: stat
Linux uses stat -c, stat --printf= or stat --printf NetBSD uses stat -f with different format strings. This change set changes all stat usage to stat -c and introduce a shell stat() fonction to perform the format string translation. BUG: 764655 Change-Id: I024fca7c1b736b053f5888cbf21da0a72489ef63 Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.org/8424 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Harshavardhana <harsha@harshavardhana.net> Tested-by: Harshavardhana <harsha@harshavardhana.net>
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/bug-1122443.t6
-rw-r--r--tests/bugs/bug-862967.t4
-rwxr-xr-xtests/bugs/bug-884597.t16
-rw-r--r--tests/bugs/bug-949242.t10
-rw-r--r--tests/bugs/bug-963678.t6
5 files changed, 21 insertions, 21 deletions
diff --git a/tests/bugs/bug-1122443.t b/tests/bugs/bug-1122443.t
index 711b70cccca..db9d3a060bf 100644
--- a/tests/bugs/bug-1122443.t
+++ b/tests/bugs/bug-1122443.t
@@ -19,7 +19,7 @@ make_files() {
bug_1113050_workaround() {
# Test if graph change has settled (bug-1113050?)
- test=$(stat --printf "%n:%Y," $1 2>&1)
+ test=$(stat -c "%n:%Y" $1 2>&1 | tr '\n' ',')
if [ $? -eq 0 ] ; then
echo RECONNECTED
else
@@ -41,7 +41,7 @@ TEST glusterfs -s $H0 --volfile-id $V0 $M0
TEST make_files $M0/subdir
# Get mtime before migration
-BEFORE="$(stat --printf "%n:%Y," $M0/subdir/*)"
+BEFORE="$(stat -c %n:%Y $M0/subdir/* | tr '\n' ',')"
# Migrate brick
TEST $CLI volume add-brick $V0 $H0:$B0/${V0}1
@@ -51,7 +51,7 @@ TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}0 commit
# Get mtime after migration
EXPECT_WITHIN 5 RECONNECTED bug_1113050_workaround $M0/subdir/*
-AFTER="$(stat --printf "%n:%Y," $M0/subdir/*)"
+AFTER="$(stat -c %n:%Y $M0/subdir/* | tr '\n' ',')"
# Check if mtime is unchanged
TEST [ "$AFTER" == "$BEFORE" ]
diff --git a/tests/bugs/bug-862967.t b/tests/bugs/bug-862967.t
index bd500b1da9d..30d71185405 100644
--- a/tests/bugs/bug-862967.t
+++ b/tests/bugs/bug-862967.t
@@ -50,8 +50,8 @@ sleep 10;
ls -l $M0/dir;
# check if uid/gid is healed on backend brick which was taken down
-BACKEND_UID=`stat --printf=%u $B0/${V0}1/dir`;
-BACKEND_GID=`stat --printf=%g $B0/${V0}1/dir`;
+BACKEND_UID=`stat -c %u $B0/${V0}1/dir`;
+BACKEND_GID=`stat -c %g $B0/${V0}1/dir`;
EXPECT "0" uid_gid_compare $NEW_UID $NEW_GID $BACKEND_UID $BACKEND_GID
diff --git a/tests/bugs/bug-884597.t b/tests/bugs/bug-884597.t
index a0540b628a0..2d2bb745e52 100755
--- a/tests/bugs/bug-884597.t
+++ b/tests/bugs/bug-884597.t
@@ -61,8 +61,8 @@ get_hashed_brick $i
cached=$?
# check if uid/gid on linkfile is created with correct uid/gid
-BACKEND_UID=`stat --printf=%u $B0/${V0}$cached/$i`;
-BACKEND_GID=`stat --printf=%g $B0/${V0}$cached/$i`;
+BACKEND_UID=`stat -c %u $B0/${V0}$cached/$i`;
+BACKEND_GID=`stat -c %g $B0/${V0}$cached/$i`;
EXPECT "0" uid_gid_compare $NEW_UID $NEW_GID $BACKEND_UID $BACKEND_GID
@@ -79,8 +79,8 @@ TEST glusterfs --attribute-timeout=0 --entry-timeout=0 -s $H0 --volfile-id $V0 $
lookup=`ls -l $M0/$i 2>/dev/null`
# check if uid/gid on linkfile is created with correct uid/gid
-BACKEND_UID=`stat --printf=%u $B0/${V0}$cached/$i`;
-BACKEND_GID=`stat --printf=%g $B0/${V0}$cached/$i`;
+BACKEND_UID=`stat -c %u $B0/${V0}$cached/$i`;
+BACKEND_GID=`stat -c %g $B0/${V0}$cached/$i`;
EXPECT "0" uid_gid_compare $NEW_UID $NEW_GID $BACKEND_UID $BACKEND_GID
# create hardlinks. Make sure a linkfile gets created
@@ -117,8 +117,8 @@ get_hashed_brick link$i
cached=$?
# check if uid/gid on linkfile is created with correct uid/gid
-BACKEND_UID=`stat --printf=%u $B0/${V0}$cached/link$i`;
-BACKEND_GID=`stat --printf=%g $B0/${V0}$cached/link$i`;
+BACKEND_UID=`stat -c %u $B0/${V0}$cached/link$i`;
+BACKEND_GID=`stat -c %g $B0/${V0}$cached/link$i`;
EXPECT "0" uid_gid_compare $NEW_UID $NEW_GID $BACKEND_UID $BACKEND_GID
@@ -166,8 +166,8 @@ get_hashed_brick user_file$i
cached=$?
# check if uid/gid on linkfile is created with correct uid/gid
-BACKEND_UID=`stat --printf=%u $B0/${V0}$cached/user_file$i`;
-BACKEND_GID=`stat --printf=%g $B0/${V0}$cached/user_file$i`;
+BACKEND_UID=`stat -c %u $B0/${V0}$cached/user_file$i`;
+BACKEND_GID=`stat -c %g $B0/${V0}$cached/user_file$i`;
EXPECT "0" uid_gid_compare $NEW_UID $NEW_GID $BACKEND_UID $BACKEND_GID
cleanup;
diff --git a/tests/bugs/bug-949242.t b/tests/bugs/bug-949242.t
index 027c25afd88..c596cf7f25b 100644
--- a/tests/bugs/bug-949242.t
+++ b/tests/bugs/bug-949242.t
@@ -25,8 +25,8 @@ require_fallocate -l 1m -n $M0/file && rm -f $M0/file
# fallocate a file and verify blocks are allocated
TEST fallocate -l 1m $M0/file
-blksz=`stat --printf=%b $M0/file`
-nblks=`stat --printf=%B $M0/file`
+blksz=`stat -c %b $M0/file`
+nblks=`stat -c %B $M0/file`
TEST [ $(($blksz * $nblks)) -eq 1048576 ]
TEST unlink $M0/file
@@ -35,9 +35,9 @@ TEST unlink $M0/file
# change
TEST truncate --size=1m $M0/file
TEST fallocate -l 2m -n $M0/file
-blksz=`stat --printf=%b $M0/file`
-nblks=`stat --printf=%B $M0/file`
-sz=`stat --printf=%s $M0/file`
+blksz=`stat -c %b $M0/file`
+nblks=`stat -c %B $M0/file`
+sz=`stat -c %s $M0/file`
TEST [ $sz -eq 1048576 ]
# Note that gluster currently incorporates a hack to limit the number of blocks
# reported as allocated to the file by the file size. We have allocated beyond the
diff --git a/tests/bugs/bug-963678.t b/tests/bugs/bug-963678.t
index ba3d3ae0549..9431010d60d 100644
--- a/tests/bugs/bug-963678.t
+++ b/tests/bugs/bug-963678.t
@@ -31,12 +31,12 @@ require_fallocate -p -l 512k $M0/file && rm -f $M0/file
# allocate some blocks, punch a hole and verify block allocation
TEST fallocate -l 1m $M0/file
-blksz=`stat --printf=%B $M0/file`
-nblks=`stat --printf=%b $M0/file`
+blksz=`stat -c %B $M0/file`
+nblks=`stat -c %b $M0/file`
TEST [ $(($blksz * $nblks)) -ge 1048576 ]
TEST fallocate -p -o 512k -l 128k $M0/file
-nblks=`stat --printf=%b $M0/file`
+nblks=`stat -c %b $M0/file`
# allow some room for xattr blocks
TEST [ $(($blksz * $nblks)) -lt $((917504 + 16384)) ]
TEST unlink $M0/file