Skip to content

Commit 94fcc3b

Browse files
Pass cmdline instead of parts of it to run_security_analyser
1 parent 0c03375 commit 94fcc3b

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

driver/analyser.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,18 @@ def get_symex_pathname():
4343
return os.path.abspath(os.path.join(_tools_binary_dir, "symex"))
4444

4545

46-
def run_security_analyser(
47-
config_json_file,
48-
verbosity,
49-
results_dir,
50-
use_goto_binary
51-
):
46+
def run_security_analyser(config_json_file, cmdline):
5247
prof = {}
5348
prof_start_time = time.time()
5449

55-
if not os.path.exists(results_dir):
56-
os.makedirs(results_dir)
50+
if not os.path.exists(cmdline.results_dir):
51+
os.makedirs(cmdline.results_dir)
5752

5853
old_cwd = os.getcwd()
59-
os.chdir(results_dir)
54+
os.chdir(cmdline.results_dir)
6055

61-
if use_goto_binary:
62-
program_json_file = os.path.abspath(os.path.join(results_dir, "program.json"))
56+
if cmdline.use_goto_binary:
57+
program_json_file = os.path.abspath(os.path.join(cmdline.results_dir, "program.json"))
6358
with open(program_json_file, "r") as ifile:
6459
program_info = json.load(ifile)
6560
assert "gbf" in program_info
@@ -72,8 +67,8 @@ def run_security_analyser(
7267
prof["calling_security_analyser_for_goto_program_generation"] = {}
7368
prof_calling_security_analyser_start_time = time.time()
7469
print("Invoking 'security-analyser' to translate Java to GOTO program.")
75-
if verbosity >= 9:
76-
print("CWD: " + results_dir)
70+
if cmdline.verbosity >= 9:
71+
print("CWD: " + cmdline.results_dir)
7772
print("CMD: " + command)
7873
os.system(command)
7974
prof["calling_security_analyser_for_goto_program_generation"]["duration"] = time.time() - prof_calling_security_analyser_start_time
@@ -85,8 +80,8 @@ def run_security_analyser(
8580
prof["calling_security_analyser"] = {}
8681
prof_calling_security_analyser_start_time = time.time()
8782
print("Invoking 'security-analyser' ...")
88-
if verbosity >= 9:
89-
print("CWD: " + results_dir)
83+
if cmdline.verbosity >= 9:
84+
print("CWD: " + cmdline.results_dir)
9085
print("CMD: " + command)
9186
os.system(command)
9287
prof["calling_security_analyser"]["duration"] = time.time() - prof_calling_security_analyser_start_time

driver/run.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,7 @@ def run_scan(cmdline):
271271

272272
prof["summary_computation"] = analyser.run_security_analyser(
273273
os.path.abspath(os.path.join(cmdline.results_dir, "config.json")),
274-
cmdline.verbosity,
275-
cmdline.results_dir,
276-
cmdline.use_goto_binary
277-
)
274+
cmdline)
278275

279276
instrumented_programs_json_path = \
280277
os.path.join(cmdline.results_dir, "program_slicing", "instrumented_goto_programs.json")

0 commit comments

Comments
 (0)