@@ -345,10 +345,11 @@ def run_benchmarking_tests(
345345 cwd : Path ,
346346 test_framework : str ,
347347 * ,
348- pytest_target_runtime_seconds : float = TOTAL_LOOPING_TIME_EFFECTIVE ,
349- pytest_timeout : int | None = None ,
350- pytest_min_loops : int = 5 ,
351- pytest_max_loops : int = 100_000 ,
348+ target_runtime_seconds : float = TOTAL_LOOPING_TIME_EFFECTIVE ,
349+ timeout : int | None = None ,
350+ min_outer_loops : int = 5 ,
351+ max_outer_loops : int = 100_000 ,
352+ inner_iterations : int | None = None ,
352353 js_project_root : Path | None = None ,
353354) -> tuple [Path , subprocess .CompletedProcess ]:
354355 logger .debug (f"run_benchmarking_tests called: framework={ test_framework } , num_files={ len (test_paths .test_files )} " )
@@ -359,26 +360,30 @@ def run_benchmarking_tests(
359360 # Use Java-specific timeout if no explicit timeout provided
360361 from codeflash .code_utils .config_consts import JAVA_TESTCASE_TIMEOUT
361362
362- effective_timeout = pytest_timeout
363- if test_framework in ("junit4" , "junit5" , "testng" ) and pytest_timeout is not None :
363+ effective_timeout = timeout
364+ if test_framework in ("junit4" , "junit5" , "testng" ) and timeout is not None :
364365 # For Java, use a minimum timeout to account for Maven overhead
365- effective_timeout = max (pytest_timeout , JAVA_TESTCASE_TIMEOUT )
366- if effective_timeout != pytest_timeout :
366+ effective_timeout = max (timeout , JAVA_TESTCASE_TIMEOUT )
367+ if effective_timeout != timeout :
367368 logger .debug (
368- f"Increased Java test timeout from { pytest_timeout } s to { effective_timeout } s "
369+ f"Increased Java test timeout from { timeout } s to { effective_timeout } s "
369370 "to account for Maven startup overhead"
370371 )
371372
372- return language_support .run_benchmarking_tests (
373- test_paths = test_paths ,
374- test_env = test_env ,
375- cwd = cwd ,
376- timeout = effective_timeout ,
377- project_root = js_project_root ,
378- min_loops = pytest_min_loops ,
379- max_loops = pytest_max_loops ,
380- target_duration_seconds = pytest_target_runtime_seconds ,
381- )
373+ kwargs = {
374+ "test_paths" : test_paths ,
375+ "test_env" : test_env ,
376+ "cwd" : cwd ,
377+ "timeout" : effective_timeout ,
378+ "project_root" : js_project_root ,
379+ "min_loops" : min_outer_loops ,
380+ "max_loops" : max_outer_loops ,
381+ "target_duration_seconds" : target_runtime_seconds ,
382+ }
383+ # Pass inner_iterations if specified (for Java/JavaScript)
384+ if inner_iterations is not None :
385+ kwargs ["inner_iterations" ] = inner_iterations
386+ return language_support .run_benchmarking_tests (** kwargs )
382387 if is_python (): # pytest runs both pytest and unittest tests
383388 pytest_cmd_list = (
384389 shlex .split (f"{ SAFE_SYS_EXECUTABLE } -m pytest" , posix = IS_POSIX )
@@ -393,13 +398,13 @@ def run_benchmarking_tests(
393398 "--capture=tee-sys" ,
394399 "-q" ,
395400 "--codeflash_loops_scope=session" ,
396- f"--codeflash_min_loops={ pytest_min_loops } " ,
397- f"--codeflash_max_loops={ pytest_max_loops } " ,
398- f"--codeflash_seconds={ pytest_target_runtime_seconds } " ,
401+ f"--codeflash_min_loops={ min_outer_loops } " ,
402+ f"--codeflash_max_loops={ max_outer_loops } " ,
403+ f"--codeflash_seconds={ target_runtime_seconds } " ,
399404 "--codeflash_stability_check=true" ,
400405 ]
401- if pytest_timeout is not None :
402- pytest_args .append (f"--timeout={ pytest_timeout } " )
406+ if timeout is not None :
407+ pytest_args .append (f"--timeout={ timeout } " )
403408
404409 result_file_path = get_run_tmp_file (Path ("pytest_results.xml" ))
405410 result_args = [f"--junitxml={ result_file_path .as_posix ()} " , "-o" , "junit_logging=all" ]
0 commit comments