@@ -21,13 +21,20 @@ def __init__(
21
21
dockerfile_name = "Dockerfile" ,
22
22
volumes = {},
23
23
nocache = False ,
24
+ custom_benchmark_dir = None ,
24
25
):
25
26
self .docker_client = docker .from_env ()
26
27
self .tool_name = tool_name
27
28
self .dockerfile_path = dockerfile_path
28
29
self .dockerfile_name = dockerfile_name
29
30
self .test_runner_script_path = f"/tmp/src/runner.py"
30
31
self .benchmark_path = "/tmp/micro-benchmark"
32
+
33
+ if custom_benchmark_dir :
34
+ self .local_benchmark_path = custom_benchmark_dir
35
+ else :
36
+ self .local_benchmark_path = os .path .abspath ("../micro-benchmark" )
37
+
31
38
self .host_results_path = host_results_path
32
39
self .volumes = volumes
33
40
self .nocache = nocache
@@ -79,7 +86,7 @@ def run_tool_test(self):
79
86
self ._build_docker_image ()
80
87
self .container = self .spawn_docker_instance ()
81
88
82
- src = "../micro-benchmark"
89
+ src = self . local_benchmark_path
83
90
dst = "/tmp"
84
91
self .file_handler .copy_files_to_container (self .container , src , dst )
85
92
@@ -103,35 +110,81 @@ def run_tool_test(self):
103
110
104
111
105
112
class ScalpelRunner (TypeEvalPyRunner ):
106
- def __init__ (self , host_results_path , debug = False , nocache = False ):
113
+ def __init__ (
114
+ self ,
115
+ host_results_path ,
116
+ debug = False ,
117
+ nocache = False ,
118
+ custom_benchmark_dir = None ,
119
+ ):
107
120
super ().__init__ (
108
- "scalpel" , "./target_tools/scalpel" , host_results_path , nocache = nocache
121
+ "scalpel" ,
122
+ "./target_tools/scalpel" ,
123
+ host_results_path ,
124
+ nocache = nocache ,
125
+ custom_benchmark_dir = custom_benchmark_dir ,
109
126
)
110
127
111
128
112
129
class PyreRunner (TypeEvalPyRunner ):
113
- def __init__ (self , host_results_path , debug = False , nocache = False ):
130
+ def __init__ (
131
+ self ,
132
+ host_results_path ,
133
+ debug = False ,
134
+ nocache = False ,
135
+ custom_benchmark_dir = None ,
136
+ ):
114
137
super ().__init__ (
115
- "pyre" , "./target_tools/pyre" , host_results_path , nocache = nocache
138
+ "pyre" ,
139
+ "./target_tools/pyre" ,
140
+ host_results_path ,
141
+ nocache = nocache ,
142
+ custom_benchmark_dir = custom_benchmark_dir ,
116
143
)
117
144
118
145
119
146
class PyrightRunner (TypeEvalPyRunner ):
120
- def __init__ (self , host_results_path , debug = False , nocache = False ):
147
+ def __init__ (
148
+ self ,
149
+ host_results_path ,
150
+ debug = False ,
151
+ nocache = False ,
152
+ custom_benchmark_dir = None ,
153
+ ):
121
154
super ().__init__ (
122
- "pyright" , "./target_tools/pyright" , host_results_path , nocache = nocache
155
+ "pyright" ,
156
+ "./target_tools/pyright" ,
157
+ host_results_path ,
158
+ nocache = nocache ,
159
+ custom_benchmark_dir = custom_benchmark_dir ,
123
160
)
124
161
125
162
126
163
class PytypeRunner (TypeEvalPyRunner ):
127
- def __init__ (self , host_results_path , debug = False , nocache = False ):
164
+ def __init__ (
165
+ self ,
166
+ host_results_path ,
167
+ debug = False ,
168
+ nocache = False ,
169
+ custom_benchmark_dir = None ,
170
+ ):
128
171
super ().__init__ (
129
- "pytype" , "./target_tools/pytype" , host_results_path , nocache = nocache
172
+ "pytype" ,
173
+ "./target_tools/pytype" ,
174
+ host_results_path ,
175
+ nocache = nocache ,
176
+ custom_benchmark_dir = custom_benchmark_dir ,
130
177
)
131
178
132
179
133
180
class JediRunner (TypeEvalPyRunner ):
134
- def __init__ (self , host_results_path , debug = False , nocache = False ):
181
+ def __init__ (
182
+ self ,
183
+ host_results_path ,
184
+ debug = False ,
185
+ nocache = False ,
186
+ custom_benchmark_dir = None ,
187
+ ):
135
188
if debug :
136
189
super ().__init__ (
137
190
"jedi" ,
@@ -145,24 +198,49 @@ def __init__(self, host_results_path, debug=False, nocache=False):
145
198
}
146
199
},
147
200
nocache = nocache ,
201
+ custom_benchmark_dir = custom_benchmark_dir ,
148
202
)
149
203
else :
150
204
super ().__init__ (
151
- "jedi" , "./target_tools/jedi" , host_results_path , nocache = nocache
205
+ "jedi" ,
206
+ "./target_tools/jedi" ,
207
+ host_results_path ,
208
+ nocache = nocache ,
209
+ custom_benchmark_dir = custom_benchmark_dir ,
152
210
)
153
211
154
212
155
213
class HityperRunner (TypeEvalPyRunner ):
156
- def __init__ (self , host_results_path , debug = False , nocache = False ):
214
+ def __init__ (
215
+ self ,
216
+ host_results_path ,
217
+ debug = False ,
218
+ nocache = False ,
219
+ custom_benchmark_dir = None ,
220
+ ):
157
221
super ().__init__ (
158
- "hityper" , "./target_tools/hityper" , host_results_path , nocache = nocache
222
+ "hityper" ,
223
+ "./target_tools/hityper" ,
224
+ host_results_path ,
225
+ nocache = nocache ,
226
+ custom_benchmark_dir = custom_benchmark_dir ,
159
227
)
160
228
161
229
162
230
class HityperDLRunner (TypeEvalPyRunner ):
163
- def __init__ (self , host_results_path , debug = False , nocache = False ):
231
+ def __init__ (
232
+ self ,
233
+ host_results_path ,
234
+ debug = False ,
235
+ nocache = False ,
236
+ custom_benchmark_dir = None ,
237
+ ):
164
238
super ().__init__ (
165
- "hityperdl" , "./target_tools/hityperdl" , host_results_path , nocache = nocache
239
+ "hityperdl" ,
240
+ "./target_tools/hityperdl" ,
241
+ host_results_path ,
242
+ nocache = nocache ,
243
+ custom_benchmark_dir = custom_benchmark_dir ,
166
244
)
167
245
168
246
def spawn_docker_instance (self ):
@@ -179,7 +257,13 @@ def spawn_docker_instance(self):
179
257
180
258
181
259
class HeaderGenRunner (TypeEvalPyRunner ):
182
- def __init__ (self , host_results_path , debug = False , nocache = False ):
260
+ def __init__ (
261
+ self ,
262
+ host_results_path ,
263
+ debug = False ,
264
+ nocache = False ,
265
+ custom_benchmark_dir = None ,
266
+ ):
183
267
if debug :
184
268
super ().__init__ (
185
269
"headergen" ,
@@ -199,20 +283,41 @@ def __init__(self, host_results_path, debug=False, nocache=False):
199
283
"./target_tools/headergen" ,
200
284
host_results_path ,
201
285
nocache = nocache ,
286
+ custom_benchmark_dir = custom_benchmark_dir ,
202
287
)
203
288
204
289
205
290
class PySonar2Runner (TypeEvalPyRunner ):
206
- def __init__ (self , host_results_path , debug = False , nocache = False ):
291
+ def __init__ (
292
+ self ,
293
+ host_results_path ,
294
+ debug = False ,
295
+ nocache = False ,
296
+ custom_benchmark_dir = None ,
297
+ ):
207
298
super ().__init__ (
208
- "pysonar2" , "./target_tools/pysonar2" , host_results_path , nocache = nocache
299
+ "pysonar2" ,
300
+ "./target_tools/pysonar2" ,
301
+ host_results_path ,
302
+ nocache = nocache ,
303
+ custom_benchmark_dir = custom_benchmark_dir ,
209
304
)
210
305
211
306
212
307
class Type4pyRunner (TypeEvalPyRunner ):
213
- def __init__ (self , host_results_path , debug = False , nocache = False ):
308
+ def __init__ (
309
+ self ,
310
+ host_results_path ,
311
+ debug = False ,
312
+ nocache = False ,
313
+ custom_benchmark_dir = None ,
314
+ ):
214
315
super ().__init__ (
215
- "type4py" , "./target_tools/type4py" , host_results_path , nocache = nocache
316
+ "type4py" ,
317
+ "./target_tools/type4py" ,
318
+ host_results_path ,
319
+ nocache = nocache ,
320
+ custom_benchmark_dir = custom_benchmark_dir ,
216
321
)
217
322
218
323
def spawn_docker_instance (self ):
@@ -229,9 +334,20 @@ def spawn_docker_instance(self):
229
334
230
335
231
336
class OllamaRunner (TypeEvalPyRunner ):
232
- def __init__ (self , host_results_path , config , debug = False , nocache = False ):
337
+ def __init__ (
338
+ self ,
339
+ host_results_path ,
340
+ config ,
341
+ debug = False ,
342
+ nocache = False ,
343
+ custom_benchmark_dir = None ,
344
+ ):
233
345
super ().__init__ (
234
- "ollama" , "./target_tools/ollama" , host_results_path , nocache = nocache
346
+ "ollama" ,
347
+ "./target_tools/ollama" ,
348
+ host_results_path ,
349
+ nocache = nocache ,
350
+ custom_benchmark_dir = custom_benchmark_dir ,
235
351
)
236
352
self .config = config
237
353
@@ -266,9 +382,20 @@ def copy_results_from_container(self):
266
382
267
383
268
384
class OllamaRunner (TypeEvalPyRunner ):
269
- def __init__ (self , host_results_path , config , debug = False , nocache = False ):
385
+ def __init__ (
386
+ self ,
387
+ host_results_path ,
388
+ config ,
389
+ debug = False ,
390
+ nocache = False ,
391
+ custom_benchmark_dir = None ,
392
+ ):
270
393
super ().__init__ (
271
- "ollama" , "./target_tools/ollama" , host_results_path , nocache = nocache
394
+ "ollama" ,
395
+ "./target_tools/ollama" ,
396
+ host_results_path ,
397
+ nocache = nocache ,
398
+ custom_benchmark_dir = custom_benchmark_dir ,
272
399
)
273
400
self .config = config
274
401
0 commit comments