Skip to content

Commit d3e2ffc

Browse files
committed
fix: log subprocess output on test failures
1 parent be7b81c commit d3e2ffc

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

codeflash/optimization/function_optimizer.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2428,13 +2428,20 @@ def run_and_parse_tests(
24282428
f"Error running tests in {', '.join(str(f) for f in test_files.test_files)}.\nTimeout Error"
24292429
)
24302430
return TestResults(), None
2431-
if run_result.returncode != 0 and testing_type == TestingMode.BEHAVIOR:
2432-
logger.debug(
2433-
f"!lsp|Nonzero return code {run_result.returncode} when running tests in "
2434-
f"{', '.join([str(f.instrumented_behavior_file_path) for f in test_files.test_files])}.\n"
2435-
f"stdout: {run_result.stdout}\n"
2436-
f"stderr: {run_result.stderr}\n"
2431+
if run_result.returncode != 0 and testing_type in {TestingMode.BEHAVIOR, TestingMode.PERFORMANCE}:
2432+
test_file_paths = (
2433+
[str(f.instrumented_behavior_file_path) for f in test_files.test_files]
2434+
if testing_type == TestingMode.BEHAVIOR
2435+
else [str(f.benchmarking_file_path) for f in test_files.test_files]
2436+
)
2437+
logger.warning(
2438+
f"Nonzero return code {run_result.returncode} running {testing_type.value} tests in "
2439+
f"{', '.join(test_file_paths)}"
24372440
)
2441+
if run_result.stdout:
2442+
logger.debug(f"Subprocess stdout: {run_result.stdout}")
2443+
if run_result.stderr:
2444+
logger.debug(f"Subprocess stderr: {run_result.stderr}")
24382445

24392446
unique_errors = extract_unique_errors(run_result.stdout)
24402447

0 commit comments

Comments
 (0)