Skip to content

Commit e1a1f97

Browse files
committed
Drop 'checksum' machinery
It looks like the 'checksum' machinery is dead, so let's remove it. Closes #316
1 parent 1689f58 commit e1a1f97

File tree

5 files changed

+26
-39
lines changed

5 files changed

+26
-39
lines changed

lib/test.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import sys
88
import traceback
99
from functools import partial
10-
from hashlib import md5
1110

1211
from lib import Options
1312
from lib.colorer import color_stdout
@@ -167,7 +166,7 @@ def run(self, server):
167166
it to stdout.
168167
169168
Returns short status of the test as a string: 'skip', 'pass',
170-
'new', 'updated' or 'fail' and results file checksum on fail.
169+
'new', 'updated' or 'fail'.
171170
There is also one possible value for short_status, 'disabled',
172171
but it returned in the caller, TestSuite.run_test().
173172
"""
@@ -237,7 +236,6 @@ def run(self, server):
237236
self.is_valgrind_clean = not bool(non_empty_logs)
238237

239238
short_status = None
240-
result_checksum = None
241239

242240
if self.skip:
243241
short_status = 'skip'
@@ -272,8 +270,6 @@ def run(self, server):
272270
if has_result:
273271
safe_makedirs(self.var_suite_path)
274272
shutil.copy(self.tmp_result, self.reject)
275-
with open(self.tmp_result, mode='rb') as result_file:
276-
result_checksum = md5(result_file.read()).hexdigest()
277273
short_status = 'fail'
278274
color_stdout("[ fail ]\n", schema='test_fail')
279275

@@ -299,7 +295,7 @@ def run(self, server):
299295
"Test failed! Output from log file "
300296
"{0}:\n".format(log_file))
301297
where = ": there were warnings in the valgrind log file(s)"
302-
return short_status, result_checksum
298+
return short_status
303299

304300
def print_diagnostics(self, log_file, message):
305301
"""Print whole lines of client program output leading to test

lib/test_suite.py

+3-10
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,6 @@ def fragile_tests(self):
205205
res.append(test)
206206
return res
207207

208-
def get_test_fragile_checksums(self, test):
209-
try:
210-
return self.fragile['tests'][test]['checksums']
211-
except Exception:
212-
return []
213-
214208
def gen_server(self):
215209
try:
216210
return Server(self.ini, test_suite=self)
@@ -263,7 +257,7 @@ def stop_server(self, server, inspector, silent=False, cleanup=True):
263257

264258
def run_test(self, test, server, inspector):
265259
""" Returns short status of the test as a string: 'skip', 'pass',
266-
'new', 'fail', or 'disabled' and results file checksum on fail.
260+
'new', 'fail', or 'disabled'.
267261
"""
268262
test.inspector = inspector
269263
test_name = os.path.basename(test.name)
@@ -278,18 +272,17 @@ def run_test(self, test, server, inspector):
278272

279273
start_time = time.time()
280274
if self.is_test_enabled(test, conf, server):
281-
short_status, result_checksum = test.run(server)
275+
short_status = test.run(server)
282276
else:
283277
color_stdout("[ disabled ]\n", schema='t_name')
284278
short_status = 'disabled'
285-
result_checksum = None
286279
duration = time.time() - start_time
287280

288281
# cleanup only if test passed or if --force mode enabled
289282
if Options().args.is_force or short_status == 'pass':
290283
inspector.cleanup_nondefault()
291284

292-
return short_status, result_checksum, duration
285+
return short_status, duration
293286

294287
def is_parallel(self):
295288
return self.ini['is_parallel']

lib/worker.py

+18-18
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
import functools
44
import os
55
import signal
6+
import textwrap
67
import traceback
78
import yaml
89
from datetime import datetime
910

1011
from lib import Options
12+
from lib.colorer import qa_notice
1113
from lib.colorer import color_log
1214
from lib.colorer import color_stdout
1315
from lib.tarantool_server import TarantoolServer
@@ -143,17 +145,15 @@ class WorkerTaskResult(BaseWorkerMessage):
143145
""" Passed into the result queue when a task processed (done) by the
144146
worker. The short_status (string) field intended to give short note whether
145147
the task processed successfully or not, but with little more flexibility
146-
than binary True/False. The result_checksum (string) field saves the results
147-
file checksum on test fail. The task_id (any hashable object) field hold ID of
148+
than binary True/False. The task_id (any hashable object) field hold ID of
148149
the processed task. The is_long (boolean) field shows if task is in long test
149150
list in suite.ini. The duration (float) field saves the task run time. The
150151
show_reproduce_content configuration from suite.ini.
151152
"""
152153
def __init__(self, worker_id, worker_name, task_id,
153-
short_status, result_checksum, is_long, duration, show_reproduce_content):
154+
short_status, is_long, duration, show_reproduce_content):
154155
super(WorkerTaskResult, self).__init__(worker_id, worker_name)
155156
self.short_status = short_status
156-
self.result_checksum = result_checksum
157157
self.task_id = task_id
158158
self.is_long = is_long
159159
self.duration = duration
@@ -222,9 +222,8 @@ def current_task(self, task_id):
222222
return WorkerCurrentTask(self.id, self.name, task_name, task_param,
223223
task_result, task_tmp_result)
224224

