Skip to content

Function optimizer refactor #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Feb 20, 2025
Merged

Function optimizer refactor #10

merged 21 commits into from
Feb 20, 2025

Conversation

alvin-r
Copy link
Contributor

@alvin-r alvin-r commented Feb 15, 2025

No description provided.

@alvin-r
Copy link
Contributor Author

alvin-r commented Feb 17, 2025

note that I've already merged in @KRRT7 's coverage fix (#13) here, as I was debugging my e2e test issues

@KRRT7 KRRT7 mentioned this pull request Feb 17, 2025
@KRRT7
Copy link
Contributor

KRRT7 commented Feb 17, 2025

added E2E testing for my bug fix here If you don't mind, one thing you should look into, is that when whenever we CTRL+C, on main it properly cleans up test file paths, with these changes, no cleanup is done, we don't want to leave around test files due to a crash.

@alvin-r
Copy link
Contributor Author

alvin-r commented Feb 17, 2025

still having issues when running on codebases, even though e2e tests pass. will check further

@alvin-r alvin-r marked this pull request as ready for review February 18, 2025 02:46
Copy link
Contributor

@misrasaurabh1 misrasaurabh1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i hope you've tested this well.

Comment on lines +181 to +190
for test_file in function_optimizer.test_files.get_by_type(TestType.GENERATED_REGRESSION).test_files:
test_file.instrumented_behavior_file_path.unlink(missing_ok=True)
test_file.benchmarking_file_path.unlink(missing_ok=True)
for test_file in function_optimizer.test_files.get_by_type(TestType.EXISTING_UNIT_TEST).test_files:
test_file.instrumented_behavior_file_path.unlink(missing_ok=True)
test_file.benchmarking_file_path.unlink(missing_ok=True)
for test_file in function_optimizer.test_files.get_by_type(TestType.CONCOLIC_COVERAGE_TEST).test_files:
test_file.instrumented_behavior_file_path.unlink(missing_ok=True)
if function_optimizer.test_cfg.concolic_test_root_dir:
shutil.rmtree(function_optimizer.test_cfg.concolic_test_root_dir, ignore_errors=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: we have cleanup_paths within codeutils, let's use it for this, thought it has to be updated to handle directories

Comment on lines +332 to +346
for generated_test_path in generated_test_paths:
generated_test_path.unlink(missing_ok=True)
for generated_perf_test_path in generated_perf_test_paths:
generated_perf_test_path.unlink(missing_ok=True)
for test_paths in instrumented_unittests_created_for_function:
test_paths.unlink(missing_ok=True)
for fn in function_to_concolic_tests:
for test in function_to_concolic_tests[fn]:
if not test.tests_in_file.test_file.parent.exists():
logger.warning(
f"Concolic test directory {test.tests_in_file.test_file.parent} does not exist so could not be deleted."
)
shutil.rmtree(test.tests_in_file.test_file.parent, ignore_errors=True)
break # need to delete only one test directory

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above.

# Conflicts:
#	codeflash/optimization/optimizer.py
@alvin-r alvin-r merged commit 484859d into main Feb 20, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants