summaryrefslogtreecommitdiffstats
path: root/tests/bitrot/bug-1221914.t
blob: 7f6c10c50df55bb2f199915900c9358c52465421 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash

. $(dirname $0)/../include.rc
. $(dirname $0)/../volume.rc
. $(dirname $0)/../nfs.rc

STUB_SOURCE=$(dirname $0)/br-stub.c
STUB_EXEC=$(dirname $0)/br-stub

cleanup;

TEST glusterd
TEST pidof glusterd

## Create a distribute volume (B=2)
TEST $CLI volume create $V0 $H0:$B0/${V0}1 $H0:$B0/${V0}2;
EXPECT "$V0" volinfo_field $V0 'Volume Name';
EXPECT 'Created' volinfo_field $V0 'Status';
EXPECT '2' brick_count $V0

## Turn off write-behind (write-behind clubs writes together)
TEST $CLI volume set $V0 performance.write-behind off

## Start the volume
TEST $CLI volume start $V0;
EXPECT 'Started' volinfo_field $V0 'Status';

## Enable bitrot
TEST $CLI volume bitrot $V0 enable;

## Mount the volume
TEST $GFS --volfile-server=$H0 --volfile-id=$V0 $M0;

## Build stub C source
build_tester $STUB_SOURCE -o $STUB_EXEC -I$(dirname $0)/../../xlators/features/bit-rot/src/stub
TEST [ -e $STUB_EXEC ]

## create & check version
fname="$M0/filezero"
$PYTHON -c "import os,stat; os.mknod('${fname}', stat.S_IFREG | stat.S_IRUSR | stat.S_IWUSR | stat.S_IROTH | stat.S_IRGRP)"

backpath=$(get_backend_paths $fname)

TEST $STUB_EXEC $fname $(dirname $backpath)

rm -f $fname;

##cleanups..
rm -f $STUB_EXEC

cleanup;