hadoop-zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maha...@apache.org
Subject svn commit: r903061 - in /hadoop/zookeeper/trunk: CHANGES.txt src/c/tests/TestOperations.cc src/c/tests/TestWatchers.cc
Date Tue, 26 Jan 2010 02:56:44 GMT
Author: mahadev
Date: Tue Jan 26 02:56:43 2010
New Revision: 903061

URL: http://svn.apache.org/viewvc?rev=903061&view=rev
Log:
ZOOKEEPER-413. two flaws need addressing in the c tests that can cause false positive failures
(phunt via mahadev)

Modified:
    hadoop/zookeeper/trunk/CHANGES.txt
    hadoop/zookeeper/trunk/src/c/tests/TestOperations.cc
    hadoop/zookeeper/trunk/src/c/tests/TestWatchers.cc

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=903061&r1=903060&r2=903061&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Tue Jan 26 02:56:43 2010
@@ -209,6 +209,9 @@
 
   ZOOKEEPER-656. SledgeHammer test - thread.run() deprecated (kay kay via mahadev)
 
+  ZOOKEEPER-413. two flaws need addressing in the c tests that can cause false
+  positive failures (phunt via mahadev)
+
 IMPROVEMENTS:
   ZOOKEEPER-473. cleanup junit tests to eliminate false positives due to
   "socket reuse" and failure to close client (phunt via mahadev)

Modified: hadoop/zookeeper/trunk/src/c/tests/TestOperations.cc
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/tests/TestOperations.cc?rev=903061&r1=903060&r2=903061&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/c/tests/TestOperations.cc (original)
+++ hadoop/zookeeper/trunk/src/c/tests/TestOperations.cc Tue Jan 26 02:56:43 2010
@@ -122,7 +122,10 @@
         // process the send queue
         rc=zookeeper_interest(zh,&fd,&interest,&tv);
         CPPUNIT_ASSERT_EQUAL((int)ZOK,rc);
-        while((rc=zookeeper_process(zh,interest))==ZOK) millisleep(100); //printf("%d\n",
rc);
+        while((rc=zookeeper_process(zh,interest))==ZOK) {
+          millisleep(100);
+          //printf("%d\n", rc);
+        }
         //printf("RC = %d", rc);
         CPPUNIT_ASSERT_EQUAL((int)ZNOTHING,rc);
 

Modified: hadoop/zookeeper/trunk/src/c/tests/TestWatchers.cc
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/tests/TestWatchers.cc?rev=903061&r1=903060&r2=903061&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/c/tests/TestWatchers.cc (original)
+++ hadoop/zookeeper/trunk/src/c/tests/TestWatchers.cc Tue Jan 26 02:56:43 2010
@@ -21,6 +21,7 @@
 
 #include "ZKMocks.h"
 #include "CollectionUtil.h"
+#include "Util.h"
 
 class Zookeeper_watchers : public CPPUNIT_NS::TestFixture
 {
@@ -269,7 +270,9 @@
         CPPUNIT_ASSERT_EQUAL((int)ZOK,rc);
         
         // this will process the response and activate the watcher
-        while((rc=zookeeper_process(zh,ZOOKEEPER_READ))==ZOK);
+        while((rc=zookeeper_process(zh,ZOOKEEPER_READ))==ZOK) {
+          millisleep(100);
+        }
         CPPUNIT_ASSERT_EQUAL((int)ZNOTHING,rc);
 
         // disconnect now
@@ -317,14 +320,18 @@
         CPPUNIT_ASSERT_EQUAL((int)ZOK,rc);
         
         // this will process the response and activate the watcher
-        while((rc=zookeeper_process(zh,ZOOKEEPER_READ))==ZOK);
+        while((rc=zookeeper_process(zh,ZOOKEEPER_READ))==ZOK) {
+          millisleep(100);
+        }
         CPPUNIT_ASSERT_EQUAL((int)ZNOTHING,rc);
 
         // we are all set now; let's trigger the watches
         zkServer.addRecvResponse(new ZNodeEvent(ZOO_CHANGED_EVENT,"/a/b/c"));
         zkServer.addRecvResponse(new ZNodeEvent(ZOO_CHANGED_EVENT,"/x/y/z"));
         // make sure all watchers have been processed
-        while((rc=zookeeper_process(zh,ZOOKEEPER_READ))==ZOK);
+        while((rc=zookeeper_process(zh,ZOOKEEPER_READ))==ZOK) {
+          millisleep(100);
+        }
         CPPUNIT_ASSERT_EQUAL((int)ZNOTHING,rc);
         
         CPPUNIT_ASSERT_EQUAL(1,wobject1.counter_);
@@ -365,13 +372,17 @@
         CPPUNIT_ASSERT_EQUAL((int)ZOK,rc);
         
         // this will process the response and activate the watcher
-        while((rc=zookeeper_process(zh,ZOOKEEPER_READ))==ZOK);
+        while((rc=zookeeper_process(zh,ZOOKEEPER_READ))==ZOK) {
+          millisleep(100);
+        }
         CPPUNIT_ASSERT_EQUAL((int)ZNOTHING,rc);
 
         // we are all set now; let's trigger the watches
         zkServer.addRecvResponse(new ZNodeEvent(ZOO_DELETED_EVENT,"/a"));
         // make sure the watchers have been processed
-        while((rc=zookeeper_process(zh,ZOOKEEPER_READ))==ZOK);
+        while((rc=zookeeper_process(zh,ZOOKEEPER_READ))==ZOK) {
+          millisleep(100);
+        }
         CPPUNIT_ASSERT_EQUAL((int)ZNOTHING,rc);
 
         CPPUNIT_ASSERT_EQUAL(1,wobject1.counter_);
@@ -411,13 +422,17 @@
         CPPUNIT_ASSERT_EQUAL((int)ZOK,rc);
         
         // this will process the response and activate the watcher
-        while((rc=zookeeper_process(zh,ZOOKEEPER_READ))==ZOK);
+        while((rc=zookeeper_process(zh,ZOOKEEPER_READ))==ZOK) {
+          millisleep(100);
+        }
         CPPUNIT_ASSERT_EQUAL((int)ZNOTHING,rc);
 
         // we are all set now; let's trigger the watches
         zkServer.addRecvResponse(new ZNodeEvent(ZOO_CHILD_EVENT,"/a"));
         // make sure the watchers have been processed
-        while((rc=zookeeper_process(zh,ZOOKEEPER_READ))==ZOK);
+        while((rc=zookeeper_process(zh,ZOOKEEPER_READ))==ZOK) {
+          millisleep(100);
+        }
         CPPUNIT_ASSERT_EQUAL((int)ZNOTHING,rc);
 
         CPPUNIT_ASSERT_EQUAL(0,wobject1.counter_);



Mime
View raw message