@@ -2348,13 +2348,11 @@ class TestSuite:
23482348 _ = x
23492349 return True
23502350
2351- self .all_tests : List [str ] = self .get_tests_list (
2352- self .tests_in_suite_key_func , filter_func
2353- )
2351+ all_tests = list (self .get_selected_tests (filter_func ))
23542352
23552353 all_tags_and_random_settings_limits = (
23562354 self .read_test_tags_and_random_settings_limits (
2357- self .suite_path , self . all_tests
2355+ self .suite_path , all_tests
23582356 )
23592357 )
23602358 self .all_tags : Dict [str , Set [str ]] = all_tags_and_random_settings_limits [0 ]
@@ -2363,6 +2361,10 @@ class TestSuite:
23632361 )
23642362 self .sequential_tests = []
23652363 self .parallel_tests = []
2364+
2365+ self .all_tests = self .apply_test_runs (all_tests )
2366+ self .all_tests .sort (key = self .tests_in_suite_key_func )
2367+
23662368 for test_name in self .all_tests :
23672369 if self .is_sequential_test (test_name ):
23682370 if not args .no_sequential :
@@ -2371,6 +2373,19 @@ class TestSuite:
23712373 if not args .no_parallel :
23722374 self .parallel_tests .append (test_name )
23732375
2376+ def apply_test_runs (self , all_tests ):
2377+ test_runs = self .args .test_runs
2378+ long_test_runs = max (int (self .args .test_runs * self .args .long_test_runs_ratio ), 1 )
2379+
2380+ all_tests = map (lambda test : [test ] * (long_test_runs if self .is_long_test (test ) else test_runs ), all_tests )
2381+ all_tests = [item for sublist in all_tests for item in sublist ]
2382+ return all_tests
2383+
2384+ def is_long_test (self , test_name ):
2385+ if test_name not in self .all_tags :
2386+ return False
2387+ return "long" in self .all_tags [test_name ]
2388+
23742389 def is_sequential_test (self , test_name ):
23752390 if args .sequential :
23762391 if any (s in test_name for s in args .sequential ):
@@ -2385,16 +2400,6 @@ class TestSuite:
23852400 or ("stateful" in self .all_tags [test_name ])
23862401 )
23872402
2388- def get_tests_list (self , sort_key , filter_func ):
2389- """
2390- Return list of tests file names to run
2391- """
2392-
2393- all_tests = list (self .get_selected_tests (filter_func ))
2394- all_tests = all_tests * self .args .test_runs
2395- all_tests .sort (key = sort_key )
2396- return all_tests
2397-
23982403 def get_selected_tests (self , filter_func ):
23992404 """
24002405 Find all files with tests, filter, render templates
@@ -3550,6 +3555,13 @@ def parse_args():
35503555 type = int ,
35513556 help = "Run each test many times (useful for e.g. flaky check)" ,
35523557 )
3558+ parser .add_argument (
3559+ "--long-test-runs-ratio" ,
3560+ default = 0.1 ,
3561+ nargs = "?" ,
3562+ type = float ,
3563+ help = "Ratio from --test-runs for long tests" ,
3564+ )
35533565 parser .add_argument (
35543566 "-U" ,
35553567 "--unified" ,
0 commit comments