From 025ae07850375cbf981ed335a4ddf702d54be6e3 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 14 Aug 2014 13:06:26 -0700 Subject: build: make GLUSTERD_WORKDIR rely on localstatedir Backport from master branch - http://review.gluster.org/#/c/8246/ - Break-way from '/var/lib/glusterd' hard-coded previously, instead rely on 'configure' value from 'localstatedir' - Provide 's/lib/db' as default working directory for gluster management daemon for BSD and Darwin based installations - loff_t is really off_t on Darwin - fix-off the warnings generated by clang on FreeBSD/Darwin - Now 'tests/*' use GLUSTERD_WORKDIR a common variable for all platforms. - Define proper environment for running tests, define correct PATH and LD_LIBRARY_PATH when running tests, so that the desired version of glusterfs is used, regardless where it is installed. (Thanks to manu@netbsd.org for this additional work) Change-Id: I06e684ac4c26d1e74c9daf76753403ad15f79276 BUG: 1130308 Signed-off-by: Harshavardhana Reviewed-on: http://review.gluster.org/8486 Tested-by: Gluster Build System --- tests/bugs/bug-1119582.t | 2 +- tests/bugs/bug-765380.t | 2 +- tests/bugs/bug-797171.t | 4 ++-- tests/bugs/bug-811493.t | 4 ++-- tests/bugs/bug-856455.t | 2 +- tests/bugs/bug-858215.t | 4 ++-- tests/bugs/bug-860663.t | 2 +- tests/bugs/bug-861542.t | 2 +- tests/bugs/bug-862967.t | 2 +- tests/bugs/bug-867253.t | 4 ++-- tests/bugs/bug-874498.t | 2 +- tests/bugs/bug-877992.t | 16 ++++++++-------- tests/bugs/bug-880898.t | 2 +- tests/bugs/bug-893378.t | 2 +- tests/bugs/bug-902610.t | 4 ++-- tests/bugs/bug-904065.t | 10 +++++----- tests/bugs/bug-916549.t | 4 ++-- tests/bugs/bug-955588.t | 2 +- tests/bugs/bug-958790.t | 6 +++--- 19 files changed, 38 insertions(+), 38 deletions(-) (limited to 'tests/bugs') diff --git a/tests/bugs/bug-1119582.t b/tests/bugs/bug-1119582.t index 9251927e314..cc388bde605 100644 --- a/tests/bugs/bug-1119582.t +++ b/tests/bugs/bug-1119582.t @@ -17,7 +17,7 @@ TEST $CLI volume set $V0 features.uss disable; TEST killall glusterd; -rm -f /var/lib/glusterd/vols/$V0/snapd.info +rm -f $GLUSTERD_WORKDIR/vols/$V0/snapd.info TEST glusterd diff --git a/tests/bugs/bug-765380.t b/tests/bugs/bug-765380.t index a9784b93d0c..65bc6597eea 100644 --- a/tests/bugs/bug-765380.t +++ b/tests/bugs/bug-765380.t @@ -31,7 +31,7 @@ TEST $CLI volume set $V0 node-uuid-pathinfo on # do not expext hostname as part of the pathinfo string EXPECT 0 count_hostname_or_uuid_from_pathinfo $H0 -uuid=`grep UUID /var/lib/glusterd/glusterd.info | cut -f2 -d=` +uuid=`grep UUID $GLUSTERD_WORKDIR/glusterd.info | cut -f2 -d=` # ... but expect the uuid $REPLICA times EXPECT $REPLICA count_hostname_or_uuid_from_pathinfo $uuid diff --git a/tests/bugs/bug-797171.t b/tests/bugs/bug-797171.t index f160e418c2b..d29c4bd7a2a 100755 --- a/tests/bugs/bug-797171.t +++ b/tests/bugs/bug-797171.t @@ -21,8 +21,8 @@ $M0; touch $M0/{1..22}; rm -f $M0/*; -pid_file=$(ls /var/lib/glusterd/vols/$V0/run); -brick_pid=$(cat /var/lib/glusterd/vols/$V0/run/$pid_file); +pid_file=$(ls $GLUSTERD_WORKDIR/vols/$V0/run); +brick_pid=$(cat $GLUSTERD_WORKDIR/vols/$V0/run/$pid_file); mkdir $statedumpdir/statedump_tmp/; echo "path=$statedumpdir/statedump_tmp" > $statedumpdir/glusterdump.options; diff --git a/tests/bugs/bug-811493.t b/tests/bugs/bug-811493.t index 13e99af5798..966995945cb 100755 --- a/tests/bugs/bug-811493.t +++ b/tests/bugs/bug-811493.t @@ -8,10 +8,10 @@ TEST glusterd TEST pidof glusterd TEST $CLI system uuid reset; -uuid1=$(grep UUID /var/lib/glusterd/glusterd.info | cut -f 2 -d "="); +uuid1=$(grep UUID $GLUSTERD_WORKDIR/glusterd.info | cut -f 2 -d "="); TEST $CLI system uuid reset; -uuid2=$(grep UUID /var/lib/glusterd/glusterd.info | cut -f 2 -d "="); +uuid2=$(grep UUID $GLUSTERD_WORKDIR/glusterd.info | cut -f 2 -d "="); TEST [ $uuid1 != $uuid2 ] diff --git a/tests/bugs/bug-856455.t b/tests/bugs/bug-856455.t index becb202225f..3e314aa5bb3 100644 --- a/tests/bugs/bug-856455.t +++ b/tests/bugs/bug-856455.t @@ -35,7 +35,7 @@ EXPECT $BRICK_COUNT query_pathinfo $M0/f00d; # Kill a brick process and then query for pathinfo # for directories pathinfo should list backend patch from available (up) subvolumes -kill -9 `cat /var/lib/glusterd/vols/$V0/run/$H0-d-backends-${V0}1.pid`; +kill -9 `cat $GLUSTERD_WORKDIR/vols/$V0/run/$H0-d-backends-${V0}1.pid`; EXPECT `expr $BRICK_COUNT - 1` query_pathinfo $M0/f00d; diff --git a/tests/bugs/bug-858215.t b/tests/bugs/bug-858215.t index eafb4a9621d..8f11b7f3921 100755 --- a/tests/bugs/bug-858215.t +++ b/tests/bugs/bug-858215.t @@ -39,8 +39,8 @@ TEST touch $M0/newfile; TEST stat $M0/newfile; TEST rm $M0/newfile; -nfs_pid=$(cat /var/lib/glusterd/nfs/run/nfs.pid); -glustershd_pid=$(cat /var/lib/glusterd/glustershd/run/glustershd.pid); +nfs_pid=$(cat $GLUSTERD_WORKDIR/nfs/run/nfs.pid); +glustershd_pid=$(cat $GLUSTERD_WORKDIR/glustershd/run/glustershd.pid); pids=$(pidof glusterfs); for i in $pids diff --git a/tests/bugs/bug-860663.t b/tests/bugs/bug-860663.t index dd3fcc6793b..a4b3d71fb78 100644 --- a/tests/bugs/bug-860663.t +++ b/tests/bugs/bug-860663.t @@ -31,7 +31,7 @@ TEST touch $M0/files{1..10000}; ORIG_FILE_COUNT=`ls -l $M0 | wc -l`; # Kill a brick process -kill -9 `cat /var/lib/glusterd/vols/$V0/run/$H0-d-backends-${V0}1.pid`; +kill -9 `cat $GLUSTERD_WORKDIR/vols/$V0/run/$H0-d-backends-${V0}1.pid`; TEST $CLI volume rebalance $V0 fix-layout start diff --git a/tests/bugs/bug-861542.t b/tests/bugs/bug-861542.t index 5fd08f12d02..f4fd4e52a58 100755 --- a/tests/bugs/bug-861542.t +++ b/tests/bugs/bug-861542.t @@ -40,7 +40,7 @@ TEST $CLI --xml volume status $V0; TEST $CLI --xml volume status $V0 detail; # Kill the brick process. After this, port number for the killed (in this case brick) process must be "N/A". -kill `cat /var/lib/glusterd/vols/$V0/run/$H0-d-backends-brick0.pid` +kill `cat $GLUSTERD_WORKDIR/vols/$V0/run/$H0-d-backends-brick0.pid` EXPECT "N/A" port_field $V0 '0'; # volume status EXPECT "N/A" port_field $V0 '1'; # volume status detail diff --git a/tests/bugs/bug-862967.t b/tests/bugs/bug-862967.t index 00fa884408a..bd500b1da9d 100644 --- a/tests/bugs/bug-862967.t +++ b/tests/bugs/bug-862967.t @@ -36,7 +36,7 @@ chown 1:1 $M0/dir; # Kill a brick process -kill -9 `cat /var/lib/glusterd/vols/$V0/run/$H0-d-backends-${V0}1.pid`; +kill -9 `cat $GLUSTERD_WORKDIR/vols/$V0/run/$H0-d-backends-${V0}1.pid`; # change dir ownership NEW_UID=36; NEW_GID=36; diff --git a/tests/bugs/bug-867253.t b/tests/bugs/bug-867253.t index 560ff11a28e..6b0332959e9 100644 --- a/tests/bugs/bug-867253.t +++ b/tests/bugs/bug-867253.t @@ -35,7 +35,7 @@ TEST mount -o vers=3,nolock,noac -t nfs $H0:/$V0 $M0; touch $M0/files{1..1000}; # Kill a brick process -kill -9 `cat /var/lib/glusterd/vols/$V0/run/$H0-d-backends-${V0}0.pid`; +kill -9 `cat $GLUSTERD_WORKDIR/vols/$V0/run/$H0-d-backends-${V0}0.pid`; echo 3 >/proc/sys/vm/drop_caches; @@ -46,7 +46,7 @@ NEW_FILE_COUNT=`echo $?`; TEST $CLI volume start $V0 force # Kill a brick process -kill -9 `cat /var/lib/glusterd/vols/$V0/run/$H0-d-backends-${V0}1.pid`; +kill -9 `cat $GLUSTERD_WORKDIR/vols/$V0/run/$H0-d-backends-${V0}1.pid`; echo 3 >/proc/sys/vm/drop_caches; diff --git a/tests/bugs/bug-874498.t b/tests/bugs/bug-874498.t index 9337e6dc680..843698d2a61 100644 --- a/tests/bugs/bug-874498.t +++ b/tests/bugs/bug-874498.t @@ -14,7 +14,7 @@ TEST $CLI volume start $V0; TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0; B0_hiphenated=`echo $B0 | tr '/' '-'` -kill -9 `cat /var/lib/glusterd/vols/$V0/run/$H0$B0_hiphenated-brick1.pid` ; +kill -9 `cat $GLUSTERD_WORKDIR/vols/$V0/run/$H0$B0_hiphenated-brick1.pid` ; echo "GLUSTER FILE SYSTEM" > $M0/FILE1 echo "GLUSTER FILE SYSTEM" > $M0/FILE2 diff --git a/tests/bugs/bug-877992.t b/tests/bugs/bug-877992.t index 932ecc77b86..979cbfd3fdc 100755 --- a/tests/bugs/bug-877992.t +++ b/tests/bugs/bug-877992.t @@ -23,21 +23,21 @@ function hooks_prep () { local event=$1 touch /tmp/pre.out /tmp/post.out - touch /var/lib/glusterd/hooks/1/"$event"/pre/Spre.sh - touch /var/lib/glusterd/hooks/1/"$event"/post/Spost.sh + touch $GLUSTERD_WORKDIR/hooks/1/"$event"/pre/Spre.sh + touch $GLUSTERD_WORKDIR/hooks/1/"$event"/post/Spost.sh - printf "#! /bin/bash\necho "$event"Pre > /tmp/pre.out\n" > /var/lib/glusterd/hooks/1/"$event"/pre/Spre.sh - printf "#! /bin/bash\necho "$event"Post > /tmp/post.out\n" > /var/lib/glusterd/hooks/1/"$event"/post/Spost.sh - chmod a+x /var/lib/glusterd/hooks/1/"$event"/pre/Spre.sh - chmod a+x /var/lib/glusterd/hooks/1/"$event"/post/Spost.sh + printf "#! /bin/bash\necho "$event"Pre > /tmp/pre.out\n" > $GLUSTERD_WORKDIR/hooks/1/"$event"/pre/Spre.sh + printf "#! /bin/bash\necho "$event"Post > /tmp/post.out\n" > $GLUSTERD_WORKDIR/hooks/1/"$event"/post/Spost.sh + chmod a+x $GLUSTERD_WORKDIR/hooks/1/"$event"/pre/Spre.sh + chmod a+x $GLUSTERD_WORKDIR/hooks/1/"$event"/post/Spost.sh } function hooks_cleanup () { local event=$1 rm /tmp/pre.out /tmp/post.out - rm /var/lib/glusterd/hooks/1/"$event"/pre/Spre.sh - rm /var/lib/glusterd/hooks/1/"$event"/post/Spost.sh + rm $GLUSTERD_WORKDIR/hooks/1/"$event"/pre/Spre.sh + rm $GLUSTERD_WORKDIR/hooks/1/"$event"/post/Spost.sh } ## Verify volume is created and its hooks script ran diff --git a/tests/bugs/bug-880898.t b/tests/bugs/bug-880898.t index a069d4a8ac1..8ba35ec1a59 100644 --- a/tests/bugs/bug-880898.t +++ b/tests/bugs/bug-880898.t @@ -9,7 +9,7 @@ TEST $CLI volume create $V0 replica 2 $H0:$B0/brick1 $H0:$B0/brick2 TEST $CLI volume start $V0 pkill glusterfs uuid="" -for line in $(cat /var/lib/glusterd/glusterd.info) +for line in $(cat $GLUSTERD_WORKDIR/glusterd.info) do if [[ $line == UUID* ]] then diff --git a/tests/bugs/bug-893378.t b/tests/bugs/bug-893378.t index fd8b9a7ceba..46aec53cfd3 100755 --- a/tests/bugs/bug-893378.t +++ b/tests/bugs/bug-893378.t @@ -59,7 +59,7 @@ then get_cached_brick CACHED=$? # Kill a brick process - kill -9 `cat /var/lib/glusterd/vols/$V0/run/$H0-d-backends-${V0}$CACHED.pid`; + kill -9 `cat $GLUSTERD_WORKDIR/vols/$V0/run/$H0-d-backends-${V0}$CACHED.pid`; fi ## trigger a lookup diff --git a/tests/bugs/bug-902610.t b/tests/bugs/bug-902610.t index 3f26fdde970..9b824b1b558 100755 --- a/tests/bugs/bug-902610.t +++ b/tests/bugs/bug-902610.t @@ -54,8 +54,8 @@ TEST glusterfs -s $H0 --volfile-id $V0 $M0 --entry-timeout=0 --attribute-timeout TEST ls -l $M0 ## kill 2 bricks to bring down available subvol < spread count -kill -9 `cat /var/lib/glusterd/vols/$V0/run/$H0-d-backends-${V0}2.pid`; -kill -9 `cat /var/lib/glusterd/vols/$V0/run/$H0-d-backends-${V0}3.pid`; +kill -9 `cat $GLUSTERD_WORKDIR/vols/$V0/run/$H0-d-backends-${V0}2.pid`; +kill -9 `cat $GLUSTERD_WORKDIR/vols/$V0/run/$H0-d-backends-${V0}3.pid`; mkdir $M0/dir1 2>/dev/null diff --git a/tests/bugs/bug-904065.t b/tests/bugs/bug-904065.t index 01880246ef2..0b39adb5c68 100755 --- a/tests/bugs/bug-904065.t +++ b/tests/bugs/bug-904065.t @@ -38,7 +38,7 @@ EXPECT 'Started' volinfo_field $V0 'Status' EXPECT_WITHIN $NFS_EXPORT_TIMEOUT 1 is_nfs_export_available # before mounting the rmtab should be empty -EXPECT '0' count_lines /var/lib/glusterd/nfs/rmtab +EXPECT '0' count_lines $GLUSTERD_WORKDIR/nfs/rmtab TEST mount_nfs $H0:/$V0 $N0 nolock # the output would looks similar to: @@ -46,19 +46,19 @@ TEST mount_nfs $H0:/$V0 $N0 nolock # hostname-0=172.31.122.104 # mountpoint-0=/ufo # -EXPECT '2' count_lines /var/lib/glusterd/nfs/rmtab +EXPECT '2' count_lines $GLUSTERD_WORKDIR/nfs/rmtab # duplicate mounts should not be recorded (client could have crashed) TEST mount_nfs $H0:/$V0 $N1 nolock -EXPECT '2' count_lines /var/lib/glusterd/nfs/rmtab +EXPECT '2' count_lines $GLUSTERD_WORKDIR/nfs/rmtab # removing a mount should (even if there are two) should remove the entry EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $N1 -EXPECT '0' count_lines /var/lib/glusterd/nfs/rmtab +EXPECT '0' count_lines $GLUSTERD_WORKDIR/nfs/rmtab # unmounting the other mount should work flawlessly EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $N0 -EXPECT '0' count_lines /var/lib/glusterd/nfs/rmtab +EXPECT '0' count_lines $GLUSTERD_WORKDIR/nfs/rmtab TEST glusterfs --entry-timeout=0 --attribute-timeout=0 --volfile-server=$H0 --volfile-id=$V0 $M0 diff --git a/tests/bugs/bug-916549.t b/tests/bugs/bug-916549.t index d6a45b8270f..344c6abaaf1 100755 --- a/tests/bugs/bug-916549.t +++ b/tests/bugs/bug-916549.t @@ -8,8 +8,8 @@ TEST glusterd; TEST $CLI volume create $V0 $H0:$B0/${V0}1; TEST $CLI volume start $V0; -pid_file=$(ls /var/lib/glusterd/vols/$V0/run); -brick_pid=$(cat /var/lib/glusterd/vols/$V0/run/$pid_file); +pid_file=$(ls $GLUSTERD_WORKDIR/vols/$V0/run); +brick_pid=$(cat $GLUSTERD_WORKDIR/vols/$V0/run/$pid_file); kill -SIGKILL $brick_pid; diff --git a/tests/bugs/bug-955588.t b/tests/bugs/bug-955588.t index 3f03611673d..182035c6132 100755 --- a/tests/bugs/bug-955588.t +++ b/tests/bugs/bug-955588.t @@ -18,7 +18,7 @@ function get_brick_host_uuid() TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1} -uuid=`grep UUID /var/lib/glusterd/glusterd.info | cut -f2 -d=` +uuid=`grep UUID $GLUSTERD_WORKDIR/glusterd.info | cut -f2 -d=` EXPECT $uuid get_brick_host_uuid $V0 TEST $CLI volume delete $V0; diff --git a/tests/bugs/bug-958790.t b/tests/bugs/bug-958790.t index 6cc799c25ed..fc5f63a0c28 100644 --- a/tests/bugs/bug-958790.t +++ b/tests/bugs/bug-958790.t @@ -9,9 +9,9 @@ TEST glusterd; TEST pidof glusterd; TEST $CLI volume info; -touch /var/lib/glusterd/groups/test -echo "read-ahead=off" > /var/lib/glusterd/groups/test -echo "open-behind=off" >> /var/lib/glusterd/groups/test +touch $GLUSTERD_WORKDIR/groups/test +echo "read-ahead=off" > $GLUSTERD_WORKDIR/groups/test +echo "open-behind=off" >> $GLUSTERD_WORKDIR/groups/test TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2}; TEST $CLI volume set $V0 group test -- cgit