@@ -34,12 +34,16 @@ def existing_tests_source_for(
3434 test_cfg : TestConfig ,
3535 original_runtimes_all : dict [InvocationId , list [int ]],
3636 optimized_runtimes_all : dict [InvocationId , list [int ]],
37- ) -> str :
37+ ) -> tuple [ str , str , str ] :
3838 test_files = function_to_tests .get (function_qualified_name_with_modules_from_root )
3939 if not test_files :
40- return ""
41- output : str = ""
42- rows = []
40+ return "" , "" , ""
41+ output_existing : str = ""
42+ output_concolic : str = ""
43+ output_replay : str = ""
44+ rows_existing = []
45+ rows_concolic = []
46+ rows_replay = []
4347 headers = ["Test File::Test Function" , "Original ⏱️" , "Optimized ⏱️" , "Speedup" ]
4448 tests_root = test_cfg .tests_root
4549 original_tests_to_runtimes : dict [Path , dict [str , int ]] = {}
@@ -99,28 +103,79 @@ def existing_tests_source_for(
99103 * 100
100104 )
101105 if greater :
102- rows .append (
106+ if "__replay_test_" in str (print_filename ):
107+ rows_replay .append (
108+ [
109+ f"`{ print_filename } ::{ qualified_name } `" ,
110+ f"{ print_original_runtime } " ,
111+ f"{ print_optimized_runtime } " ,
112+ f"{ perf_gain } %⚠️" ,
113+ ]
114+ )
115+ elif "codeflash_concolic" in str (print_filename ):
116+ rows_concolic .append (
117+ [
118+ f"`{ print_filename } ::{ qualified_name } `" ,
119+ f"{ print_original_runtime } " ,
120+ f"{ print_optimized_runtime } " ,
121+ f"{ perf_gain } %⚠️" ,
122+ ]
123+ )
124+ else :
125+ rows_existing .append (
126+ [
127+ f"`{ print_filename } ::{ qualified_name } `" ,
128+ f"{ print_original_runtime } " ,
129+ f"{ print_optimized_runtime } " ,
130+ f"{ perf_gain } %⚠️" ,
131+ ]
132+ )
133+ elif "__replay_test_" in str (print_filename ):
134+ rows_replay .append (
103135 [
104136 f"`{ print_filename } ::{ qualified_name } `" ,
105137 f"{ print_original_runtime } " ,
106138 f"{ print_optimized_runtime } " ,
107- f"⚠️{ perf_gain } %" ,
139+ f"{ perf_gain } %✅" ,
140+ ]
141+ )
142+ elif "codeflash_concolic" in str (print_filename ):
143+ rows_concolic .append (
144+ [
145+ f"`{ print_filename } ::{ qualified_name } `" ,
146+ f"{ print_original_runtime } " ,
147+ f"{ print_optimized_runtime } " ,
148+ f"{ perf_gain } %✅" ,
108149 ]
109150 )
110151 else :
111- rows .append (
152+ rows_existing .append (
112153 [
113154 f"`{ print_filename } ::{ qualified_name } `" ,
114155 f"{ print_original_runtime } " ,
115156 f"{ print_optimized_runtime } " ,
116- f"✅ { perf_gain } %" ,
157+ f"{ perf_gain } %✅ " ,
117158 ]
118159 )
119- output += tabulate ( # type: ignore[no-untyped-call]
120- headers = headers , tabular_data = rows , tablefmt = "pipe" , colglobalalign = None , preserve_whitespace = True
160+ output_existing += tabulate ( # type: ignore[no-untyped-call]
161+ headers = headers , tabular_data = rows_existing , tablefmt = "pipe" , colglobalalign = None , preserve_whitespace = True
162+ )
163+ output_existing += "\n "
164+ if len (rows_existing ) == 0 :
165+ output_existing = ""
166+ output_concolic += tabulate ( # type: ignore[no-untyped-call]
167+ headers = headers , tabular_data = rows_concolic , tablefmt = "pipe" , colglobalalign = None , preserve_whitespace = True
168+ )
169+ output_concolic += "\n "
170+ if len (rows_concolic ) == 0 :
171+ output_concolic = ""
172+ output_replay += tabulate ( # type: ignore[no-untyped-call]
173+ headers = headers , tabular_data = rows_replay , tablefmt = "pipe" , colglobalalign = None , preserve_whitespace = True
121174 )
122- output += "\n "
123- return output
175+ output_replay += "\n "
176+ if len (rows_replay ) == 0 :
177+ output_replay = ""
178+ return output_existing , output_replay , output_concolic
124179
125180
126181def check_create_pr (
@@ -131,6 +186,8 @@ def check_create_pr(
131186 generated_original_test_source : str ,
132187 function_trace_id : str ,
133188 coverage_message : str ,
189+ replay_tests : str ,
190+ concolic_tests : str ,
134191 git_remote : Optional [str ] = None ,
135192) -> None :
136193 pr_number : Optional [int ] = env_utils .get_pr_number ()
@@ -171,6 +228,8 @@ def check_create_pr(
171228 generated_tests = generated_original_test_source ,
172229 trace_id = function_trace_id ,
173230 coverage_message = coverage_message ,
231+ replay_tests = replay_tests ,
232+ concolic_tests = concolic_tests ,
174233 )
175234 if response .ok :
176235 logger .info (f"Suggestions were successfully made to PR #{ pr_number } " )
@@ -218,6 +277,8 @@ def check_create_pr(
218277 generated_tests = generated_original_test_source ,
219278 trace_id = function_trace_id ,
220279 coverage_message = coverage_message ,
280+ replay_tests = replay_tests ,
281+ concolic_tests = concolic_tests ,
221282 )
222283 if response .ok :
223284 pr_id = response .text
0 commit comments