diff options
author | Niels de Vos <ndevos@redhat.com> | 2014-12-26 12:57:48 +0100 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-01-06 03:24:24 -0800 |
commit | 64954eb3c58f4ef077e54e8a3726fd2d27419b12 (patch) | |
tree | 52cd5a39bbfda7442a5f0955ac2800b74a45b58a /tests/bugs/core | |
parent | c4ab37c02e9edc23d0637e23d6f2b42d0827dad2 (diff) |
tests: move all test-cases into component subdirectories
There are around 300 regression tests, 250 being in tests/bugs. Running
partial set of tests/bugs is not easy because this is a flat directory
with almost all tests inside.
It would be valuable to make partial test/bugs easier, and allow the use
of mulitple build hosts for a single commit, each running a subset of
the tests for a quicker result.
Additional changes made:
- correct the include path for *.rc shell libraries and *.py utils
- make the testcases pass checkpatch
- arequal-checksum in afr/self-heal.t was never executed, now it is
- include.rc now complains loudly if it fails to find env.rc
Change-Id: I26ffd067e9853d3be1fd63b2f37d8aa0fd1b4fea
BUG: 1178685
Reported-by: Emmanuel Dreyfus <manu@netbsd.org>
Reported-by: Atin Mukherjee <amukherj@redhat.com>
URL: http://www.gluster.org/pipermail/gluster-devel/2014-December/043414.html
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/9353
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Emmanuel Dreyfus <manu@netbsd.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'tests/bugs/core')
-rw-r--r-- | tests/bugs/core/949327.t | 23 | ||||
-rw-r--r-- | tests/bugs/core/bug-1110917.t | 39 | ||||
-rw-r--r-- | tests/bugs/core/bug-1111557.t | 12 | ||||
-rw-r--r-- | tests/bugs/core/bug-1117951.t | 24 | ||||
-rw-r--r-- | tests/bugs/core/bug-1119582.t | 24 | ||||
-rw-r--r-- | tests/bugs/core/bug-1135514-allow-setxattr-with-null-value.t | 18 | ||||
-rwxr-xr-x | tests/bugs/core/bug-1168803-snapd-option-validation-fix.t | 30 | ||||
-rw-r--r-- | tests/bugs/core/bug-1168875.t | 96 | ||||
-rw-r--r-- | tests/bugs/core/bug-834465.c | 61 | ||||
-rwxr-xr-x | tests/bugs/core/bug-834465.t | 48 | ||||
-rw-r--r-- | tests/bugs/core/bug-845213.t | 19 | ||||
-rw-r--r-- | tests/bugs/core/bug-903336.t | 13 | ||||
-rwxr-xr-x | tests/bugs/core/bug-908146.t | 39 | ||||
-rw-r--r-- | tests/bugs/core/bug-913544.t | 24 | ||||
-rwxr-xr-x | tests/bugs/core/bug-924075.t | 23 | ||||
-rwxr-xr-x | tests/bugs/core/bug-927616.t | 62 | ||||
-rw-r--r-- | tests/bugs/core/bug-949242.t | 55 | ||||
-rw-r--r-- | tests/bugs/core/bug-986429.t | 19 |
18 files changed, 629 insertions, 0 deletions
diff --git a/tests/bugs/core/949327.t b/tests/bugs/core/949327.t new file mode 100644 index 00000000000..6b8033a5c85 --- /dev/null +++ b/tests/bugs/core/949327.t @@ -0,0 +1,23 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +function tmp_file_count() +{ + echo $(ls -lh /tmp/tmp.* 2>/dev/null | wc -l) +} + + +old_count=$(tmp_file_count); +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}0 $H0:$B0/${V0}1 +TEST $CLI volume start $V0 +new_count=$(tmp_file_count); + +TEST [ "$old_count" -eq "$new_count" ] + +cleanup diff --git a/tests/bugs/core/bug-1110917.t b/tests/bugs/core/bug-1110917.t new file mode 100644 index 00000000000..c4b04fbf2c7 --- /dev/null +++ b/tests/bugs/core/bug-1110917.t @@ -0,0 +1,39 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd + +TEST $CLI volume create $V0 $H0:$B0/brick1 $H0:$B0/brick2; +TEST $CLI volume start $V0; + +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 + +TEST $CLI volume set $V0 changelog on +TEST $CLI volume set $V0 changelog.fsync-interval 1 + +# perform I/O on the background +f=$(basename `mktemp -t ${0##*/}.XXXXXX`) +dd if=/dev/urandom of=$M0/$f count=100000 bs=4k & + +# this is the best we can do without inducing _error points_ in the code +# without the patch reconfigre() would hang... +TEST $CLI volume set $V0 changelog.rollover-time `expr $((RANDOM % 9)) + 1` +TEST $CLI volume set $V0 changelog.rollover-time `expr $((RANDOM % 9)) + 1` + +TEST $CLI volume set $V0 changelog off +TEST $CLI volume set $V0 changelog on +TEST $CLI volume set $V0 changelog off +TEST $CLI volume set $V0 changelog on + +TEST $CLI volume set $V0 changelog.rollover-time `expr $((RANDOM % 9)) + 1` +TEST $CLI volume set $V0 changelog.rollover-time `expr $((RANDOM % 9)) + 1` + +# if there's a deadlock, this would hang +wait; + +cleanup; diff --git a/tests/bugs/core/bug-1111557.t b/tests/bugs/core/bug-1111557.t new file mode 100644 index 00000000000..4ed45761bce --- /dev/null +++ b/tests/bugs/core/bug-1111557.t @@ -0,0 +1,12 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/${V0}{0} +TEST $CLI volume set $V0 diagnostics.brick-log-buf-size 0 +TEST ! $CLI volume set $V0 diagnostics.brick-log-buf-size -0 +cleanup diff --git a/tests/bugs/core/bug-1117951.t b/tests/bugs/core/bug-1117951.t new file mode 100644 index 00000000000..b484fee2fe4 --- /dev/null +++ b/tests/bugs/core/bug-1117951.t @@ -0,0 +1,24 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/brick +EXPECT 'Created' volinfo_field $V0 'Status'; +TEST $CLI volume start $V0 + +# Running with a locale not using '.' as decimal separator should work +export LC_NUMERIC=sv_SE.utf8 +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0 +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 + +# As should a locale using '.' as a decimal separator +export LC_NUMERIC=C +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0 +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 + +cleanup diff --git a/tests/bugs/core/bug-1119582.t b/tests/bugs/core/bug-1119582.t new file mode 100644 index 00000000000..c30057c2b2c --- /dev/null +++ b/tests/bugs/core/bug-1119582.t @@ -0,0 +1,24 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../fileio.rc +. $(dirname $0)/../../nfs.rc + +cleanup; + +TEST glusterd; + +TEST pidof glusterd; + +TEST $CLI volume create $V0 $H0:$B0/${V0}0 $H0:$B0/${V0}1 + +TEST $CLI volume set $V0 features.uss disable; + +TEST killall glusterd; + +rm -f $GLUSTERD_WORKDIR/vols/$V0/snapd.info + +TEST glusterd + +cleanup ; diff --git a/tests/bugs/core/bug-1135514-allow-setxattr-with-null-value.t b/tests/bugs/core/bug-1135514-allow-setxattr-with-null-value.t new file mode 100644 index 00000000000..d26aa561321 --- /dev/null +++ b/tests/bugs/core/bug-1135514-allow-setxattr-with-null-value.t @@ -0,0 +1,18 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +#Test +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/${V0}0 +TEST $CLI volume start $V0 +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 +TEST touch $M0/file +TEST setfattr -n user.attribute1 $M0/file +TEST getfattr -n user.attribute1 $M0/file +cleanup + diff --git a/tests/bugs/core/bug-1168803-snapd-option-validation-fix.t b/tests/bugs/core/bug-1168803-snapd-option-validation-fix.t new file mode 100755 index 00000000000..1e52d447507 --- /dev/null +++ b/tests/bugs/core/bug-1168803-snapd-option-validation-fix.t @@ -0,0 +1,30 @@ +#!/bin/bash + +## Test case for BZ-1168803 - snapd option validation should not fail if the +#snapd is not running + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +## Start glusterd +TEST glusterd; +TEST pidof glusterd; + +## create volume +TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2}; +TEST $CLI volume set $V0 features.uss enable + +## Now set another volume option, this should not fail +TEST $CLI volume set $V0 features.file-snapshot on + +## start the volume +TEST $CLI volume start $V0 + +## Kill snapd daemon and then try to stop the volume which should not fail +kill $(ps aux | grep glusterfsd | grep snapd | awk '{print $2}') + +TEST $CLI volume stop $V0 + +cleanup; diff --git a/tests/bugs/core/bug-1168875.t b/tests/bugs/core/bug-1168875.t new file mode 100644 index 00000000000..f6fa9f729c9 --- /dev/null +++ b/tests/bugs/core/bug-1168875.t @@ -0,0 +1,96 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../snapshot.rc +. $(dirname $0)/../../fileio.rc +. $(dirname $0)/../../nfs.rc + +cleanup; + +function check_entry_point_exists () +{ + local entry_point=$1; + local _path=$2; + + ls -a $_path | grep $entry_point; + + if [ $? -eq 0 ]; then + echo 'Y'; + else + echo 'N'; + fi +} + +TEST init_n_bricks 3; +TEST setup_lvm 3; + +TEST glusterd; + +TEST pidof glusterd; + +TEST $CLI volume create $V0 $H0:$L1 $H0:$L2 $H0:$L3; + +TEST $CLI volume start $V0; + +TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 --xlator-option *-snapview-client.snapdir-entry-path=/dir $M0; + +TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $N0; +for i in {1..10} ; do echo "file" > $M0/file$i ; done + + +for i in {11..20} ; do echo "file" > $M0/file$i ; done + +mkdir $M0/dir; + +for i in {1..10} ; do echo "file" > $M0/dir/file$i ; done + +mkdir $M0/dir1; +mkdir $M0/dir2; + +for i in {1..10} ; do echo "foo" > $M0/dir1/foo$i ; done +for i in {1..10} ; do echo "foo" > $M0/dir2/foo$i ; done + +for i in {11..20} ; do echo "foo" > $M0/dir1/foo$i ; done +for i in {11..20} ; do echo "foo" > $M0/dir2/foo$i ; done + +TEST $CLI snapshot create snap1 $V0; +TEST $CLI snapshot activate snap1; + +TEST $CLI volume set $V0 features.uss enable; + +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Y' check_if_snapd_exist + +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'N' check_entry_point_exists .snaps $M0/dir +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'N' check_entry_point_exists .snaps $N0/dir + +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'N' check_entry_point_exists .snaps $M0/dir1 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'N' check_entry_point_exists .snaps $N0/dir1 + +TEST $CLI volume set $V0 features.show-snapshot-directory enable; + +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" STAT $M0/dir +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" STAT $N0/dir +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" STAT $M0/dir1 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" STAT $N0/dir1 + +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Y' check_entry_point_exists ".snaps" $M0/dir +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'N' check_entry_point_exists ".snaps" $N0/dir + +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'N' check_entry_point_exists ".snaps" $M0/dir1 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'N' check_entry_point_exists ".snaps" $N0/dir1 + +TEST $CLI volume set $V0 features.show-snapshot-directory disable; + +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" STAT $M0/dir +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" STAT $N0/dir +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" STAT $M0/dir1 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" STAT $N0/dir1 + +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'N' check_entry_point_exists ".snaps" $M0/dir +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'N' check_entry_point_exists ".snaps" $N0/dir + +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'N' check_entry_point_exists ".snaps" $M0/dir1 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'N' check_entry_point_exists ".snaps" $N0/dir1 + +cleanup; diff --git a/tests/bugs/core/bug-834465.c b/tests/bugs/core/bug-834465.c new file mode 100644 index 00000000000..61d3deac077 --- /dev/null +++ b/tests/bugs/core/bug-834465.c @@ -0,0 +1,61 @@ +#include <sys/file.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +int +main (int argc, char *argv[]) +{ + int fd = -1; + char *filename = NULL; + struct flock lock = {0, }; + int i = 0; + int ret = -1; + + if (argc != 2) { + fprintf (stderr, "Usage: %s <filename> ", argv[0]); + goto out; + } + + filename = argv[1]; + + fd = open (filename, O_RDWR | O_CREAT, 0); + if (fd < 0) { + fprintf (stderr, "open (%s) failed (%s)\n", filename, + strerror (errno)); + goto out; + } + + lock.l_type = F_WRLCK; + lock.l_whence = SEEK_SET; + lock.l_start = 1; + lock.l_len = 1; + + while (i < 100) { + lock.l_type = F_WRLCK; + ret = fcntl (fd, F_SETLK, &lock); + if (ret < 0) { + fprintf (stderr, "fcntl setlk failed (%s)\n", + strerror (errno)); + goto out; + } + + lock.l_type = F_UNLCK; + ret = fcntl (fd, F_SETLK, &lock); + if (ret < 0) { + fprintf (stderr, "fcntl setlk failed (%s)\n", + strerror (errno)); + goto out; + } + + i++; + } + + ret = 0; + +out: + return ret; +} diff --git a/tests/bugs/core/bug-834465.t b/tests/bugs/core/bug-834465.t new file mode 100755 index 00000000000..5bc52a0957e --- /dev/null +++ b/tests/bugs/core/bug-834465.t @@ -0,0 +1,48 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info; + +TEST $CLI volume create $V0 $H0:$B0/brick1 $H0:$B0/brick2; +EXPECT 'Created' volinfo_field $V0 'Status'; + +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; + +MOUNTDIR=$M0; +TEST glusterfs --mem-accounting --volfile-server=$H0 --volfile-id=$V0 $MOUNTDIR; + +sdump1=$(generate_mount_statedump $V0); +nalloc1=0 +grep -A3 "fuse - usage-type gf_common_mt_fd_lk_ctx_node_t" $sdump1 +if [ $? -eq '0' ] +then + nalloc1=`grep -A3 "fuse - usage-type gf_common_mt_fd_lk_ctx_node_t" $sdump1 | grep num_allocs | cut -d '=' -f2` +fi + +build_tester $(dirname $0)/bug-834465.c + +TEST $(dirname $0)/bug-834465 $M0/testfile + +sdump2=$(generate_mount_statedump $V0); + +# With _gf_free now setting typestr to NULL when num_allocs become 0, it is +# expected that there wouldn't be any entry for gf_common_mt_fd_lk_ctx_node_t +# in the statedump file now + +nalloc2=`grep -A3 "fuse - usage-type gf_common_mt_fd_lk_ctx_node_t" $sdump2 | wc -l` +TEST [ $nalloc1 -eq $nalloc2 ]; + +TEST rm -rf $MOUNTDIR/* +TEST rm -rf $(dirname $0)/bug-834465 +cleanup_mount_statedump $V0 + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $MOUNTDIR + +cleanup; diff --git a/tests/bugs/core/bug-845213.t b/tests/bugs/core/bug-845213.t new file mode 100644 index 00000000000..136e4126d14 --- /dev/null +++ b/tests/bugs/core/bug-845213.t @@ -0,0 +1,19 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc + +cleanup; + + +## Start and create a volume +TEST glusterd; +TEST pidof glusterd; +TEST $CLI volume info; + +## Create and start a volume with aio enabled +TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2}; +TEST $CLI volume set $V0 remote-dio enable; +TEST $CLI volume set $V0 network.remote-dio disable; + +cleanup; + diff --git a/tests/bugs/core/bug-903336.t b/tests/bugs/core/bug-903336.t new file mode 100644 index 00000000000..b52c1a4758e --- /dev/null +++ b/tests/bugs/core/bug-903336.t @@ -0,0 +1,13 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/${V0} +TEST $CLI volume start $V0 +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 +TEST setfattr -n trusted.io-stats-dump -v /tmp $M0 +cleanup diff --git a/tests/bugs/core/bug-908146.t b/tests/bugs/core/bug-908146.t new file mode 100755 index 00000000000..8b519ff2fff --- /dev/null +++ b/tests/bugs/core/bug-908146.t @@ -0,0 +1,39 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +function get_fd_count { + local vol=$1 + local host=$2 + local brick=$3 + local fname=$4 + local gfid_str=$(gf_gfid_xattr_to_str $(gf_get_gfid_xattr $brick/$fname)) + local statedump=$(generate_brick_statedump $vol $host $brick) + local count=$(grep "gfid=$gfid_str" $statedump -A2 | grep fd-count | cut -f2 -d'=' | tail -1) + rm -f $statedump + echo $count +} +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/${V0}0 +TEST $CLI volume set $V0 performance.open-behind off +TEST $CLI volume start $V0 +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 --direct-io-mode=enable +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M1 --attribute-timeout=0 --entry-timeout=0 --direct-io-mode=enable + +TEST touch $M0/a + +exec 4>"$M0/a" +exec 5>"$M1/a" +EXPECT "2" get_fd_count $V0 $H0 $B0/${V0}0 a + +exec 4>&- +EXPECT "1" get_fd_count $V0 $H0 $B0/${V0}0 a + +exec 5>&- +EXPECT "0" get_fd_count $V0 $H0 $B0/${V0}0 a + +cleanup diff --git a/tests/bugs/core/bug-913544.t b/tests/bugs/core/bug-913544.t new file mode 100644 index 00000000000..af421722590 --- /dev/null +++ b/tests/bugs/core/bug-913544.t @@ -0,0 +1,24 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +#simulate a split-brain of a file and do truncate. This should not crash the mount point +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}0 $H0:$B0/${V0}1 +TEST $CLI volume set $V0 stat-prefetch off +TEST $CLI volume start $V0 +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 +cd $M0 +TEST touch a +#simulate no-changelog data split-brain +echo "abc" > $B0/${V0}1/a +echo "abcd" > $B0/${V0}0/a +TEST truncate -s 0 a +TEST ls +cd + +cleanup diff --git a/tests/bugs/core/bug-924075.t b/tests/bugs/core/bug-924075.t new file mode 100755 index 00000000000..61ce0f18286 --- /dev/null +++ b/tests/bugs/core/bug-924075.t @@ -0,0 +1,23 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +#FIXME: there is another patch which moves the following function into +#include.rc +function process_leak_count () +{ + local pid=$1; + return $(ls -lh /proc/$pid/fd | grep "(deleted)" | wc -l) +} + +TEST glusterd; +TEST $CLI volume create $V0 $H0:$B0/${V0}1; +TEST $CLI volume start $V0; +TEST glusterfs -s $H0 --volfile-id $V0 $M0; +mount_pid=$(get_mount_process_pid $V0); +TEST process_leak_count $mount_pid; + +cleanup; diff --git a/tests/bugs/core/bug-927616.t b/tests/bugs/core/bug-927616.t new file mode 100755 index 00000000000..811e88f952f --- /dev/null +++ b/tests/bugs/core/bug-927616.t @@ -0,0 +1,62 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../nfs.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2}; +TEST $CLI volume set $V0 performance.open-behind off; +TEST $CLI volume start $V0 + +## Mount FUSE with caching disabled +TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0; + +EXPECT_WITHIN $NFS_EXPORT_TIMEOUT "1" is_nfs_export_available; +TEST mount_nfs $H0:/$V0 $N0 nolock; + +TEST mkdir $M0/dir; + +mkdir $M0/other; +cp /etc/passwd $M0/; +cp $M0/passwd $M0/file; +chmod 600 $M0/file; + +chown -R nfsnobody:nfsnobody $M0/dir; + +TEST $CLI volume set $V0 server.root-squash on; + +sleep 1; + +# tests should fail. +touch $M0/foo 2>/dev/null; +TEST [ $? -ne 0 ] +touch $N0/foo 2>/dev/null; +TEST [ $? -ne 0 ] +mkdir $M0/new 2>/dev/null; +TEST [ $? -ne 0 ] +mkdir $N0/new 2>/dev/null; +TEST [ $? -ne 0 ] + +TEST $CLI volume set $V0 server.root-squash off; + +sleep 1; + +# tests should pass. +touch $M0/foo 2>/dev/null; +TEST [ $? -eq 0 ] +touch $N0/bar 2>/dev/null; +TEST [ $? -eq 0 ] +mkdir $M0/new 2>/dev/null; +TEST [ $? -eq 0 ] +mkdir $N0/old 2>/dev/null; +TEST [ $? -eq 0 ] + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" umount_nfs $N0 + +TEST $CLI volume stop $V0; +TEST $CLI volume delete $V0; + +cleanup; diff --git a/tests/bugs/core/bug-949242.t b/tests/bugs/core/bug-949242.t new file mode 100644 index 00000000000..5e916cbdbe6 --- /dev/null +++ b/tests/bugs/core/bug-949242.t @@ -0,0 +1,55 @@ +#!/bin/bash +# +# Bug 949242 - Test basic fallocate functionality. +# +# Run several commands to verify basic fallocate functionality. We verify that +# fallocate creates and allocates blocks to a file. We also verify that the keep +# size option does not modify the file size. +### + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../fallocate.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +TEST glusterd + +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2,3,4} +TEST $CLI volume start $V0 + +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 + +# check for fallocate support before continuing the test +require_fallocate -l 1m -n $M0/file && rm -f $M0/file + +# fallocate a file and verify blocks are allocated +TEST fallocate -l 1m $M0/file +blksz=`stat -c %b $M0/file` +nblks=`stat -c %B $M0/file` +TEST [ $(($blksz * $nblks)) -eq 1048576 ] + +TEST unlink $M0/file + +# truncate a file to a fixed size, fallocate and verify that the size does not +# change +TEST truncate -s 1M $M0/file +TEST fallocate -l 2m -n $M0/file +blksz=`stat -c %b $M0/file` +nblks=`stat -c %B $M0/file` +sz=`stat -c %s $M0/file` +TEST [ $sz -eq 1048576 ] +# Note that gluster currently incorporates a hack to limit the number of blocks +# reported as allocated to the file by the file size. We have allocated beyond the +# file size here. Just check for non-zero allocation to avoid setting a land mine +# for if/when that behavior might change. +TEST [ ! $(($blksz * $nblks)) -eq 0 ] + +TEST unlink $M0/file + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 + +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 + +cleanup; diff --git a/tests/bugs/core/bug-986429.t b/tests/bugs/core/bug-986429.t new file mode 100644 index 00000000000..e512301775f --- /dev/null +++ b/tests/bugs/core/bug-986429.t @@ -0,0 +1,19 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +## This tests failover achieved by providing multiple +## servers from the trusted pool for fetching volume +## specification + +cleanup; + +TEST glusterd +TEST pidof glusterd + +TEST $CLI volume create $V0 $H0:$B0/$V0 +TEST $CLI volume start $V0 +TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s non-existent -s $H0 --volfile-id=/$V0 $M0 + +cleanup; |