summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Hernandez <xhernandez@datalab.es>2014-07-16 16:52:42 +0200
committerVijay Bellur <vbellur@redhat.com>2014-08-01 23:32:26 -0700
commit410c15a1fb1b9f1cfaa5ee315b9ca39e27c04ec8 (patch)
tree18f7b050700cdd9e2cb9347ab366928c71242225
parent41e2384181e854c06d3a234c2f37aacf9d92f53c (diff)
tests: Avoid test bug-884597.t to loop infinitely
If some unexpected error happens while this test is trying to create a linkto file, an infinite loop is generated and the test never ends. This patch limits the number of retries it can do to find that file. Change-Id: Ie556c509116109ead99c78d671b2669b4428faac Signed-off-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-on: http://review.gluster.org/8318 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rwxr-xr-xtests/bugs/bug-884597.t32
1 files changed, 26 insertions, 6 deletions
diff --git a/tests/bugs/bug-884597.t b/tests/bugs/bug-884597.t
index db8d0c33fd3..a0540b628a0 100755
--- a/tests/bugs/bug-884597.t
+++ b/tests/bugs/bug-884597.t
@@ -38,9 +38,14 @@ TEST touch $M0/$i
chown $NEW_UID:$NEW_GID $M0/$i
## rename till file gets a linkfile
-while [ $i -ne 0 ]
+has_link=0
+while [ $i -lt 100 ]
do
- TEST mv $M0/$i $M0/$(( $i+1 ))
+ mv $M0/$i $M0/$(( $i+1 ))
+ if [ $? -ne 0 ]
+ then
+ break
+ fi
let i++
file_has_linkfile $i
has_link=$?
@@ -50,6 +55,8 @@ do
fi
done
+TEST [ $has_link -eq 2 ]
+
get_hashed_brick $i
cached=$?
@@ -87,10 +94,14 @@ chown $NEW_UID:$NEW_GID $M0/file;
## ln till file gets a linkfile
-while [ $i -ne 0 ]
+has_link=0
+while [ $i -lt 100 ]
do
- TEST ln $M0/file $M0/link$i
-
+ ln $M0/file $M0/link$i
+ if [ $? -ne 0 ]
+ then
+ break
+ fi
file_has_linkfile link$i
has_link=$?
if [ $has_link -eq 2 ]
@@ -100,6 +111,8 @@ do
let i++
done
+TEST [ $has_link -eq 2 ]
+
get_hashed_brick link$i
cached=$?
@@ -127,9 +140,14 @@ TEST `useradd -M ABC 2>/dev/null`
TEST cd $M0
## rename as different user till file gets a linkfile
-while [ $i -ne 0 ]
+has_link=0
+while [ $i -lt 100 ]
do
su -c "mv $M0/user_file$i $M0/user_file$(( $i+1 ))" ABC
+ if [ $? -ne 0 ]
+ then
+ break
+ fi
let i++
file_has_linkfile user_file$i
has_link=$?
@@ -139,6 +157,8 @@ do
fi
done
+TEST [ $has_link -eq 2 ]
+
## del user ABC
TEST userdel ABC