Skip to content

Commit 2ca7152

Browse files
committed
Update end_to_end_test_utilities.py
1 parent 3e14504 commit 2ca7152

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

tests/scripts/end_to_end_test_utilities.py

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,9 @@ def validate_stdout_in_candidate(stdout: str, expected_in_stdout: list[str]) ->
185185

186186

187187
def run_trace_test(cwd: pathlib.Path, config: TestConfig, expected_improvement_pct: int) -> bool:
188-
# First command: Run the tracer
189188
test_root = cwd / "tests" / (config.test_framework or "")
190189
clear_directory(test_root)
191-
command = ["python", "-m", "codeflash.tracer", "-o", "codeflash.trace", "workload.py"]
190+
command = ["python", "-m", "codeflash", "optimize", "workload.py"]
192191
process = subprocess.Popen(
193192
command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, cwd=str(cwd), env=os.environ.copy()
194193
)
@@ -202,38 +201,19 @@ def run_trace_test(cwd: pathlib.Path, config: TestConfig, expected_improvement_p
202201
stdout = "".join(output)
203202

204203
if return_code != 0:
205-
logging.error(f"Tracer command returned exit code {return_code}")
204+
logging.error(f"Tracer with optimization command returned exit code {return_code}")
206205
return False
207206

208207
functions_traced = re.search(r"Traced (\d+) function calls successfully and replay test created at - (.*)$", stdout)
209-
logging.info(stdout)
210208
if not functions_traced:
211209
logging.error("Failed to find traced functions in output")
212210
return False
213-
if int(functions_traced.group(1)) != 13:
211+
if int(functions_traced.group(1)) != 13:
214212
logging.error(functions_traced.groups())
215213
logging.error("Expected 13 traced functions")
216214
return False
217215

218-
replay_test_path = pathlib.Path(functions_traced.group(2))
219-
if not replay_test_path.exists():
220-
logging.error(f"Replay test file missing at {replay_test_path}")
221-
return False
222-
223-
# Second command: Run optimization
224-
command = ["python", "../../../codeflash/main.py", "--replay-test", str(replay_test_path), "--no-pr"]
225-
process = subprocess.Popen(
226-
command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, cwd=str(cwd), env=os.environ.copy()
227-
)
228-
229-
output = []
230-
for line in process.stdout:
231-
logging.info(line.strip())
232-
output.append(line)
233-
234-
return_code = process.wait()
235-
stdout = "".join(output)
236-
216+
# Validate optimization results (from optimization phase)
237217
return validate_output(stdout, return_code, expected_improvement_pct, config)
238218

239219

0 commit comments

Comments
 (0)