diff options
Diffstat (limited to 'tests/basic/posix')
| -rw-r--r-- | tests/basic/posix/shared-statfs.t | 11 | ||||
| -rw-r--r-- | tests/basic/posix/zero-fill-enospace.c | 7 |
2 files changed, 11 insertions, 7 deletions
diff --git a/tests/basic/posix/shared-statfs.t b/tests/basic/posix/shared-statfs.t index 33439562ec9..0e4a1bb409f 100644 --- a/tests/basic/posix/shared-statfs.t +++ b/tests/basic/posix/shared-statfs.t @@ -20,15 +20,18 @@ TEST mkdir -p $B0/${V0}1 $B0/${V0}2 TEST MOUNT_LOOP $LO1 $B0/${V0}1 TEST MOUNT_LOOP $LO2 $B0/${V0}2 +total_brick_blocks=$(df -P $B0/${V0}1 $B0/${V0}2 | tail -2 | awk '{sum = sum+$2}END{print sum}') +#Account for rounding error +brick_blocks_two_percent_less=$((total_brick_blocks*98/100)) # Create a subdir in mountpoint and use that for volume. TEST $CLI volume create $V0 $H0:$B0/${V0}1/1 $H0:$B0/${V0}2/1; TEST $CLI volume start $V0 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" online_brick_count TEST $GFS --volfile-server=$H0 --volfile-id=$V0 $M0 -total_space=$(df -P $M0 | tail -1 | awk '{ print $2}') +total_mount_blocks=$(df -P $M0 | tail -1 | awk '{ print $2}') # Keeping the size less than 200M mainly because XFS will use # some storage in brick to keep its own metadata. -TEST [ $total_space -gt 194000 -a $total_space -lt 200000 ] +TEST [ $total_mount_blocks -gt $brick_blocks_two_percent_less -a $total_mount_blocks -lt 200000 ] TEST force_umount $M0 @@ -41,8 +44,8 @@ TEST $CLI volume add-brick $V0 $H0:$B0/${V0}1/2 $H0:$B0/${V0}2/2 $H0:$B0/${V0}1/ TEST $CLI volume start $V0 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "6" online_brick_count TEST $GFS --volfile-server=$H0 --volfile-id=$V0 $M0 -total_space=$(df -P $M0 | tail -1 | awk '{ print $2}') -TEST [ $total_space -gt 194000 -a $total_space -lt 200000 ] +total_mount_blocks=$(df -P $M0 | tail -1 | awk '{ print $2}') +TEST [ $total_mount_blocks -gt $brick_blocks_two_percent_less -a $total_mount_blocks -lt 200000 ] TEST force_umount $M0 TEST $CLI volume stop $V0 diff --git a/tests/basic/posix/zero-fill-enospace.c b/tests/basic/posix/zero-fill-enospace.c index 1371ff59a5f..b1f142c6be9 100644 --- a/tests/basic/posix/zero-fill-enospace.c +++ b/tests/basic/posix/zero-fill-enospace.c @@ -1,4 +1,5 @@ #include <stdio.h> +#include <stdlib.h> #include <glusterfs/api/glfs.h> #include <glusterfs/api/glfs-handles.h> @@ -8,7 +9,7 @@ main(int argc, char *argv[]) glfs_t *fs = NULL; glfs_fd_t *fd = NULL; int ret = 1; - int size = 0; + off_t size = 0; if (argc != 6) { fprintf(stderr, @@ -45,12 +46,12 @@ main(int argc, char *argv[]) goto out; } - size = atoi(argv[5]); + size = strtol(argv[5], NULL, 10); if (size < 0) { fprintf(stderr, "Wrong size %s", argv[5]); goto out; } - ret = glfs_zerofill(fd, 0, atoi(argv[5])); + ret = glfs_zerofill(fd, 0, size); if (ret <= 0) { fprintf(stderr, "glfs_zerofill: returned %d\n", ret); goto out; |
