@@ -18,6 +18,8 @@ def working_dir(new_dir):
18
18
@contextlib .contextmanager
19
19
def temp_dir_deleter (dirname ):
20
20
yield
21
+ if "SECURITY_ANALYSER_END_TO_END_TESTS_KEEP_RESULTS" in os .environ :
22
+ return
21
23
try :
22
24
shutil .rmtree (dirname )
23
25
except :
@@ -51,8 +53,9 @@ def trace_exists(self, function, line_no):
51
53
return False
52
54
53
55
def run_security_analyser_pipeline (
54
- relative_jar_path ,
56
+ relative_binary_path ,
55
57
relative_rules_path ,
58
+ base_path ,
56
59
extra_args = []):
57
60
58
61
regression_tests_path = os .getcwd ()
@@ -61,22 +64,24 @@ def run_security_analyser_pipeline(
61
64
raise Exception ("Set SECURITY_SCANNER_HOME to a path containing the 'security-analyzer' binary" )
62
65
pipeline_driver_path = \
63
66
os .path .realpath (os .path .join (regression_tests_path , ".." , "driver" , "run.py" ))
64
- absolute_jar_path = \
65
- os .path .join (regression_tests_path , "end_to_end" , relative_jar_path )
67
+ absolute_binary_path = \
68
+ os .path .join (base_path , relative_binary_path )
66
69
absolute_rules_path = \
67
- os .path .join (regression_tests_path , "end_to_end" , relative_rules_path )
70
+ os .path .join (base_path , relative_rules_path )
68
71
69
72
results_dir = tempfile .mkdtemp ()
70
73
temporary_dir = tempfile .mkdtemp ()
71
74
72
75
cmdline = ["python" , pipeline_driver_path ,
73
76
"-C" , absolute_rules_path ,
74
- "-I" , absolute_jar_path ,
77
+ "-I" , absolute_binary_path ,
75
78
"-R" , results_dir ,
76
79
"-T" , temporary_dir ,
77
- "--name" , relative_jar_path ,
78
- "--verbosity" , "0 " ]
80
+ "--name" , relative_binary_path ,
81
+ "--verbosity" , "9 " ]
79
82
cmdline .extend (extra_args )
83
+ if "SECURITY_ANALYSER_END_TO_END_TESTS_EXTRA_ARGS" in os .environ :
84
+ cmdline .extend (os .environ ["SECURITY_ANALYSER_END_TO_END_TESTS_EXTRA_ARGS" ].split ("," ))
80
85
81
86
with working_dir (analyzer_home ), \
82
87
temp_dir_deleter (results_dir ), \
@@ -106,4 +111,7 @@ def run_security_analyser_pipeline(
106
111
trace_json = json .load (trace_file )
107
112
inline_traces .append (trace_json )
108
113
114
+ if "SECURITY_ANALYSER_END_TO_END_TESTS_KEEP_RESULTS" in os .environ :
115
+ print ("Test %s kept results (%s) and temporary directory (%s)" % (cmdline , results_dir , temporary_dir ))
116
+
109
117
return ErrorTraces (traces )
0 commit comments