summaryrefslogtreecommitdiffstats
path: root/tests/bugs/bug-834465.t
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2013-02-16 20:10:24 +0530
committerAnand Avati <avati@redhat.com>2013-02-17 17:03:40 -0800
commit6c848529cb26e6e4a5dc9576283207ab72187974 (patch)
tree3d4ef0d80bc0a1f00b9ba22e0d0b77652c63305e /tests/bugs/bug-834465.t
parent4741b2682084aaac1179310bd3672fde6f312404 (diff)
libglusterfs: Fix memory leaks in fd_lk_insert_and_merge
Change-Id: I666664895fdd7c7199797796819e652557a7ac99 BUG: 834465 Signed-off-by: Vijay Bellur <vbellur@redhat.com> Reviewed-on: http://review.gluster.org/4525 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'tests/bugs/bug-834465.t')
-rwxr-xr-xtests/bugs/bug-834465.t60
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/bugs/bug-834465.t b/tests/bugs/bug-834465.t
new file mode 100755
index 00000000..d2e5f47a
--- /dev/null
+++ b/tests/bugs/bug-834465.t
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+
+cleanup;
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume info;
+
+function volinfo_field()
+{
+ local vol=$1;
+ local field=$2;
+
+ $CLI volume info $vol | grep "^$field: " | sed 's/.*: //';
+}
+
+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 -A2 "fuse - usage-type 85" $sdump1
+if [ $? -eq '0' ]
+then
+ nalloc1=`grep -A2 "fuse - usage-type 85" $sdump1 | grep num_allocs | cut -d '=' -f2`
+fi
+
+function build_tester ()
+{
+ local cfile=$1
+ local fname=$(basename "$cfile")
+ local execname=$(basename $fname ".c")
+ gcc -g -o $(dirname $cfile)/$execname $cfile
+}
+
+build_tester $(dirname $0)/bug-834465.c
+
+TEST $(dirname $0)/bug-834465 $M0/testfile
+
+sdump2=$(generate_mount_statedump $V0);
+nalloc2=`grep -A2 "fuse - usage-type 85" $sdump2 | grep num_allocs | cut -d '=' -f2`
+
+TEST [ $nalloc1 -eq $nalloc2 ];
+
+TEST rm -rf $MOUNTDIR/*
+TEST rm -rf $(dirname $0)/bug-834465
+cleanup_mount_statedump $V0
+
+TEST umount $MOUNTDIR -l
+
+cleanup;