@@ -142,13 +142,15 @@ class WorkerTaskResult(BaseWorkerMessage):
142
142
""" Passed into the result queue when a task processed (done) by the
143
143
worker. The short_status (string) field intended to give short note whether
144
144
the task processed successfully or not, but with little more flexibility
145
- than binary True/False. The task_id (any hashable object) field hold ID of
145
+ than binary True/False. The result_checksum (string) field saves the results
146
+ file checksum on test fail. The task_id (any hashable object) field hold ID of
146
147
the processed task. The show_reproduce_content configuration form suite.ini
147
148
"""
148
149
def __init__ (self , worker_id , worker_name , task_id ,
149
- short_status , show_reproduce_content ):
150
+ short_status , result_checksum , show_reproduce_content ):
150
151
super (WorkerTaskResult , self ).__init__ (worker_id , worker_name )
151
152
self .short_status = short_status
153
+ self .result_checksum = result_checksum
152
154
self .task_id = task_id
153
155
self .show_reproduce_content = show_reproduce_content
154
156
@@ -214,8 +216,9 @@ def current_task(self, task_id):
214
216
return WorkerCurrentTask (self .id , self .name , task_name , task_param ,
215
217
task_result , task_tmp_result )
216
218
217
- def wrap_result (self , task_id , short_status ):
219
+ def wrap_result (self , task_id , short_status , result_checksum ):
218
220
return WorkerTaskResult (self .id , self .name , task_id , short_status ,
221
+ result_checksum ,
219
222
self .suite .show_reproduce_content ())
220
223
221
224
def sigterm_handler (self , signum , frame ):
@@ -302,7 +305,7 @@ def run_task(self, task_id):
302
305
with open (self .reproduce_file , 'a' ) as f :
303
306
task_id_str = yaml .safe_dump (task .id , default_flow_style = True )
304
307
f .write ('- ' + task_id_str )
305
- short_status = self .suite .run_test (
308
+ short_status , result_checksum = self .suite .run_test (
306
309
task , self .server , self .inspector )
307
310
except KeyboardInterrupt :
308
311
self .report_keyboard_interrupt ()
@@ -312,7 +315,7 @@ def run_task(self, task_id):
312
315
'\n Worker "%s" received the following error; stopping...\n '
313
316
% self .name + traceback .format_exc () + '\n ' , schema = 'error' )
314
317
raise
315
- return short_status
318
+ return short_status , result_checksum
316
319
317
320
def run_loop (self , task_queue , result_queue ):
318
321
""" called from 'run_all' """
@@ -327,21 +330,29 @@ def run_loop(self, task_queue, result_queue):
327
330
break
328
331
329
332
short_status = None
333
+ result_checksum = None
330
334
result_queue .put (self .current_task (task_id ))
335
+ testname = os .path .basename (task_id [0 ])
336
+ fragile_checksums = self .suite .get_test_fragile_checksums (testname )
331
337
retries_left = self .suite .fragile_retries ()
332
338
# let's run till short_status became 'pass'
333
339
while short_status != 'pass' and retries_left >= 0 :
334
340
# print message only after some fails occurred
335
341
if short_status == 'fail' :
336
342
color_stdout (
337
343
'Test "%s", conf: "%s"\n '
338
- '\t from "fragile" list failed, rerunning ...\n '
339
- % (task_id [0 ], task_id [1 ]), schema = 'error' )
344
+ '\t from "fragile" list failed with results'
345
+ ' file checksum: "%s", rerunning ...\n '
346
+ % (task_id [0 ], task_id [1 ], result_checksum ), schema = 'error' )
340
347
# run task and save the result to short_status
341
- short_status = self .run_task (task_id )
348
+ short_status , result_checksum = self .run_task (task_id )
349
+ # check if the results file checksum set on fail and if
350
+ # the newly created results file is known by checksum
351
+ if not result_checksum or (result_checksum not in fragile_checksums ):
352
+ break
342
353
retries_left = retries_left - 1
343
354
344
- result_queue .put (self .wrap_result (task_id , short_status ))
355
+ result_queue .put (self .wrap_result (task_id , short_status , result_checksum ))
345
356
if not lib .Options ().args .is_force and short_status == 'fail' :
346
357
color_stdout (
347
358
'Worker "%s" got failed test; stopping the server...\n '
0 commit comments