gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r18526 - gnunet/src/integration-tests


From: gnunet
Subject: [GNUnet-SVN] r18526 - gnunet/src/integration-tests
Date: Fri, 9 Dec 2011 13:41:18 +0100

Author: wachs
Date: 2011-12-09 13:41:18 +0100 (Fri, 09 Dec 2011)
New Revision: 18526

Modified:
   gnunet/src/integration-tests/test_integration_bootstrap_and_connect.py.in
Log:
test now checks if boths transports are connecting


Modified: 
gnunet/src/integration-tests/test_integration_bootstrap_and_connect.py.in
===================================================================
--- gnunet/src/integration-tests/test_integration_bootstrap_and_connect.py.in   
2011-12-09 10:40:59 UTC (rev 18525)
+++ gnunet/src/integration-tests/test_integration_bootstrap_and_connect.py.in   
2011-12-09 12:41:18 UTC (rev 18526)
@@ -24,7 +24,11 @@
 import re
 import shutil
 import time
+import pexpect
 
+
+
+
 #
 # This test tests if a fresh peer bootstraps from a hostlist server and then
 # successfully connects to the server 
@@ -35,33 +39,46 @@
 testname = "test_integration_bootstrap_and_connect"
 verbose = True
 gnunetarm = ""
+gnunetstatistics = ""
 #fix this!
-success = True
-timeout = 2
+success = False
+timeout = 10
 
+#test conditions
+
+#server
+server_transport_connected = False
+server_topology_connected = False
+server_core_connected = False
+
+client_transport_connected = False
+client_topology_connected = False
+client_core_connected = False
+
+
 def vprintf (msg):
     if verbose == True:
         print msg
 
 def setup ():
-       srcdir = "../.."
-       gnunet_pyexpect_dir = os.path.join (srcdir, "contrib")
-       if gnunet_pyexpect_dir not in sys.path:
-         sys.path.append (gnunet_pyexpect_dir)
-       
-       from gnunet_pyexpect import pexpect
+  srcdir = "../.."
+  gnunet_pyexpect_dir = os.path.join (srcdir, "contrib")
+  if gnunet_pyexpect_dir not in sys.path:
+    sys.path.append (gnunet_pyexpect_dir)
+  from gnunet_pyexpect import pexpect
+  global gnunetarm     
+  global gnunetstatistics
+  if os.name == 'posix':
+    gnunetarm = 'gnunet-arm'
+    gnunetstatistics = 'gnunet-statistics'
+  elif os.name == 'nt':
+    gnunetarm = 'gnunet-arm.exe'
+    gnunetstatistics = 'gnunet-statistics.exe'    
+  if os.name == "nt":
+    shutil.rmtree (os.path.join (os.getenv ("TEMP"), testname), True)
+  else:
+    shutil.rmtree ("/tmp/" + testname, True)
 
-       global gnunetarm        
-       if os.name == 'posix':
-         gnunetarm = 'gnunet-arm'
-       elif os.name == 'nt':
-         gnunetarm = 'gnunet-arm.exe'
-       
-       if os.name == "nt":
-         shutil.rmtree (os.path.join (os.getenv ("TEMP"), testname), True)
-       else:
-         shutil.rmtree ("/tmp/" + testname, True)
-
 def start ():
        vprintf ("Starting bootstrap server & client")
        try:
@@ -101,14 +118,33 @@
        else:
            shutil.rmtree ("/tmp/gnunet-test-fs-py-ns", True)
 
+def check_statistics (conf, subsystem, name, value):
+    from gnunet_pyexpect import pexpect
+    server = pexpect ()
+    server.spawn (None, [gnunetstatistics, '-c', conf ,'-q','-n', name, '-s', 
subsystem ], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+    #server.expect ("stdout", re.compile (r""))
+    test = server.read("stdout", 10240)
+    if (test.find(str(value)) == -1): 
+        return False
+    else:
+        return True 
+    
+    
+
 def check ():
-       global success
-       global timeout
-       count = 1
+  global success
+  global timeout
+  global publish
 
-       while ((success == False) and (count < timeout)):
-               time.sleep(1)
-               count += 1 
+  count = 1
+  print 'check'
+  while ((success == False) and (count <= timeout)):
+    if (True == check_statistics ('./confs/c_bootstrap_server.conf', 
'transport', '# peers connected',1)):
+        vprintf ('Server transport services is connected')
+    if (True == check_statistics ('./confs/c_no_nat_client.conf', 'transport', 
'# peers connected',1)):
+        vprintf ('Client transport services is connected')           
+    time.sleep(1)
+    count += 1 
 
 # 
 # Test execution
@@ -120,7 +156,7 @@
 
 check ()
 
-stop ()
+#stop ()
 cleanup ()
 
 if (success == False):
@@ -131,3 +167,4 @@
        exit (0)
 
 
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]