225-
def wrap_result(self, task_id, short_status, result_checksum, duration):
225+
def wrap_result(self, task_id, short_status, duration):
226226
return WorkerTaskResult(self.id, self.name, task_id, short_status,
227-
result_checksum,
228227
self.suite.test_is_long(task_id), duration,
229228
self.suite.show_reproduce_content())
230229

@@ -317,7 +316,7 @@ def run_task(self, task_id):
317316
with open(self.reproduce_file, 'a') as f:
318317
task_id_str = yaml.safe_dump(task.id, default_flow_style=True)
319318
f.write('- ' + task_id_str)
320-
short_status, result_checksum, duration = self.suite.run_test(
319+
short_status, duration = self.suite.run_test(
321320
task, self.server, self.inspector)
322321
except KeyboardInterrupt:
323322
self.report_keyboard_interrupt()
@@ -327,7 +326,7 @@ def run_task(self, task_id):
327326
'\nWorker "%s" received the following error; stopping...\n'
328327
% self.name + traceback.format_exc() + '\n', schema='error')
329328
raise
330-
return short_status, result_checksum, duration
329+
return short_status, duration
331330

332331
def run_loop(self, task_queue, result_queue):
333332
""" called from 'run_all' """
@@ -342,11 +341,15 @@ def run_loop(self, task_queue, result_queue):
342341
break
343342

344343
short_status = None
345-
result_checksum = None
346344
duration = 0.0
347345
result_queue.put(self.current_task(task_id))
348346
testname = os.path.basename(task_id[0])
349-
fragile_checksums = self.suite.get_test_fragile_checksums(testname)
347+
if self.suite.fragile['tests'].get(testname, {}).get('checksums'):
348+
qa_notice(
349+
textwrap.fill('Test "%s" from "fragile" list has checksums '
350+
'defined in suite.ini but this functionality '
351+
'is dropped' % testname)
352+
)
350353
retries_left = self.suite.fragile_retries()
351354
# let's run till short_status became 'pass'
352355
while short_status != 'pass' and retries_left >= 0:
@@ -355,18 +358,15 @@ def run_loop(self, task_queue, result_queue):
355358
if short_status == 'fail':
356359
color_stdout(
357360
'Test "%s", conf: "%s"\n'
358-
'\tfrom "fragile" list failed with results'
359-
' file checksum: "%s", rerunning ...\n'
360-
% (task_id[0], task_id[1], result_checksum), schema='error')
361+
'\tfrom "fragile" list failed, rerunning ...\n'
362+
% (task_id[0], task_id[1]), schema='error')
361363
# run task and save the result to short_status
362-
short_status, result_checksum, duration = self.run_task(task_id)
363-
# check if the results file checksum set on fail and if
364-
# the newly created results file is known by checksum
365-
if not result_checksum or (result_checksum not in fragile_checksums):
364+
short_status, duration = self.run_task(task_id)
365+
if testname not in self.suite.fragile['tests']:
366366
break
367367
retries_left = retries_left - 1
368368

369-
result_queue.put(self.wrap_result(task_id, short_status, result_checksum, duration))
369+
result_queue.put(self.wrap_result(task_id, short_status, duration))
370370
if short_status == 'fail':
371371
if Options().args.is_force:
372372
self.restart_server()

listeners.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ def process_result(self, obj):
5555
if obj.short_status == 'fail':
5656
self.failed_tasks.append((obj.task_id,
5757
obj.worker_name,
58-
obj.result_checksum,
5958
obj.show_reproduce_content))
6059

6160
self.duration_stats[obj.task_id] = obj.duration
@@ -163,11 +162,10 @@ def print_statistics(self):
163162
return False
164163

165164
color_stdout('Failed tasks:\n', schema='test_var')
166-
for task_id, worker_name, result_checksum, show_reproduce_content in self.failed_tasks:
165+
for task_id, worker_name, show_reproduce_content in self.failed_tasks:
167166
logfile = self.get_logfile(worker_name)
168167
task_id_str = yaml.safe_dump(task_id, default_flow_style=True)
169168
color_stdout('- %s' % task_id_str, schema='test_var')
170-
color_stdout('# results file checksum: %s\n' % result_checksum)
171169
color_stdout('# logfile: %s\n' % logfile)
172170
reproduce_file_path = get_reproduce_file(worker_name)
173171
color_stdout('# reproduce file: %s\n' % reproduce_file_path)

test-run.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ def main_loop_consistent(failed_test_ids):
175175
worker_id = 1
176176
worker = task_group['gen_worker'](worker_id)
177177
for task_id in task_ids:
178-
# The 'run_task' method returns a tuple of three items:
179-
# (short_status, result_checksum, duration). So taking the first
178+
# The 'run_task' method returns a tuple of two items:
179+
# (short_status, duration). So taking the first
180180
# item of this tuple for failure check.
181181
short_status = worker.run_task(task_id)[0]
182182
if short_status == 'fail':

0 commit comments

Comments
 (0)