|
11 | 11 |
|
12 | 12 | def __get_my_dir(): return os.path.dirname(os.path.realpath(__file__))
|
13 | 13 |
|
| 14 | +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") |
| 16 | +def __get_tomcat_library_dir(): return os.path.join(__get_benchmark_library_dir(), "apache-tomcat-9/lib") |
| 17 | + |
14 | 18 |
|
15 | 19 | def __parse_cmd_line():
|
16 | 20 | parser = argparse.ArgumentParser(
|
@@ -50,14 +54,17 @@ def __parse_cmd_line():
|
50 | 54 | help="If specified, then the analyser will save statistics in HTML format together "
|
51 | 55 | "with in JSON format (which is always saved).")
|
52 | 56 | parser.add_argument("--dump-html-slice", action="store_true",
|
53 |
| - help="If specified, then the analyser will save the sliced GOTO program in HTML format together " |
54 |
| - "with in JSON format (which is always saved).") |
| 57 | + help="If specified, then the analyser will save the sliced GOTO program in HTML format " |
| 58 | + "together with in JSON format (which is always saved).") |
55 | 59 | parser.add_argument("--dump-html-program", action="store_true",
|
56 | 60 | help="If specified, then the analysed program is dumped in HTML format.")
|
57 | 61 | parser.add_argument("--verbosity", type=int, default=9,
|
58 | 62 | help="It specifies how many debugging messages will be printed to the standard output stream "
|
59 | 63 | "during the analysis.")
|
60 |
| - parser.add_argument("--use-models-library", action="store_true", help="Add the Diffblue models library to the application JAR") |
| 64 | + parser.add_argument("--use-models-library", action="store_true", |
| 65 | + help="Add the Diffblue models library to the application JAR.") |
| 66 | + parser.add_argument("--use-tomcat-library", action="store_true", |
| 67 | + help="Add the Tomcat 9 library to the application JAR.") |
61 | 68 | parser.add_argument("--data-flow-insensitive-instrumentation", action="store_true",
|
62 | 69 | help="If specified, then the tool 'security-analyser' will use the data-flow insensitive "
|
63 | 70 | "instrumentation of the checked properties into the output GOTO programs. In that case"
|
@@ -85,10 +92,9 @@ def evaluate(cmdline):
|
85 | 92 |
|
86 | 93 | input_search_dirs = [cmdline.install_dir]
|
87 | 94 | if cmdline.use_models_library:
|
88 |
| - input_search_dirs.append(os.path.join(__get_my_dir(), "../benchmarks/LIBRARIES/models/model/target/classes")) |
89 |
| - if not os.path.exists(input_search_dirs[-1]): |
90 |
| - repo_root = os.path.realpath(os.path.join(__get_my_dir(), "..")) |
91 |
| - raise Exception("Models library not found at %s; consider running 'make' in %s" % (input_search_dirs[-1], repo_root)) |
| 95 | + input_search_dirs.append(__get_diffblue_models_library_dir()) |
| 96 | + if cmdline.use_tomcat_library: |
| 97 | + input_search_dirs.append(__get_tomcat_library_dir()) |
92 | 98 |
|
93 | 99 | prof["install_classes"] = mkbench.build_classes_configuration(
|
94 | 100 | input_search_dirs,
|
@@ -218,6 +224,14 @@ def __main():
|
218 | 224 | analyser.get_symex_pathname() + "'.")
|
219 | 225 | return
|
220 | 226 |
|
| 227 | + if cmdline.use_models_library and not os.path.isdir(__get_diffblue_models_library_dir()): |
| 228 | + print("ERROR: Models library not found at %s; consider running 'make' in %s" % ( |
| 229 | + __get_diffblue_models_library_dir(), os.path.realpath(os.path.join(__get_my_dir(), "..")))) |
| 230 | + return |
| 231 | + if cmdline.use_tomcat_library and not os.path.isdir(__get_tomcat_library_dir()): |
| 232 | + print("ERROR: Tomcat 9 library was not found at " + __get_tomcat_library_dir() + "") |
| 233 | + return |
| 234 | + |
221 | 235 | if not os.path.exists(cmdline.results_dir):
|
222 | 236 | os.makedirs(cmdline.results_dir)
|
223 | 237 | if not os.path.exists(cmdline.temp_dir):
|
|
0 commit comments