glusterfs

Форк
0
/
features_copy-file-range.t 
84 строки · 1.9 Кб
1
#!/bin/bash
2

3
. $(dirname $0)/../include.rc
4
. $(dirname $0)/../volume.rc
5

6
cleanup;
7

8
case $OSTYPE in
9
Linux)
10
        ;;
11
*)
12
        echo "Skip test: copy_file_range(2) is specific to Linux" >&2
13
        SKIP_TESTS
14
        exit 0
15
        ;;
16
esac
17

18
TEST glusterd
19

20
TEST mkdir $B0/bricks
21

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
25
# volumes.
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';
31

32
TEST $CLI volume start $V0;
33
EXPECT 'Started' volinfo_field $V0 'Status';
34

35
TEST glusterfs --fuse-handle-copy_file_range --volfile-id=/$V0 --volfile-server=$H0 $M0
36

37
TEST dd if=/dev/urandom of=$M0/file bs=1M count=1;
38

39
# check for the existence of the created file
40
TEST stat  $M0/file;
41

42
# grab the size of the file
43
SRC_SIZE=$(stat -c %s $M0/file);
44

45
logdir=`gluster --print-logdir`
46

47
tester=${0%.t}
48

49
TEST build_tester ${tester}.c
50

51
$tester $M0/file $M0/new
52
res="${?}"
53
if [[ ${res} -eq 2 ]]; then
54
    echo "Skip test: copy_file_range(2) is not supported by current kernel" >&2
55
    SKIP_TESTS
56
    exit 0
57
fi
58

59
TEST [[ ${res} -eq 0 ]]
60

61
# check whether the destination file is created or not
62
TEST stat $M0/new
63

64
# check the size of the destination file
65
# XXX size will be 0, which can be worked around with some sleep
66
# TEST sleep 2
67
DST_SIZE=$(stat -c %s $M0/new);
68

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 ];
74

75
# Go again (test case with already existing target)
76
# XXX this will fail
77
TEST ${tester} $M0/file $M0/new
78

79
cleanup_tester $tester
80

81
TEST $CLI volume stop $V0
82
TEST $CLI volume delete $V0
83

84
cleanup;
85

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.