@@ -15,53 +15,43 @@ def _get_my_dir(): return os.path.dirname(os.path.realpath(__file__))
15
15
def _get_common_libraries ():
16
16
17
17
def get_benchmark_library_dir ():
18
- return os .path .join (_get_my_dir (), "../benchmarks/LIBRARIES" )
18
+ return os .path .abspath ( os . path . join (_get_my_dir (), "../benchmarks/LIBRARIES" ) )
19
19
20
20
def get_diffblue_models_library_props ():
21
- props = {"diffblue_models_library" : {"directory" : None , "files" : [], "error" : None }}
22
- directory = os .path .join (get_benchmark_library_dir (), "models/model/target" )
23
- if os .path .isdir (directory ):
24
- props ["diffblue_models_library" ]["directory" ] = directory
25
- pathname = os .path .join (directory , "models.jar" )
26
- if os .path .isfile (pathname ):
27
- props ["diffblue_models_library" ]["files" ].append (pathname )
28
- else :
29
- props ["diffblue_models_library" ]["error" ] = "Cannot access Diffblue Models Library's file " + pathname
21
+ props = {"diffblue_models_library" : {"paths" : [], "error" : None }}
22
+ pathname = os .path .join (get_benchmark_library_dir (), "models" , "model" , "target" , "models.jar" )
23
+ if os .path .isfile (pathname ):
24
+ props ["diffblue_models_library" ]["paths" ].append (pathname )
25
+ else :
26
+ props ["diffblue_models_library" ]["error" ] = "Cannot access Diffblue Models Library's file " + pathname
27
+ return props
28
+ pathname = os .path .join (get_benchmark_library_dir (), "oracle-jdk-8" )
29
+ if os .path .isdir (pathname ):
30
+ props ["diffblue_models_library" ]["paths" ].append (pathname )
30
31
else :
31
- props ["diffblue_models_library" ]["error" ] = "Cannot access Diffblue Models Library's directory " + directory
32
+ pathname = os .path .join (get_benchmark_library_dir (), "openjdk-8" )
33
+ if os .path .isdir (pathname ):
34
+ props ["diffblue_models_library" ]["paths" ].append (pathname )
35
+ else :
36
+ print ("Warning: cannot access JDK install directory " + pathname )
32
37
return props
33
38
34
39
def get_apache_tomcat_props ():
35
- props = {"apache_tomcat" : {"directory" : None , "files " : [], "error" : None }}
36
- directory = os .path .join (get_benchmark_library_dir (), "apache-tomcat-9/ lib" )
40
+ props = {"apache_tomcat" : {"paths " : [], "error" : None }}
41
+ directory = os .path .join (get_benchmark_library_dir (), "apache-tomcat-9" , " lib" )
37
42
if os .path .isdir (directory ):
38
- props ["apache_tomcat" ]["directory" ] = directory
39
- pathname = os .path .join (directory , "servlet-api.jar" )
40
- if os .path .isfile (pathname ):
41
- props ["apache_tomcat" ]["files" ].append (pathname )
42
- else :
43
- props ["apache_tomcat" ]["error" ] = "Cannot access Apache Tomcat's file " + pathname
43
+ props ["apache_tomcat" ]["paths" ].append (directory )
44
44
else :
45
45
props ["apache_tomcat" ]["error" ] = "Cannot access Apache Tomcat's directory " + directory
46
46
return props
47
47
48
48
def get_spring_framework_props ():
49
- props = {"spring_framework" : {"directory" : None , "files " : [], "error" : None }}
50
- directory = os .path .join (get_benchmark_library_dir (), "spring-framework/ libs" )
49
+ props = {"spring_framework" : {"paths " : [], "error" : None }}
50
+ directory = os .path .join (get_benchmark_library_dir (), "spring-framework" , " libs" )
51
51
if os .path .isdir (directory ):
52
- props ["spring_framework" ]["directory" ] = directory
53
- required_fname_prefixes = ["spring-core-" , "spring-beans-" ]
54
52
for fname in os .listdir (directory ):
55
- if (fname .endswith (".RELEASE.jar" ) and any (fname .startswith (x ) for x in required_fname_prefixes )):
56
- props ["spring_framework" ]["files" ].append (os .path .join (directory , fname ))
57
- if len (props ["spring_framework" ]["files" ]) != 2 :
58
- props ["spring_framework" ]["error" ] = (
59
- "There are missing JAR files in Spring Framework's directory " + directory + "\n "
60
- "These were found:\n " +
61
- "\n " .join ([os .path .basename (pathname ) for pathname in props ["spring_framework" ]["files" ]]) + "\n "
62
- "There are required:\n " +
63
- "\n " .join ([x + "*.RELEASE.jar" for x in required_fname_prefixes ])
64
- )
53
+ if fname .endswith (".RELEASE.jar" ):
54
+ props ["spring_framework" ]["paths" ].append (os .path .join (directory , fname ))
65
55
else :
66
56
props ["spring_framework" ]["error" ] = "Cannot access Spring Framework's directory " + directory
67
57
return props
@@ -169,9 +159,10 @@ def evaluate(cmdline, common_libraries):
169
159
classes_jar_pathname = os .path .abspath (os .path .join (cmdline .results_dir , "program.json" ))
170
160
prof ["collect_java_binaries" ] = mkbench .collect_java_binaries (
171
161
cmdline .input_path ,
172
- cmdline .libraries + (common_libraries ["diffblue_models_library" ]["files" ] if cmdline .use_models_library else [])
173
- + (common_libraries ["apache_tomcat" ]["files" ] if cmdline .use_apache_tomcat else [])
174
- + (common_libraries ["spring_framework" ]["files" ] if cmdline .use_spring_framework else []),
162
+ cmdline .libraries
163
+ + (common_libraries ["diffblue_models_library" ]["paths" ] if cmdline .use_models_library else [])
164
+ + (common_libraries ["apache_tomcat" ]["paths" ] if cmdline .use_apache_tomcat else [])
165
+ + (common_libraries ["spring_framework" ]["paths" ] if cmdline .use_spring_framework else []),
175
166
cmdline .entry_point ,
176
167
cmdline .temp_dir ,
177
168
classes_jar_pathname ,
0 commit comments