Skip to content

Commit 7806cb6

Browse files
committed
test E2E
1 parent e9539c1 commit 7806cb6

File tree

2 files changed

+41
-5
lines changed

2 files changed

+41
-5
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from concurrent.futures import ThreadPoolExecutor
2+
3+
4+
def add_numbers(a: int, b: int) -> int:
5+
result = a + b
6+
return result
7+
8+
9+
def test_threadpool() -> None:
10+
pool = ThreadPoolExecutor(max_workers=3)
11+
numbers = [(10, 20), (30, 40), (50, 60)]
12+
result = pool.map(add_numbers, *zip(*numbers))
13+
14+
for r in result:
15+
print(r)
16+
17+
18+
if __name__ == "__main__":
19+
test_threadpool()

tests/scripts/end_to_end_test_tracer_replay.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,38 @@
33

44
from end_to_end_test_utilities import CoverageExpectation, TestConfig, run_codeflash_command, run_with_retries
55

6+
# def run_test(expected_improvement_pct: int) -> bool:
7+
# config = TestConfig(
8+
# trace_mode=True,
9+
# min_improvement_x=0.1,
10+
# expected_unit_tests=1,
11+
# coverage_expectations=[
12+
# CoverageExpectation(function_name="funcA", expected_coverage=100.0, expected_lines=[2, 3, 4, 6, 9])
13+
# ],
14+
# )
15+
# cwd = (
16+
# pathlib.Path(__file__).parent.parent.parent / "code_to_optimize" / "code_directories" / "simple_tracer_e2e"
17+
# ).resolve()
18+
# return run_codeflash_command(cwd, config, expected_improvement_pct)
619

7-
def run_test(expected_improvement_pct: int) -> bool:
20+
21+
def run_testbenchtest(expected_improvement_pct: int) -> bool:
822
config = TestConfig(
923
trace_mode=True,
1024
min_improvement_x=0.1,
11-
expected_unit_tests=1,
1225
coverage_expectations=[
13-
CoverageExpectation(function_name="funcA", expected_coverage=100.0, expected_lines=[2, 3, 4, 6, 9])
26+
CoverageExpectation(function_name="add_numbers", expected_coverage=100.0, expected_lines=[2, 3, 4, 6, 9])
1427
],
1528
)
1629
cwd = (
17-
pathlib.Path(__file__).parent.parent.parent / "code_to_optimize" / "code_directories" / "simple_tracer_e2e"
30+
pathlib.Path(__file__).parent.parent.parent / "code_to_optimize" / "code_directories" / "testbench"
1831
).resolve()
1932
return run_codeflash_command(cwd, config, expected_improvement_pct)
2033

2134

2235
if __name__ == "__main__":
23-
exit(run_with_retries(run_test, int(os.getenv("EXPECTED_IMPROVEMENT_PCT", 10))))
36+
# tests = [run_test, run_testbenchtest]
37+
tests = [run_testbenchtest]
38+
for test in tests:
39+
res = run_with_retries(test, int(os.getenv("EXPECTED_IMPROVEMENT_PCT", 10)))
40+
exit(0 if res else 1)

0 commit comments

Comments
 (0)