commented out wrong message type
[oweals/gnunet.git] / src / statistics / test_gnunet_statistics.py.in
index b5697d246c61a6b168188511c6a4be988f51d570..86d0258f413d7e2c3f1c772274e4471a9c8f36e8 100644 (file)
@@ -13,10 +13,10 @@ else:
   tmp = "/tmp"
 
 if os.name == 'nt':
-  st = 'gnunet-statistics.exe'
+  st = './gnunet-statistics.exe'
   arm = 'gnunet-arm.exe'
 else:
-  st = 'gnunet-statistics'
+  st = './gnunet-statistics'
   arm = 'gnunet-arm'
 
 run_st = [st, '-c', 'test_statistics_api_data.conf']
@@ -26,7 +26,7 @@ if debug:
   run_arm += [debug.split (' ')]
 
 def cleanup ():
-  shutil.rmtree (os.path.join (tmp, "test-gnunetd-statistics"), True)
+  shutil.rmtree (os.path.join (tmp, "test-gnunet-statistics"), True)
 
 def sub_run (args, want_stdo = True, want_stde = False, nofail = False):
   if want_stdo:
@@ -71,7 +71,6 @@ def restart ():
   time.sleep (1)
   t = r_arm (['-i', 'statistics'])
   time.sleep (1)
-  print ("DONE")
 
 
 cleanup ()
@@ -81,18 +80,17 @@ t = r_arm (['-s'], want_stdo = False)
 time.sleep (1)
 t = r_arm (['-i', 'statistics'], want_stdo = False)
 time.sleep (1)
-print ("DONE")
 
 print ("TEST: Bad argument checking...", end='')
-r_st (['-x'], normal = False, nofail = True, want_stdo = False)
+r_st (['-x'], normal = False, nofail = True, want_stdo = False, want_stde = True)
 print ("PASS")
 
 print ("TEST: Set value...", end='')
-r_st (['-n', 'test', '-s', 'subsystem', '42'], nofail = True, want_stdo = False)
+r_st (['-n', 'test', '-s', 'subsystem', b'42'], nofail = True, want_stdo = False)
 print ("PASS")
 
 print ("TEST: Set another value...", end='')
-r_st (['-n', 'other', '-s', 'osystem', '43'], nofail = True, want_stdo = False)
+r_st (['-n', 'other', '-s', 'osystem', b'43'], nofail = True, want_stdo = False)
 print ("PASS")
 
 print ("TEST: Viewing all stats...", end='')
@@ -103,20 +101,20 @@ print ("PASS")
 
 print ("TEST: Viewing stats by name...", end='')
 rc, stdo, stde = r_st (['-n', 'other'], nofail = True, want_stdo = True)
-if len ([x for x in stdo.splitlines () if re.search ('43', x)]) != 1:
+if len ([x for x in stdo.splitlines () if re.search (b'43', x)]) != 1:
   fail ("FAIL: unexpected output:\n{}".format (stdo))
 print ("PASS")
 
 print ("TEST: Viewing stats by subsystem...", end='')
 rc, stdo, stde = r_st (['-s', 'subsystem'], nofail = True, want_stdo = True)
-if len ([x for x in stdo.splitlines () if re.search ('42', x)]) != 1:
+if len ([x for x in stdo.splitlines () if re.search (b'42', x)]) != 1:
   fail ("FAIL: unexpected output:\n{}".format (stdo))
 print ("PASS")
 
 print ("TEST: Set persistent value...", end='')
 rc, stdo, stde = r_st (['-n', 'lasting', '-s', 'subsystem', '40', '-p'], nofail = True, want_stdo = False)
 rc, stdo, stde = r_st ([], nofail = True, want_stdo = True)
-if len ([x for x in stdo.splitlines () if re.search ('40', x)]) != 1:
+if len ([x for x in stdo.splitlines () if re.search (b'40', x)]) != 1:
   fail ("FAIL: unexpected output:\n{}".format (stdo))
 print ("PASS")
 
@@ -124,14 +122,14 @@ restart ()
 
 print ("TEST: Checking persistence...", end='')
 rc, stdo, stde = r_st ([], nofail = True, want_stdo = True)
-if len ([x for x in stdo.splitlines () if re.search ('40', x)]) != 1:
+if len ([x for x in stdo.splitlines () if re.search (b'40', x)]) != 1:
   fail ("FAIL: unexpected output:\n{}".format (stdo))
 print ("PASS")
 
 print ("TEST: Removing persistence...", end='')
 rc, stdo, stde = r_st (['-n', 'lasting', '-s', 'subsystem', '40'], nofail = True, want_stdo = False)
 rc, stdo, stde = r_st ([], nofail = True, want_stdo = True)
-if len ([x for x in stdo.splitlines () if re.search ('!', x)]) != 0:
+if len ([x for x in stdo.splitlines () if re.search (b'!', x)]) != 0:
   fail ("FAIL: unexpected output:\n{}".format (stdo))
 print ("PASS")
 
@@ -139,13 +137,12 @@ restart ()
 
 print ("TEST: Checking removed persistence...", end='')
 rc, stdo, stde = r_st ([], nofail = True, want_stdo = True)
-if len ([x for x in stdo.splitlines () if re.search ('40', x)]) != 0:
+if len ([x for x in stdo.splitlines () if re.search (b'40', x)]) != 0:
   fail ("FAIL: unexpected output:\n{}".format (stdo))
 print ("PASS")
 
 print ("Stopping service...")
 t = r_arm (['-e'], want_stdo = False)
 time.sleep (1)
-print ("DONE")
 
 cleanup ()