@@ -18,6 +18,8 @@ def working_dir(new_dir):
1818@contextlib .contextmanager
1919def temp_dir_deleter (dirname ):
2020 yield
21+ if "SECURITY_ANALYSER_END_TO_END_TESTS_KEEP_RESULTS" in os .environ :
22+ return
2123 try :
2224 shutil .rmtree (dirname )
2325 except :
@@ -51,8 +53,9 @@ def trace_exists(self, function, line_no):
5153 return False
5254
5355def run_security_analyser_pipeline (
54- relative_jar_path ,
56+ relative_binary_path ,
5557 relative_rules_path ,
58+ base_path ,
5659 extra_args = []):
5760
5861 regression_tests_path = os .getcwd ()
@@ -61,22 +64,24 @@ def run_security_analyser_pipeline(
6164 raise Exception ("Set SECURITY_SCANNER_HOME to a path containing the 'security-analyzer' binary" )
6265 pipeline_driver_path = \
6366 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 )
6669 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 )
6871
6972 results_dir = tempfile .mkdtemp ()
7073 temporary_dir = tempfile .mkdtemp ()
7174
7275 cmdline = ["python" , pipeline_driver_path ,
7376 "-C" , absolute_rules_path ,
74- "-I" , absolute_jar_path ,
77+ "-I" , absolute_binary_path ,
7578 "-R" , results_dir ,
7679 "-T" , temporary_dir ,
77- "--name" , relative_jar_path ,
78- "--verbosity" , "0 " ]
80+ "--name" , relative_binary_path ,
81+ "--verbosity" , "9 " ]
7982 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 ("," ))
8085
8186 with working_dir (analyzer_home ), \
8287 temp_dir_deleter (results_dir ), \
@@ -106,4 +111,7 @@ def run_security_analyser_pipeline(
106111 trace_json = json .load (trace_file )
107112 inline_traces .append (trace_json )
108113
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+
109117 return ErrorTraces (traces )
0 commit comments