summaryrefslogtreecommitdiffstats
path: root/tests/bugs/error-gen/bug-767095.t
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bugs/error-gen/bug-767095.t')
0 files changed, 0 insertions, 0 deletions
f='/cgit/glusterfs.git/diff/tests/basic/ec/ec-3-1.t?h=v7dev&id=1392da3e237d8ea080573909015916e3544a6d2c'>tests/basic/ec/ec-3-1.t14
-rw-r--r--tests/basic/ec/ec-4-1.t14
-rw-r--r--tests/basic/ec/ec-5-1.t14
-rw-r--r--tests/basic/ec/ec-5-2.t14
-rw-r--r--tests/basic/ec/ec-6-2.t14
-rw-r--r--tests/basic/ec/ec-7-3.t14
-rw-r--r--tests/basic/ec/ec-common143
-rw-r--r--tests/basic/ec/ec.t233
-rw-r--r--tests/basic/ec/self-heal.t123
10 files changed, 597 insertions, 0 deletions
diff --git a/tests/basic/ec/ec-12-4.t b/tests/basic/ec/ec-12-4.t
new file mode 100644
index 00000000000..9ab47018617
--- /dev/null
+++ b/tests/basic/ec/ec-12-4.t
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+# This test checks basic dispersed volume functionality and cli interface
+
+DISPERSE=12
+REDUNDANCY=4
+
+# This must be equal to 44 * $DISPERSE + 106
+TESTS_EXPECTED_IN_LOOP=634
+
+. $(dirname $0)/ec-common
diff --git a/tests/basic/ec/ec-3-1.t b/tests/basic/ec/ec-3-1.t
new file mode 100644
index 00000000000..5769c202289
--- /dev/null
+++ b/tests/basic/ec/ec-3-1.t
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+# This test checks basic dispersed volume functionality and cli interface
+
+DISPERSE=3
+REDUNDANCY=1
+
+# This must be equal to 44 * $DISPERSE + 106
+TESTS_EXPECTED_IN_LOOP=238
+
+. $(dirname $0)/ec-common
diff --git a/tests/basic/ec/ec-4-1.t b/tests/basic/ec/ec-4-1.t
new file mode 100644
index 00000000000..d34e1fb4e95
--- /dev/null
+++ b/tests/basic/ec/ec-4-1.t
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+# This test checks basic dispersed volume functionality and cli interface
+
+DISPERSE=4
+REDUNDANCY=1
+
+# This must be equal to 44 * $DISPERSE + 106
+TESTS_EXPECTED_IN_LOOP=282
+
+. $(dirname $0)/ec-common
diff --git a/tests/basic/ec/ec-5-1.t b/tests/basic/ec/ec-5-1.t
new file mode 100644
index 00000000000..61d1cb6ce48
--- /dev/null
+++ b/tests/basic/ec/ec-5-1.t
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+# This test checks basic dispersed volume functionality and cli interface
+
+DISPERSE=5
+REDUNDANCY=1
+
+# This must be equal to 44 * $DISPERSE + 106
+TESTS_EXPECTED_IN_LOOP=326
+
+. $(dirname $0)/ec-common
diff --git a/tests/basic/ec/ec-5-2.t b/tests/basic/ec/ec-5-2.t
new file mode 100644
index 00000000000..4dc1c186f02
--- /dev/null
+++ b/tests/basic/ec/ec-5-2.t
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+# This test checks basic dispersed volume functionality and cli interface
+
+DISPERSE=5
+REDUNDANCY=2
+
+# This must be equal to 44 * $DISPERSE + 106
+TESTS_EXPECTED_IN_LOOP=326
+
+. $(dirname $0)/ec-common
diff --git a/tests/basic/ec/ec-6-2.t b/tests/basic/ec/ec-6-2.t
new file mode 100644
index 00000000000..23ec84e60e9
--- /dev/null
+++ b/tests/basic/ec/ec-6-2.t
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+# This test checks basic dispersed volume functionality and cli interface
+
+DISPERSE=6
+REDUNDANCY=2
+
+# This must be equal to 44 * $DISPERSE + 106
+TESTS_EXPECTED_IN_LOOP=370
+
+. $(dirname $0)/ec-common
diff --git a/tests/basic/ec/ec-7-3.t b/tests/basic/ec/ec-7-3.t
new file mode 100644
index 00000000000..4ebba2a1de3
--- /dev/null
+++ b/tests/basic/ec/ec-7-3.t
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+# This test checks basic dispersed volume functionality and cli interface
+
+DISPERSE=7
+REDUNDANCY=3
+
+# This must be equal to 44 * $DISPERSE + 106
+TESTS_EXPECTED_IN_LOOP=414
+
+. $(dirname $0)/ec-common
diff --git a/tests/basic/ec/ec-common b/tests/basic/ec/ec-common
new file mode 100644
index 00000000000..95f53f250bc
--- /dev/null
+++ b/tests/basic/ec/ec-common
@@ -0,0 +1,143 @@
+
+SIZE_LIST="1048576 1000 12345 0"
+
+LAST_BRICK=$(($DISPERSE - 1))
+
+function fragment_size
+{
+ local fragments=$(($DISPERSE - $REDUNDANCY))
+ local block_size=$((128 * $fragments))
+ local size=$(($1 + $block_size - 1))
+
+ echo $((( $size - ( $size ) % $block_size ) / $fragments))
+}
+
+cleanup
+
+tmp=`mktemp -d`
+if [ ! -d $tmp ]; then
+ exit 1
+fi
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 redundancy $REDUNDANCY $H0:$B0/${V0}{0..$LAST_BRICK}
+TEST $CLI volume start $V0
+TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0
+
+TEST dd if=/dev/urandom of=$tmp/small bs=1024 count=1
+TEST dd if=/dev/urandom of=$tmp/big bs=1024 count=4096
+
+cs_small=$(sha1sum $tmp/small | awk '{ print $1 }')
+cs_big=$(sha1sum $tmp/big | awk '{ print $1 }')
+cp $tmp/small $tmp/small1
+for size in $SIZE_LIST; do
+ truncate -s $size $tmp/small1
+ eval cs_small_truncate[$size]=$(sha1sum $tmp/small1 | awk '{ print $1 }')
+done
+cp $tmp/big $tmp/big1
+for size in $SIZE_LIST; do
+ truncate -s $size $tmp/big1
+ eval cs_big_truncate[$size]=$(sha1sum $tmp/big1 | awk '{ print $1 }')
+done
+
+TEST df -h
+TEST stat $M0
+
+for idx in `seq 0 $LAST_BRICK`; do
+ brick[$idx]=$(gf_get_gfid_backend_file_path $B0/$V0$idx)
+done
+
+cd $M0
+EXPECT "2" echo $(ls -a1 | wc -l)
+TEST mkdir dir1
+TEST [ -d dir1 ]
+TEST touch file1
+TEST [ -f file1 ]
+
+for dir in . dir1; do
+ TEST cp $tmp/small $dir/small
+ TEST [ -f $dir/small ]
+ fsize=$(fragment_size 1024)
+ EXPECT "1024" stat -c "%s" $dir/small
+ for idx in `seq 0 $LAST_BRICK`; do
+ EXPECT "$fsize" stat -c "%s" ${brick[$idx]}/$dir/small
+ done
+
+ EXPECT "$cs_small" echo $(sha1sum $dir/small | awk '{ print $1 }')
+
+ TEST cp $tmp/big $dir/big
+ TEST [ -f $dir/big ]
+ fsize=$(fragment_size 4194304)
+ EXPECT "4194304" stat -c "%s" $dir/big
+ for idx in `seq 0 $LAST_BRICK`; do
+ EXPECT "$fsize" stat -c "%s" ${brick[$idx]}/$dir/big
+ done
+
+ EXPECT "$cs_big" echo $(sha1sum $dir/big | awk '{ print $1 }')
+
+ for idx in `seq 0 $LAST_BRICK`; do
+ TEST kill_brick $V0 $H0 $B0/$V0$idx
+
+ EXPECT "1024" stat -c "%s" $dir/small
+ EXPECT "4194304" stat -c "%s" $dir/big
+ EXPECT "$cs_small" echo $(sha1sum $dir/small | awk '{ print $1 }')
+ EXPECT "$cs_big" echo $(sha1sum $dir/big | awk '{ print $1 }')
+
+ cd
+ TEST umount $M0
+ TEST $CLI volume stop $V0 force
+ TEST $CLI volume start $V0
+ TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0
+ cd $M0
+ done
+
+ for size in $SIZE_LIST; do
+ TEST truncate -s $size $dir/small
+ TEST [ -f $dir/small ]
+ fsize=$(fragment_size $size)
+ EXPECT "$size" stat -c "%s" $dir/small
+ for idx in `seq 0 $LAST_BRICK`; do
+ EXPECT "$fsize" stat -c "%s" ${brick[$idx]}/$dir/small
+ done
+
+ EXPECT "${cs_small_truncate[$size]}" echo $(sha1sum $dir/small | awk '{ print $1 }')
+
+ TEST truncate -s $size $dir/big
+ TEST [ -f $dir/big ]
+ EXPECT "$size" stat -c "%s" $dir/big
+ for idx in `seq 0 $LAST_BRICK`; do
+ EXPECT "$fsize" stat -c "%s" ${brick[$idx]}/$dir/big
+ done
+
+ EXPECT "${cs_big_truncate[$size]}" echo $(sha1sum $dir/big | awk '{ print $1 }')
+ done
+
+ TEST rm -f $dir/small
+ TEST [ ! -e $dir/small ]
+ for idx in `seq 0 $LAST_BRICK`; do
+ TEST [ ! -e ${brick[$idx]}/$dir/small ]
+ done
+
+ TEST rm -f $dir/big
+ TEST [ ! -e $dir/big ]
+ for idx in `seq 0 $LAST_BRICK`; do
+ TEST [ ! -e ${brick[$idx]}/$dir/big ]
+ done
+done
+
+TEST rmdir dir1
+TEST [ ! -e dir1 ]
+for idx in `seq 0 $LAST_BRICK`; do
+ TEST [ ! -e ${brick[$idx]}/dir1 ]
+done
+
+TEST rm -f file1
+TEST [ ! -e file1 ]
+for idx in `seq 0 $LAST_BRICK`; do
+ TEST [ ! -e ${brick[$idx]}/file1 ]
+done
+
+rm -rf $tmp
+
+cleanup
diff --git a/tests/basic/ec/ec.t b/tests/basic/ec/ec.t
new file mode 100644
index 00000000000..e81de0d97bd
--- /dev/null
+++ b/tests/basic/ec/ec.t
@@ -0,0 +1,233 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+TEST_USER=test-ec-user
+TEST_UID=27341
+
+function my_getfattr {
+ getfattr --only-values -e text $* 2> /dev/null
+}
+
+function get_rep_count {
+ v=$(my_getfattr -n trusted.nsr.rep-count $1)
+ #echo $v > /dev/tty
+ echo $v
+}
+
+function create_file {
+ dd if=/dev/urandom of=$1 bs=4k count=$2 conv=sync 2> /dev/null
+}
+
+function setup_perm_file {
+ mkdir $1/perm_dir || return 1
+ chown ${TEST_USER} $1/perm_dir || return 1
+ su ${TEST_USER} -c "touch $1/perm_dir/perm_file" || return 1
+ return 0
+}
+
+# Functions to check repair for specific operation types.
+
+function check_create_write {
+ for b in $*; do
+ cmp $tmpdir/create-write $b/create-write || return 1
+ done
+ return 0
+}
+
+function check_truncate {
+ truncate --size=8192 $tmpdir/truncate
+ for b in $*; do
+ cmp $tmpdir/truncate $b/truncate || return 1
+ done
+ return 0
+}
+
+function check_hard_link {
+ for b in $*; do
+ inum1=$(ls -i $b/hard-link-1 | cut -d' ' -f1)
+ inum2=$(ls -i $b/hard-link-2 | cut -d' ' -f1)
+ [ "$inum1" = "$inum2" ] || return 1
+ done
+ echo "Y"
+ return 0
+}
+
+function check_soft_link {
+ for b in $*; do
+ [ "$(readlink $b/soft-link)" = "soft-link-tgt" ] || return 1
+ done
+ echo "Y"
+ return 0
+}
+
+function check_unlink {
+ for b in $*; do
+ [ ! -e $b/unlink ] || return 1
+ done
+ echo "Y"
+ return 0
+}
+
+function check_mkdir {
+ for b in $*; do
+ [ -d $b/mkdir ] || return 1
+ done
+ echo "Y"
+ return 0
+}
+
+function check_rmdir {
+ for b in $*; do
+ [ ! -e $b/rmdir ] || return 1
+ done<