fix: split discovery and instrumentation log messages for E2E harnesses

Log "Discovered N existing unit test files" after counting tests, and
"Instrumented N existing unit test files" after injecting profiling.
Python E2E harness matches "Discovered", JS harness matches "Instrumented".
This commit is contained in:
Kevin Turcios 2026-03-02 02:16:50 -05:00
parent 6f2939aa02
commit b6af185998
2 changed files with 17 additions and 7 deletions

View file

@ -1625,6 +1625,18 @@ class FunctionOptimizer:
msg = f"Unexpected test type: {test_type}"
raise ValueError(msg)
if existing_test_files_count > 0 or replay_test_files_count > 0 or concolic_coverage_test_files_count > 0:
logger.info(
f"Discovered {existing_test_files_count} existing unit test file"
f"{'s' if existing_test_files_count != 1 else ''}, {replay_test_files_count} replay test file"
f"{'s' if replay_test_files_count != 1 else ''}, and "
f"{concolic_coverage_test_files_count} concolic coverage test file"
f"{'s' if concolic_coverage_test_files_count != 1 else ''} for {func_qualname}"
)
console.rule()
for (test_file, test_type), tests_in_file_list in test_file_invocation_positions.items():
path_obj_test_file = Path(test_file)
# Use language-specific instrumentation
success, injected_behavior_test = self.language_support.instrument_existing_test(
test_path=path_obj_test_file,
@ -1696,13 +1708,11 @@ class FunctionOptimizer:
)
)
if existing_test_files_count > 0 or replay_test_files_count > 0 or concolic_coverage_test_files_count > 0:
instrumented_count = len(unique_instrumented_test_files) // 2 # each test produces behavior + perf files
if instrumented_count > 0:
logger.info(
f"Discovered {existing_test_files_count} existing unit test file"
f"{'s' if existing_test_files_count != 1 else ''}, {replay_test_files_count} replay test file"
f"{'s' if replay_test_files_count != 1 else ''}, and "
f"{concolic_coverage_test_files_count} concolic coverage test file"
f"{'s' if concolic_coverage_test_files_count != 1 else ''} for {func_qualname}"
f"Instrumented {instrumented_count} existing unit test file"
f"{'s' if instrumented_count != 1 else ''} for {func_qualname}"
)
console.rule()
return unique_instrumented_test_files

View file

@ -220,7 +220,7 @@ def validate_output(stdout: str, return_code: int, expected_improvement_pct: int
return False
if config.expected_unit_test_files is not None:
# Match the per-function test discovery message from function_optimizer.py
# Match the per-function discovery message from function_optimizer.py
# Format: "Discovered X existing unit test files, Y replay test files, and Z concolic..."
unit_test_files_match = re.search(r"Discovered (\d+) existing unit test files?", stdout)
if not unit_test_files_match: