glusterfs

Форк
0
/
bug-949242.t 
55 строк · 1.6 Кб
1
#!/bin/bash
2
#
3
# Bug 949242 - Test basic fallocate functionality.
4
#
5
# Run several commands to verify basic fallocate functionality. We verify that
6
# fallocate creates and allocates blocks to a file. We also verify that the keep
7
# size option does not modify the file size.
8
###
9

10
. $(dirname $0)/../../include.rc
11
. $(dirname $0)/../../fallocate.rc
12
. $(dirname $0)/../../volume.rc
13

14
cleanup;
15

16
TEST glusterd
17

18
TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2,3,4}
19
TEST $CLI volume start $V0
20

21
TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0
22

23
# check for fallocate support before continuing the test
24
require_fallocate -l 1m -n $M0/file && rm -f $M0/file
25

26
# fallocate a file and verify blocks are allocated
27
TEST fallocate -l 1m $M0/file
28
blksz=`stat -c %b $M0/file`
29
nblks=`stat -c %B $M0/file`
30
TEST [ $(($blksz * $nblks)) -eq 1048576 ]
31

32
TEST unlink $M0/file
33

34
# truncate a file to a fixed size, fallocate and verify that the size does not
35
# change
36
TEST truncate -s 1M $M0/file
37
TEST fallocate -l 2m -n $M0/file
38
blksz=`stat -c %b $M0/file`
39
nblks=`stat -c %B $M0/file`
40
sz=`stat -c %s $M0/file`
41
TEST [ $sz -eq 1048576 ]
42
# Note that gluster currently incorporates a hack to limit the number of blocks
43
# reported as allocated to the file by the file size. We have allocated beyond the
44
# file size here. Just check for non-zero allocation to avoid setting a land mine
45
# for if/when that behavior might change.
46
TEST [ ! $(($blksz * $nblks)) -eq 0 ]
47

48
TEST unlink $M0/file
49

50
EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
51

52
TEST $CLI volume stop $V0
53
TEST $CLI volume delete $V0
54

55
cleanup;
56

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

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

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

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