diff options
Diffstat (limited to 'tests/bugs/ec')
-rw-r--r-- | tests/bugs/ec/bug-1161621.t | 42 | ||||
-rw-r--r-- | tests/bugs/ec/bug-1161886.c | 53 | ||||
-rw-r--r-- | tests/bugs/ec/bug-1161886.t | 44 | ||||
-rw-r--r-- | tests/bugs/ec/bug-1179050.t | 23 | ||||
-rw-r--r-- | tests/bugs/ec/bug-1187474.t | 41 | ||||
-rw-r--r-- | tests/bugs/ec/bug-1188145.t | 50 | ||||
-rw-r--r-- | tests/bugs/ec/bug-1227869.t | 33 | ||||
-rw-r--r-- | tests/bugs/ec/bug-1236065.t | 95 | ||||
-rw-r--r-- | tests/bugs/ec/bug-1251446.t | 50 | ||||
-rwxr-xr-x | tests/bugs/ec/bug-1304988.t | 42 |
10 files changed, 473 insertions, 0 deletions
diff --git a/tests/bugs/ec/bug-1161621.t b/tests/bugs/ec/bug-1161621.t new file mode 100644 index 00000000000..84361e440dc --- /dev/null +++ b/tests/bugs/ec/bug-1161621.t @@ -0,0 +1,42 @@ +#!/bin/bash + +. $(dirname $0)/../../traps.rc +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 disperse 5 redundancy 2 $H0:$B0/${V0}{0..4} +EXPECT "Created" volinfo_field $V0 'Status' +TEST $CLI volume start $V0 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Started" volinfo_field $V0 'Status' +TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0 +TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M1 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "5" ec_child_up_count $V0 0 + +tmpdir=$(mktemp -d -t ${0##*/}.XXXXXX) +push_trapfunc "rm -rf $tmpdir" + +TEST dd if=/dev/urandom of=$tmpdir/file bs=1234 count=20 +cs=$(sha1sum $tmpdir/file | awk '{ print $1 }') +# Test O_APPEND on create +TEST dd if=$tmpdir/file of=$M0/file bs=1234 count=10 oflag=append +# Test O_APPEND on open +TEST dd if=$tmpdir/file of=$M0/file bs=1234 skip=10 oflag=append conv=notrunc +EXPECT "$cs" echo $(sha1sum $M0/file | awk '{ print $1 }') + +# Fill a file with ff (I don't use 0's because empty holes created by an +# incorrect offset will be returned as 0's and won't be detected) +dd if=/dev/zero bs=24680 count=1000 | tr '\0' '\377' >$tmpdir/shared +cs=$(sha1sum $tmpdir/shared | awk '{ print $1 }') +# Test concurrent writes to the same file using O_APPEND +dd if=$tmpdir/shared of=$M0/shared bs=123400 count=100 oflag=append conv=notrunc & +dd if=$tmpdir/shared of=$M1/shared bs=123400 count=100 oflag=append conv=notrunc & +wait + +EXPECT "24680000" stat -c "%s" $M0/shared +EXPECT "$cs" echo $(sha1sum $M0/shared | awk '{ print $1 }') + +cleanup diff --git a/tests/bugs/ec/bug-1161886.c b/tests/bugs/ec/bug-1161886.c new file mode 100644 index 00000000000..e8093e48a7a --- /dev/null +++ b/tests/bugs/ec/bug-1161886.c @@ -0,0 +1,53 @@ + +#include <stdio.h> +#include <glusterfs/api/glfs.h> +#include <glusterfs/api/glfs-handles.h> + +int +main (int argc, char *argv[]) +{ + glfs_t *fs = NULL; + glfs_fd_t *fd = NULL; + int ret = 1; + + if (argc != 4) { + fprintf (stderr, "Syntax: %s <host> <volname> <file>\n", argv[0]); + return 1; + } + + fs = glfs_new (argv[2]); + if (!fs) { + fprintf (stderr, "glfs_new: returned NULL\n"); + return 1; + } + + ret = glfs_set_volfile_server (fs, "tcp", argv[1], 24007); + if (ret != 0) { + fprintf (stderr, "glfs_set_volfile_server: retuned %d\n", ret); + goto out; + } + ret = glfs_set_logging (fs, "/dev/null", 7); + if (ret != 0) { + fprintf (stderr, "glfs_set_logging: returned %d\n", ret); + goto out; + } + ret = glfs_init (fs); + if (ret != 0) { + fprintf (stderr, "glfs_init: returned %d\n", ret); + goto out; + } + + fd = glfs_open (fs, argv[3], O_RDWR | O_TRUNC); + if (fd == NULL) { + fprintf (stderr, "glfs_open: returned NULL\n"); + goto out; + } + glfs_close(fd); + + ret = 0; + +out: + glfs_fini (fs); + + return ret; +} diff --git a/tests/bugs/ec/bug-1161886.t b/tests/bugs/ec/bug-1161886.t new file mode 100644 index 00000000000..e7322210a3e --- /dev/null +++ b/tests/bugs/ec/bug-1161886.t @@ -0,0 +1,44 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +function check_ec_size +{ + local res + + for i in {0..2}; do + res=$(( `getfattr -n trusted.ec.size -e hex $B0/$V0$i/$1 | sed -n "s/^trusted.ec.size=//p"` )) + if [ "x$res" == "x" -o "$res" != "$2" ]; then + echo "N" + return 0 + fi + done + echo "Y" + return 0 +} + +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 redundancy 1 $H0:$B0/${V0}{0..2} +EXPECT "Created" volinfo_field $V0 'Status' +TEST $CLI volume start $V0 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Started" volinfo_field $V0 'Status' +TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "3" ec_child_up_count $V0 0 + +TEST dd if=/dev/zero of=$M0/file1 bs=4k count=1 +TEST mv $M0/file1 $M0/file2 +TEST ! stat $M0/file1 +TEST stat $M0/file2 + +TEST build_tester $(dirname $0)/bug-1161886.c -lgfapi -Wall -O2 +TEST $(dirname $0)/bug-1161886 $H0 $V0 /file2 +EXPECT "^0$" stat -c "%s" $M0/file2 +EXPECT "^Y$" check_ec_size file2 0 + +rm -f $(dirname $0)/bug-1161886 + +cleanup diff --git a/tests/bugs/ec/bug-1179050.t b/tests/bugs/ec/bug-1179050.t new file mode 100644 index 00000000000..ea2d7b39838 --- /dev/null +++ b/tests/bugs/ec/bug-1179050.t @@ -0,0 +1,23 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 redundancy 1 $H0:$B0/${V0}{0..2} +EXPECT "Created" volinfo_field $V0 'Status' +TEST $CLI volume start $V0 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Started" volinfo_field $V0 'Status' +TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "3" ec_child_up_count $V0 0 + +TEST $CLI volume clear-locks $V0 / kind all inode + +sleep 1 + +EXPECT "3" ec_child_up_count $V0 0 + +cleanup diff --git a/tests/bugs/ec/bug-1187474.t b/tests/bugs/ec/bug-1187474.t new file mode 100644 index 00000000000..fb4b2082f8f --- /dev/null +++ b/tests/bugs/ec/bug-1187474.t @@ -0,0 +1,41 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../nfs.rc + +function check_dir() +{ + local count + + count=`ls $1 | grep "dir.[0-9]*" | wc -l` + if [[ $count -eq 100 ]]; then + echo "Y" + else + echo "N" + fi +} + +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 redundancy 2 $H0:$B0/${V0}{0..5} +EXPECT "Created" volinfo_field $V0 'Status' +TEST $CLI volume set $V0 nfs.disable false +TEST $CLI volume start $V0 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Started" volinfo_field $V0 'Status' +EXPECT_WITHIN $NFS_EXPORT_TIMEOUT "1" is_nfs_export_available +TEST mount_nfs $H0:/$V0 $N0 +TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "6" ec_child_up_count $V0 0 + +TEST mkdir $M0/dir.{1..100} + +sleep 2 + +EXPECT "Y" check_dir $N0 + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" umount_nfs $N0 + +cleanup diff --git a/tests/bugs/ec/bug-1188145.t b/tests/bugs/ec/bug-1188145.t new file mode 100644 index 00000000000..aa3a59bc62f --- /dev/null +++ b/tests/bugs/ec/bug-1188145.t @@ -0,0 +1,50 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +function create_dirs() +{ + local stop=$1 + local idx + local res + + res=0 + idx=1 + while [[ -f ${stop} ]]; do + mkdir $M0/${idx} + if [[ $? -ne 0 ]]; then + res=1 + break; + fi + idx=$(( idx + 1 )) + done + + return ${res} +} + +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 redundancy 2 $H0:$B0/${V0}{0..5} +EXPECT "Created" volinfo_field $V0 'Status' +TEST $CLI volume start $V0 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Started" volinfo_field $V0 'Status' +TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "6" ec_child_up_count $V0 0 + +name=`mktemp -t ${0##*/}.XXXXXX` +create_dirs ${name} & +pid=$! + +sleep 2 +TEST $CLI volume set $V0 uss on +sleep 5 +TEST $CLI volume set $V0 uss off +sleep 5 + +TEST rm -f ${name} +TEST wait ${pid} + +cleanup diff --git a/tests/bugs/ec/bug-1227869.t b/tests/bugs/ec/bug-1227869.t new file mode 100644 index 00000000000..00fad825fae --- /dev/null +++ b/tests/bugs/ec/bug-1227869.t @@ -0,0 +1,33 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup + +QDD=$(dirname $0)/quota +# compile the test write program and run it +build_tester $(dirname $0)/../../basic/quota.c -o $QDD + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 disperse 3 $H0:$B0/${V0}{1..3} +EXPECT "Created" volinfo_field $V0 'Status' + +TEST $CLI volume start $V0 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Started" volinfo_field $V0 'Status' + +TEST $CLI volume quota $V0 enable +TEST $CLI volume quota $V0 limit-usage / 100MB + +TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0 + +TEST $QDD $M0/file 256 40 + +EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "10.0MB" quotausage "/" + +EXPECT "0" echo $(df -k $M0 | grep -q '10240 '; echo $?) +EXPECT "0" echo $(df -k $M0 | grep -q '92160 '; echo $?) + +rm -f $QDD +cleanup diff --git a/tests/bugs/ec/bug-1236065.t b/tests/bugs/ec/bug-1236065.t new file mode 100644 index 00000000000..9038cb95948 --- /dev/null +++ b/tests/bugs/ec/bug-1236065.t @@ -0,0 +1,95 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup + +ec_test_dir=$M0/test + +function ec_test_generate_src() +{ + mkdir -p $ec_test_dir + for i in `seq 0 19`; do + dd if=/dev/zero of=$ec_test_dir/$i.c bs=1024 count=2 + done +} + +function ec_test_make() +{ + for i in `ls *.c`; do + file=`basename $i` + filename=${file%.*} + cp $i $filename.o + done +} + +## step 1 +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 disperse 7 redundancy 3 $H0:$B0/${V0}{0..6} +TEST $CLI volume start $V0 +TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "7" ec_child_up_count $V0 0 + +## step 2 +TEST ec_test_generate_src + +cd $ec_test_dir +TEST ec_test_make + +## step 3 +TEST kill_brick $V0 $H0 $B0/${V0}0 +TEST kill_brick $V0 $H0 $B0/${V0}1 +EXPECT '5' online_brick_count + +TEST rm -f *.o +TEST ec_test_make + +## step 4 +TEST $CLI volume start $V0 force +EXPECT '7' online_brick_count + +# active heal +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid +TEST $CLI volume heal $V0 full +EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0 + +TEST rm -f *.o +TEST ec_test_make + +## step 5 +TEST kill_brick $V0 $H0 $B0/${V0}2 +TEST kill_brick $V0 $H0 $B0/${V0}3 +EXPECT '5' online_brick_count + +TEST rm -f *.o +TEST ec_test_make + +EXPECT '5' online_brick_count + +## step 6 +TEST $CLI volume start $V0 force +EXPECT '7' online_brick_count + +# self-healing +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid +TEST $CLI volume heal $V0 full +EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0 + +TEST rm -f *.o +TEST ec_test_make + +TEST pidof glusterd +EXPECT "$V0" volinfo_field $V0 'Volume Name' +EXPECT 'Started' volinfo_field $V0 'Status' +EXPECT '7' online_brick_count + +## cleanup +cd +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 +TEST rm -rf $B0/* + +cleanup; diff --git a/tests/bugs/ec/bug-1251446.t b/tests/bugs/ec/bug-1251446.t new file mode 100644 index 00000000000..f89e71ace8b --- /dev/null +++ b/tests/bugs/ec/bug-1251446.t @@ -0,0 +1,50 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 disperse 4 redundancy 1 $H0:$B0/${V0}{0..3} +TEST $CLI volume start $V0 +TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "4" ec_child_up_count $V0 0 + +TEST dd if=/dev/urandom of=$M0/test1 bs=1024k count=2 +cs=$(sha1sum $M0/test1 | awk '{ print $1 }') + +TEST kill_brick $V0 $H0 $B0/${V0}0 +EXPECT '3' online_brick_count + +TEST cp $M0/test1 $M0/test2 +EXPECT "$cs" echo $(sha1sum $M0/test2 | awk '{ print $1 }') + +TEST $CLI volume start $V0 force +EXPECT '4' online_brick_count + +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid +TEST $CLI volume heal $V0 full +EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0 + +EXPECT "699392" stat -c "%s" $B0/${V0}0/test2 + +# force cache clear +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +TEST $CLI volume stop $V0 +TEST $CLI volume start $V0 +TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "4" ec_child_up_count $V0 0 + +TEST kill_brick $V0 $H0 $B0/${V0}3 +EXPECT '3' online_brick_count + +EXPECT "$cs" echo $(sha1sum $M0/test2 | awk '{ print $1 }') + +## cleanup +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 + +cleanup; diff --git a/tests/bugs/ec/bug-1304988.t b/tests/bugs/ec/bug-1304988.t new file mode 100755 index 00000000000..334e5c25932 --- /dev/null +++ b/tests/bugs/ec/bug-1304988.t @@ -0,0 +1,42 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +# This test renames files from dir to test and vice versa in an infinite loop +# at the same time add-brick and rebalance starts which should NOT be hanged + +cleanup; + +function rename_files { +while : +do + for i in {1..100}; do mv $M0/dir/file-$i $M0/test/newfile-$i; done + for i in {1..100}; do mv $M0/test/newfile-$i $M0/dir/file-$i; done +done +} + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 disperse 6 redundancy 2 $H0:$B0/${V0}{0..5} +TEST $CLI volume start $V0 +TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "6" ec_child_up_count $V0 0 + +mkdir $M0/dir +mkdir $M0/test +touch $M0/dir/file-{1..100} +rename_files & +back_pid1=$!; +echo "Started rename $back_pid1" + +TEST $CLI volume add-brick $V0 $H0:$B0/${V0}{6..11} +TEST $CLI volume rebalance $V0 start force + +#Test if rebalance completed with success. +EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" rebalance_status_field $V0 +echo "rebalance done..." +kill $back_pid1 +cleanup; +#G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=1332022 +#G_TESTDEF_TEST_STATUS_CENTOS6=BAD_TEST,BUG=1332022 |