diff options
Diffstat (limited to 'src/dht')
-rw-r--r-- | src/dht/test_dht_tools.py.in | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/dht/test_dht_tools.py.in b/src/dht/test_dht_tools.py.in index 2d9379a42..c2f95e4b5 100644 --- a/src/dht/test_dht_tools.py.in +++ b/src/dht/test_dht_tools.py.in | |||
@@ -94,20 +94,34 @@ def r_put(extra_args, **kw): | |||
94 | def end_arm_failer(command, rc, stdo, stde, normal): | 94 | def end_arm_failer(command, rc, stdo, stde, normal): |
95 | if normal: | 95 | if normal: |
96 | if rc != 0: | 96 | if rc != 0: |
97 | fail("FAIL: error running {}\nCommand output was:\n{}\n{}".format(command, stdo, stde)) | 97 | fail( |
98 | "FAIL: error running {}\nCommand output was:\n{}\n{}".format( | ||
99 | command, stdo, stde | ||
100 | ) | ||
101 | ) | ||
98 | else: | 102 | else: |
99 | if rc == 0: | 103 | if rc == 0: |
100 | fail("FAIL: expected error while running {}\nCommand output was:\n{}\n{}".format(command, stdo, stde)) | 104 | fail( |
105 | "FAIL: expected error while running {}\nCommand output was:\n{}\n{}" | ||
106 | .format(command, stdo, stde) | ||
107 | ) | ||
101 | 108 | ||
102 | 109 | ||
103 | def print_only_failer(command, rc, stdo, stde, normal): | 110 | def print_only_failer(command, rc, stdo, stde, normal): |
104 | if normal: | 111 | if normal: |
105 | if rc != 0: | 112 | if rc != 0: |
106 | print("FAIL: error running {}\nCommand output was:\n{}\n{}".format(command, stdo, stde)) | 113 | print( |
114 | "FAIL: error running {}\nCommand output was:\n{}\n{}".format( | ||
115 | command, stdo, stde | ||
116 | ) | ||
117 | ) | ||
107 | cleanup(1) | 118 | cleanup(1) |
108 | else: | 119 | else: |
109 | if rc == 0: | 120 | if rc == 0: |
110 | print("FAIL: expected error while running {}\nCommand output was:\n{}\n{}".format(command, stdo, stde)) | 121 | print( |
122 | "FAIL: expected error while running {}\nCommand output was:\n{}\n{}" | ||
123 | .format(command, stdo, stde) | ||
124 | ) | ||
111 | cleanup(1) | 125 | cleanup(1) |
112 | 126 | ||
113 | 127 | ||
@@ -122,10 +136,13 @@ print("PASS") | |||
122 | time.sleep(1) | 136 | time.sleep(1) |
123 | 137 | ||
124 | print("TEST: Testing get...", end='') | 138 | print("TEST: Testing get...", end='') |
125 | rc, stdo, stde = r_get(['-k', 'testkey', '-T', '50 ms', '-t', '8'], want_stdo=True, failer=end_arm_failer) | 139 | rc, stdo, stde = r_get(['-k', 'testkey', '-T', '50 ms', '-t', '8'], |
140 | want_stdo=True, | ||
141 | failer=end_arm_failer) | ||
126 | stdo = stdo.decode('utf-8').replace('\r', '').splitlines() | 142 | stdo = stdo.decode('utf-8').replace('\r', '').splitlines() |
127 | expect = "Result 0, type 8:\ntestdata".splitlines() | 143 | expect = "Result 0, type 8:\ntestdata".splitlines() |
128 | if len(stdo) != 2 or len(expect) != 2 or stdo[0] != expect[0] or stdo[1] != expect[1]: | 144 | if len(stdo) != 2 or len(expect |
145 | ) != 2 or stdo[0] != expect[0] or stdo[1] != expect[1]: | ||
129 | fail("output `{}' differs from expected `{}'".format(stdo, expect)) | 146 | fail("output `{}' differs from expected `{}'".format(stdo, expect)) |
130 | print("PASS") | 147 | print("PASS") |
131 | 148 | ||