- revert plugin move. Add new identity-token
[oweals/gnunet.git] / src / integration-tests / gnunet_testing.py.in
index 25379724987ee8ff73aef7723f2f4064c1e0b344..7cead069b3743db4b05de2da9acc790241913e48 100644 (file)
@@ -14,8 +14,8 @@
 #
 #    You should have received a copy of the GNU General Public License
 #    along with GNUnet; see the file COPYING.  If not, write to the
-#    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#    Boston, MA 02111-1307, USA.
+#    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+#    Boston, MA 02110-1301, USA.
 #
 # Functions for integration testing
 import os
@@ -50,11 +50,16 @@ class Check:
             res = self.run()
             time.sleep(1)
             execs += 1
-        if (res == False):
-            neg_cont (self)
+        if ((False == res) and (execs >= timeout)):
+           print ('Check had timeout after ' +str(timeout)+ ' seconds')
+           neg_cont (self)
+        elif ((False == res) and (execs < timeout)):
+            if (None != neg_cont):
+                neg_cont (self)
         else:
-            pos_cont (self)
-        return res            
+            if (None != pos_cont):
+                pos_cont (self)
+        return res     
     def run_once (self, pos_cont, neg_cont):
         execs = 0;
         res = False
@@ -147,10 +152,8 @@ class StatisticsCondition (Condition):
         else: 
             fail = ""
             op = " == "
-        if ((self.fulfilled == False) and (failed_only == True)):
+        if (((self.fulfilled == False) and (failed_only == True)) or (failed_only == False)):
             print self.peer.id[:4] + " " +self.peer.cfg + " " +  str(self.type) + ' condition in subsystem "' + self.subsystem.ljust(12) +'" : "' + self.name.ljust(30) +'" : (expected/real value) ' + str(self.value) + op + res + fail
-        elif (failed_only == False): 
-            print self.peer.id[:4] + " " +self.peer.cfg + " " +  str(self.type) + ' condition in subsystem "' + self.subsystem.ljust(12) +'" : "' + self.name.ljust(30) +'" : (expected/real value) ' + str(self.value) + op + res + fail 
         return self.fulfilled    
 
 # Specify two statistic values and check if they are equal  
@@ -192,11 +195,8 @@ class EqualStatisticsCondition (Condition):
         else: 
             fail = ""
             op = " == "
-        if ((self.fulfilled == False) and (failed_only == True)):
-            print self.peer.id[:4] + " "  + self.subsystem.ljust(12) + " " + str(self.result) +" " + self.peer2.id[:4] + " "  + self.subsystem2.ljust(12) + " " + str(self.result2) 
-            #print self.peer.id[:4] + " " + str(self.type) + ' condition in subsystem "' + self.subsystem.ljust(12) +'" : "' + self.name.ljust(30) +'" : (expected/real value) ' + str(self.value) + op + res + fail
-        elif (failed_only == False): 
-            print self.peer.id[:4] + " "  + self.subsystem.ljust(12) + " " + str(self.result) +" " + self.peer2.id[:4] + " "  + self.subsystem2.ljust(12) + " " + str(self.result2) 
+        if (((self.fulfilled == False) and (failed_only == True)) or (failed_only == False)):
+            print self.peer.id[:4] + ' "'  + self.subsystem.ljust(12) + '" "' + self.name.ljust(30) + '" == ' + str(self.result) +" " + self.peer2.id[:4] + ' "'  + self.subsystem2.ljust(12) + '" '+ self.name2.ljust(30) +  '" ' + str(self.result2) 
         return self.fulfilled                    
         
 class Test: