@@ -214,11 +214,9 @@ def delete_file(file_path):
214
214
result = False
215
215
return result , resutl_msg
216
216
217
- def handle (self , test_spec , target_name , toolchain_name ):
218
- """
219
- Function determines MUT's mbed disk/port and copies binary to
220
- target. Test is being invoked afterwards.
221
- """
217
+ def handle (self , test_spec , target_name , toolchain_name , test_loops = 1 ):
218
+ """ Function determines MUT's mbed disk/port and copies binary to
219
+ target. Test is being invoked afterwards. """
222
220
data = json .loads (test_spec )
223
221
# Get test information, image and test timeout
224
222
test_id = data ['test_id' ]
@@ -257,29 +255,33 @@ def handle(self, test_spec, target_name, toolchain_name):
257
255
if not disk .endswith ('/' ) and not disk .endswith ('\\ ' ):
258
256
disk += '/'
259
257
260
- # Choose one method of copy files to mbed virtual drive
261
- _copy_res , _err_msg , _copy_method = self .file_copy_method_selector (image_path , disk , opts .copy_method )
258
+ # Tests can be looped so test results must be stored for the same test
259
+ test_all_result = []
260
+ for test_index in range (test_loops ):
261
+ # Choose one method of copy files to mbed virtual drive
262
+ _copy_res , _err_msg , _copy_method = self .file_copy_method_selector (image_path , disk , opts .copy_method )
262
263
263
- # Host test execution
264
- start_host_exec_time = time ()
265
-
266
- if not _copy_res : # Serial port copy error
267
- test_result = "IOERR_COPY"
268
- print "Error: Copy method '%s'. %s" % (_copy_method , _err_msg )
269
- else :
270
- # Copy Extra Files
271
- if not target_by_mcu .is_disk_virtual and test .extra_files :
272
- for f in test .extra_files :
273
- copy (f , disk )
274
-
275
- sleep (target_by_mcu .program_cycle_s ())
276
264
# Host test execution
277
265
start_host_exec_time = time ()
278
- test_result = self .run_host_test (test .host_test , disk , port , duration , opts .verbose )
279
266
280
- elapsed_time = time () - start_host_exec_time
281
- print print_test_result (test_result , target_name , toolchain_name ,
282
- test_id , test_description , elapsed_time , duration )
267
+ if not _copy_res : # Serial port copy error
268
+ test_result = "IOERR_COPY"
269
+ print "Error: Copy method '%s'. %s" % (_copy_method , _err_msg )
270
+ else :
271
+ # Copy Extra Files
272
+ if not target_by_mcu .is_disk_virtual and test .extra_files :
273
+ for f in test .extra_files :
274
+ copy (f , disk )
275
+
276
+ sleep (target_by_mcu .program_cycle_s ())
277
+ # Host test execution
278
+ start_host_exec_time = time ()
279
+ test_result = self .run_host_test (test .host_test , disk , port , duration , opts .verbose )
280
+ test_all_result .append (test_result )
281
+
282
+ elapsed_time = time () - start_host_exec_time
283
+ print print_test_result (test_result , target_name , toolchain_name ,
284
+ test_id , test_description , elapsed_time , duration )
283
285
return (test_result , target_name , toolchain_name ,
284
286
test_id , test_description , round (elapsed_time , 2 ), duration )
285
287
@@ -759,6 +761,14 @@ def generate_test_summary(test_summary):
759
761
action = "store_true" ,
760
762
help = 'Displays full test specification and MUTs configration and exits' )
761
763
764
+ parser .add_option ('' , '--loops' ,
765
+ dest = 'test_loops_list' ,
766
+ help = 'Set no. of loops per test. Format: TEST_1=1,TEST_2=2,TEST_3=3' )
767
+
768
+ parser .add_option ('' , '--global-loops' ,
769
+ dest = 'test_global_loops_value' ,
770
+ help = 'Set global number of test loops per test. Default value is set 1' )
771
+
762
772
parser .add_option ('-v' , '--verbose' ,
763
773
dest = 'verbose' ,
764
774
default = False ,
0 commit comments