3
. $(dirname $0)/../include.rc
4
. $(dirname $0)/../volume.rc
12
echo "Skip test: copy_file_range(2) is specific to Linux" >&2
22
# Just a single brick volume. More test cases need to be
23
# added in future for distribute, replicate,
24
# distributed replicate and distributed replicated sharded
26
TEST $CLI volume create $V0 $H0:$B0/bricks/brick1;
27
TEST ${CLI} volume set ${V0} open-behind off
28
TEST ${CLI} volume set ${V0} write-behind off
29
TEST ${CLI} volume set ${V0} stat-prefetch off
30
EXPECT 'Created' volinfo_field $V0 'Status';
32
TEST $CLI volume start $V0;
33
EXPECT 'Started' volinfo_field $V0 'Status';
35
TEST glusterfs --fuse-handle-copy_file_range --volfile-id=/$V0 --volfile-server=$H0 $M0
37
TEST dd if=/dev/urandom of=$M0/file bs=1M count=1;
39
# check for the existence of the created file
42
# grab the size of the file
43
SRC_SIZE=$(stat -c %s $M0/file);
45
logdir=`gluster --print-logdir`
49
TEST build_tester ${tester}.c
51
$tester $M0/file $M0/new
53
if [[ ${res} -eq 2 ]]; then
54
echo "Skip test: copy_file_range(2) is not supported by current kernel" >&2
59
TEST [[ ${res} -eq 0 ]]
61
# check whether the destination file is created or not
64
# check the size of the destination file
65
# XXX size will be 0, which can be worked around with some sleep
67
DST_SIZE=$(stat -c %s $M0/new);
69
# The sizes of the source and destination should be same.
70
# Atleast it ensures that, copy_file_range API is working
71
# as expected. Whether the actual cloning happened via reflink
72
# or a read/write happened is different matter.
73
TEST [ $SRC_SIZE == $DST_SIZE ];
75
# Go again (test case with already existing target)
77
TEST ${tester} $M0/file $M0/new
81
TEST $CLI volume stop $V0
82
TEST $CLI volume delete $V0