Skip to content

Commit 5f182f9

Browse files
authored
Merge pull request diffblue#344 from diffblue/bugfix/passing_models_lib_to_security_analyser_in_classpath
SEC-252: Bugfix: passing libraries to security-analyser in the classpath.
2 parents df6e232 + 0fbd31c commit 5f182f9

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

driver/run.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
def __get_my_dir(): return os.path.dirname(os.path.realpath(__file__))
1313

1414
def __get_benchmark_library_dir(): return os.path.join(__get_my_dir(), "../benchmarks/LIBRARIES")
15-
def __get_diffblue_models_library_dir(): return os.path.join(__get_benchmark_library_dir(), "models/model/target/classes")
15+
def __get_diffblue_models_library_package(): return os.path.join(__get_benchmark_library_dir(), "models/model/target/models.jar")
1616
def __get_tomcat_library_dir(): return os.path.join(__get_benchmark_library_dir(), "apache-tomcat-9/lib")
1717

1818

@@ -98,16 +98,11 @@ def evaluate(cmdline):
9898

9999
print("Collecting Java binaries to analyse:")
100100

101-
input_search_dirs = [cmdline.install_dir]
102-
if cmdline.use_models_library:
103-
input_search_dirs.append(__get_diffblue_models_library_dir())
104-
if cmdline.use_tomcat_library:
105-
input_search_dirs.append(__get_tomcat_library_dir())
106-
107101
classes_jar_pathname = os.path.abspath(os.path.join(cmdline.results_dir, "program.json"))
108102
prof["collect_java_binaries"] = mkbench.collect_java_binaries(
109-
input_search_dirs,
110-
cmdline.libraries,
103+
[cmdline.install_dir],
104+
cmdline.libraries + ([__get_diffblue_models_library_package()] if cmdline.use_models_library else [])
105+
+ ([__get_tomcat_library_dir()] if cmdline.use_tomcat_library else []),
111106
cmdline.temp_dir,
112107
classes_jar_pathname,
113108
cmdline.verbosity
@@ -243,9 +238,9 @@ def __main():
243238
analyser.get_missing_binary_error_message())
244239
return
245240

246-
if cmdline.use_models_library and not os.path.isdir(__get_diffblue_models_library_dir()):
241+
if cmdline.use_models_library and not os.path.isfile(__get_diffblue_models_library_package()):
247242
print("ERROR: Models library not found at %s; consider running 'make' in %s" % (
248-
__get_diffblue_models_library_dir(), os.path.realpath(os.path.join(__get_my_dir(), ".."))))
243+
__get_diffblue_models_library_package(), os.path.realpath(os.path.join(__get_my_dir(), ".."))))
249244
return
250245
if cmdline.use_tomcat_library and not os.path.isdir(__get_tomcat_library_dir()):
251246
print("ERROR: Tomcat 9 library was not found at " + __get_tomcat_library_dir() + "")

0 commit comments

Comments
 (0)