[Gluster-devel] feature/trash and NetBSD

Emmanuel Dreyfus manu at netbsd.org
Tue Mar 31 09:19:14 UTC 2015


On Tue, Mar 31, 2015 at 10:57:12AM +0530, Anoop C S wrote:
> The above mentioned patch for skipping extended truncate
> [http://review.gluster.org/#/c/9984/] got merged yesterday. And some
> portability fixes for trash.t was included in your recently merged patch
> [http://review.gluster.org/#/c/10033/]. Now we expect trash.t to run
> more smoothly than before on NetBSD. Feel free to reply with outstanding
> failures.

There are other problems, many tieming issues that can be addressed
using the appropriate wrappers (see patch below). However, it still fails
on test 56 which is about restarting the volume:

TEST 56 (line 207): gluster --mode=script --wignore volume start patchy1 force
[09:12:53] ./tests/features/trash.t .. 56/65 
not ok 56 

Could you have a look? You will find the test ready to run with my
latest patches on nbslave76.cloud.gluster.org:/autobuild/glusterfs

diff --git a/tests/features/trash.t b/tests/features/trash.t
index cbcff23..4546b57 100755
--- a/tests/features/trash.t
+++ b/tests/features/trash.t
@@ -7,7 +7,11 @@ cleanup
 
 test_mount() {
         glusterfs -s $H0 --volfile-id $V0 $M0 --attribute-timeout=0
-        test -d $M0/.trashcan
+        timeout=0
+        while [ $timeout -lt $PROCESS_UP_TIMEOUT ] ; do
+		timeout=$(( $timeout + 1 ))
+                test -d $M0/.trashcan && break
+        done
 }
 
 start_vol() {
@@ -15,19 +19,23 @@ start_vol() {
         test_mount
 }
 
-stop_vol() {
-        umount $M0
-        $CLI volume stop $V0
-}
-
 create_files() {
         echo 'Hi' > $1
         echo 'Hai' > $2
 }
 
-file_exists() {
-        test -e $B0/${V0}1/$1 -o -e $B0/${V0}2/$1
-        test -e $B0/${V0}1/$2 -o -e $B0/${V0}2/$2
+file_exists () {
+        vol=$1
+	shift
+	for file in `ls $B0/${vol}1/$@ 2>/dev/null` ; do
+                test -e ${file} && { echo "Y"; return 0; }
+        done
+	for file in `ls $B0/${vol}2/$@ 2>/dev/null` ; do
+                test -e ${file} && { echo "Y"; return 0; }
+        done
+
+	echo "N"
+	return 1;
 }
 
 unlink_op() {
@@ -85,7 +93,7 @@ EXPECT 'on' volinfo_field $V0 'features.trash'
 
 # files directly under mount point [13]
 create_files $M0/file1 $M0/file2
-TEST file_exists file1 file2
+TEST file_exists $V0 file1 file2
 
 # perform unlink [14]
 TEST unlink_op file1
@@ -96,7 +104,7 @@ TEST truncate_op file2 4
 # create files directory hierarchy and check [16]
 mkdir -p $M0/1/2/3
 create_files $M0/1/2/3/foo1 $M0/1/2/3/foo2
-TEST file_exists 1/2/3/foo1 1/2/3/foo2
+TEST file_exists $V0 1/2/3/foo1 1/2/3/foo2
 
 # perform unlink [17]
 TEST unlink_op 1/2/3/foo1
@@ -113,7 +121,7 @@ EXPECT '/a' volinfo_field $V0 'features.trash-eliminate-path'
 
 # create two files and check [21]
 create_files $M0/a/test1 $M0/a/test2
-TEST file_exists a/test1 a/test2
+TEST file_exists $V0 a/test1 a/test2
 
 # remove from eliminate pattern [22]
 rm -f $M0/a/test1
@@ -131,7 +139,7 @@ EXPECT 'on' volinfo_field $V0 'features.trash-internal-op'
 
 # again create two files and check [28]
 create_files $M0/inop1 $M0/inop2
-TEST file_exists inop1 inop2
+TEST file_exists $V0 inop1 inop2
 
 # perform unlink [29]
 TEST unlink_op inop1
@@ -141,11 +149,12 @@ TEST truncate_op inop2 4
 
 # remove one brick and restart the volume [31-33]
 TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}2 force
-TEST stop_vol
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
+$CLI volume stop $V0
 TEST start_vol
 # again create two files and check [34]
 create_files $M0/rebal1 $M0/rebal2
-TEST file_exists rebal1 rebal2
+TEST file_exists $V0 rebal1 rebal2
 
 # add one brick [35-36]
 TEST $CLI volume add-brick $V0 $H0:$B0/${V0}3
@@ -158,7 +167,8 @@ sleep 3
 # check whether rebalance was succesful [38-40]
 TEST [ -e $B0/${V0}3/rebal2 ]
 TEST [ -e $B0/${V0}1/.trashcan/internal_op/rebal2* ]
-TEST stop_vol
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
+$CLI volume stop $V0
 
 # create a replicated volume [41]
 TEST $CLI volume create $V1 replica 2 $H0:$B0/${V1}{1,2}
@@ -187,9 +197,10 @@ touch $M1/self
 TEST [ -e $B0/${V1}1/self -a -e $B0/${V1}2/self ]
 
 # kill one brick and delete the file from mount point [55]
-kill `ps aux| grep glusterfsd | awk '{print $2}' | head -1`
+kill `ps auxww| grep glusterfsd | awk '{print $2}' | head -1`
 sleep 2
 rm -f $M1/self
+sleep 1
 TEST [ -e $M1/.trashcan/self* ]
 
 # force start the volume and trigger the self-heal manually [56]
@@ -197,7 +208,7 @@ TEST $CLI volume start $V1 force
 sleep 3
 
 # check for the removed file in trashcan [57]
-TEST [ -e $B0/${V1}1/.trashcan/internal_op/self* -o -e $B0/${V1}2/.trashcan/internal_op/self* ]
+EXPECT_WITHIN $HEAL_TIMEOUT "Y" file_exists $V1 .trashcan/internal_op/self*
 
 # check renaming of trash directory through cli [58-62]
 TEST $CLI volume set $V0 trash-dir abc


-- 
Emmanuel Dreyfus
manu at netbsd.org


More information about the Gluster-devel mailing list