Skip to content

Commit 90f0bee

Browse files
marek-trtiksmowton
authored andcommitted
Framework extended to reproduce Sakai's issue (introduced config file "jars.json" with explicit set of JARs to be used).
1 parent f92968a commit 90f0bee

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
"sakai-velocity-tool-12-SNAPSHOT.jar",
3+
"sakai-kernel-util-12-SNAPSHOT.jar",
4+
"sakai-assignment-api-12-SNAPSHOT.jar"
5+
]
6+

regression/december_demo_sprint/goto-analyzer/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def parse_cmd_line():
4848
help="When specified, the directories -T and -R are deleted at the beginning of the analysis. "
4949
"This has an effect to running the analysis from scratch without reuse of any data "
5050
"computed in the previous run of the analyser of the specified benchmark.")
51-
parser.add_argument("--timeout", type=int, default=300,
51+
parser.add_argument("--timeout", type=int, default=900,
5252
help="A timeout in seconds for the goto-analyser. It means that it is NOT a timeout for "
5353
"whole the analysis. Namely, it does not include preprocessing steps of WAR/JAR file "
5454
"for goto-analyses nor saving results from the analysis. Also, since goto-analyser "

regression/december_demo_sprint/goto-analyzer/scripts/analyser.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import shutil
33
import time
4+
import json
45

56

67
def __get_my_dir(): return os.path.dirname(os.path.realpath(__file__))
@@ -75,9 +76,32 @@ def run_goto_analyser(
7576

7677
classpath = os.path.relpath(os.path.abspath(os.path.join(__get_my_dir(),rt_dir)),results_dir)
7778

78-
for jar in jars_cfg["jars"]:
79-
if not (jar == root_jar):
80-
classpath += ":" + os.path.relpath(jar, results_dir)
79+
explicit_jars_list = []
80+
explicit_jars_fname = os.path.join(os.path.dirname(taint_json_file),"jars.json")
81+
if os.path.exists(explicit_jars_fname) and os.path.isfile(explicit_jars_fname):
82+
explicit_jars_file = open(explicit_jars_fname, "r")
83+
try:
84+
explicit_jars_list = json.load(explicit_jars_file)
85+
except:
86+
print("ERROR: Incorrect format of JSON file: " + explicit_jars_file)
87+
print("ERROR: Terminating the analysis of the Java web application with FAILURE.")
88+
return
89+
explicit_jars_file.close()
90+
91+
if len(explicit_jars_list) == 0:
92+
for jar in jars_cfg["jars"]:
93+
if not (jar == root_jar):
94+
classpath += ":" + os.path.relpath(jar, results_dir)
95+
else:
96+
for jar in jars_cfg["jars"]:
97+
found = False
98+
for jar_name in explicit_jars_list:
99+
if jar_name in jar:
100+
found = True
101+
break
102+
if found and not (jar == root_jar):
103+
classpath += ":" + os.path.relpath(jar, results_dir)
104+
81105
if not os.path.exists(results_dir):
82106
os.makedirs(results_dir)
83107

0 commit comments

Comments
 (0)