aboutsummaryrefslogtreecommitdiff
path: root/src/dht/test_dht_tools.py.in
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/test_dht_tools.py.in')
-rw-r--r--src/dht/test_dht_tools.py.in18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/dht/test_dht_tools.py.in b/src/dht/test_dht_tools.py.in
index 20739c45f..84e297081 100644
--- a/src/dht/test_dht_tools.py.in
+++ b/src/dht/test_dht_tools.py.in
@@ -72,10 +72,10 @@ def fail(result):
72 cleanup(1) 72 cleanup(1)
73 73
74 74
75def r_something(to_run, extra_args, failer=None, normal=True, **kw): 75def r_something(to_run, extra_args, failure=None, normal=True, **kw):
76 rc, stdo, stde = sub_run(to_run + extra_args, nofail=True, **kw) 76 rc, stdo, stde = sub_run(to_run + extra_args, nofail=True, **kw)
77 if failer is not None: 77 if failure is not None:
78 failer(to_run + extra_args, rc, stdo, stde, normal) 78 failure(to_run + extra_args, rc, stdo, stde, normal)
79 return (rc, stdo, stde) 79 return (rc, stdo, stde)
80 80
81 81
@@ -91,7 +91,7 @@ def r_put(extra_args, **kw):
91 return r_something(run_put, extra_args, **kw) 91 return r_something(run_put, extra_args, **kw)
92 92
93 93
94def end_arm_failer(command, rc, stdo, stde, normal): 94def end_arm_failure(command, rc, stdo, stde, normal):
95 if normal: 95 if normal:
96 if rc != 0: 96 if rc != 0:
97 fail( 97 fail(
@@ -107,7 +107,7 @@ def end_arm_failer(command, rc, stdo, stde, normal):
107 ) 107 )
108 108
109 109
110def print_only_failer(command, rc, stdo, stde, normal): 110def print_only_failure(command, rc, stdo, stde, normal):
111 if normal: 111 if normal:
112 if rc != 0: 112 if rc != 0:
113 print( 113 print(
@@ -126,19 +126,19 @@ def print_only_failer(command, rc, stdo, stde, normal):
126 126
127 127
128print("TEST: Starting ARM...", end='') 128print("TEST: Starting ARM...", end='')
129r_arm(['-s'], failer=end_arm_failer, want_stdo=False, want_stde=False) 129r_arm(['-s'], failure=end_arm_failure, want_stdo=False, want_stde=False)
130print("PASS") 130print("PASS")
131time.sleep(1) 131time.sleep(1)
132 132
133print("TEST: Testing put...", end='') 133print("TEST: Testing put...", end='')
134r_put(['-k', 'testkey', '-d', 'testdata', '-t', '8'], failer=end_arm_failer) 134r_put(['-k', 'testkey', '-d', 'testdata', '-t', '8'], failure=end_arm_failure)
135print("PASS") 135print("PASS")
136time.sleep(1) 136time.sleep(1)
137 137
138print("TEST: Testing get...", end='') 138print("TEST: Testing get...", end='')
139rc, stdo, stde = r_get(['-k', 'testkey', '-T', '50 ms', '-t', '8'], 139rc, stdo, stde = r_get(['-k', 'testkey', '-T', '50 ms', '-t', '8'],
140 want_stdo=True, 140 want_stdo=True,
141 failer=end_arm_failer) 141 failure=end_arm_failure)
142stdo = stdo.decode('utf-8').replace('\r', '').splitlines() 142stdo = stdo.decode('utf-8').replace('\r', '').splitlines()
143expect = "Result 0, type 8:\ntestdata".splitlines() 143expect = "Result 0, type 8:\ntestdata".splitlines()
144if len(stdo) != 2 or len(expect 144if len(stdo) != 2 or len(expect
@@ -146,4 +146,4 @@ if len(stdo) != 2 or len(expect
146 fail("output `{}' differs from expected `{}'".format(stdo, expect)) 146 fail("output `{}' differs from expected `{}'".format(stdo, expect))
147print("PASS") 147print("PASS")
148 148
149r_arm(['-e', '-d'], failer=print_only_failer) 149r_arm(['-e', '-d'], failure=print_only_failure)