Skip to content

Commit 4806604

Browse files
author
Owen Jones
committed
Install Apache Tomcat if we need it
1 parent 462d203 commit 4806604

File tree

7 files changed

+38
-1
lines changed

7 files changed

+38
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
TOMCAT_DIR=apache-tomcat-9
4+
5+
if [[ ! -d $TOMCAT_DIR ]]; then
6+
wget http://archive.apache.org/dist/tomcat/tomcat-9/v9.0.0.M21/bin/apache-tomcat-9.0.0.M21.zip
7+
unzip apache-tomcat-9.0.0.M21.zip
8+
rm apache-tomcat-9.0.0.M21.zip
9+
mv apache-tomcat-9.0.0.M21 $TOMCAT_DIR
10+
if [[ ! -d $TOMCAT_DIR ]]; then
11+
exit 1
12+
fi
13+
fi
14+
15+
exit 0

regression/OWASP/BenchmarkTest00002/test_BenchmarkTest00002.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def test_BenchmarkTest00002(load_strategy):
1818
terminate called after throwing an instance of 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >'
1919
Aborted (core dumped)
2020
"""
21+
utils.install_apache_tomcat()
2122
with utils.working_dir(os.path.abspath(os.path.dirname(__file__))):
2223
os.system("mvn package")
2324
traces = pipeline_executor.run_security_analyser_pipeline(

regression/OWASP/BenchmarkTest00013/test_BenchmarkTest00013.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def test_BenchmarkTest00013(load_strategy):
1717
terminate called after throwing an instance of 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >'
1818
Aborted (core dumped)
1919
"""
20+
utils.install_apache_tomcat()
2021
with utils.working_dir(os.path.abspath(os.path.dirname(__file__))):
2122
os.system("mvn package")
2223
traces = pipeline_executor.run_security_analyser_pipeline(

regression/OWASP/BenchmarkTest00430/test_BenchmarkTest00430.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def test_BenchmarkTest00430(load_strategy):
1818
terminate called after throwing an instance of 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >'
1919
Aborted (core dumped)
2020
"""
21+
utils.install_apache_tomcat()
2122
with utils.working_dir(os.path.abspath(os.path.dirname(__file__))):
2223
os.system("mvn package")
2324
traces = pipeline_executor.run_security_analyser_pipeline(

regression/OWASP/BenchmarkTest00431/test_BenchmarkTest00431.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def test_BenchmarkTest00431(load_strategy):
1818
terminate called after throwing an instance of 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >'
1919
Aborted (core dumped)
2020
"""
21+
utils.install_apache_tomcat()
2122
with utils.working_dir(os.path.abspath(os.path.dirname(__file__))):
2223
os.system("mvn package")
2324
traces = pipeline_executor.run_security_analyser_pipeline(

regression/OWASP/BenchmarkTest01661/test_BenchmarkTest01661.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def test_BenchmarkTest01661(load_strategy):
4040
"Tainted array" after the assignment of "Tainted string" 'bar' into
4141
'newarray_tmp0'.
4242
"""
43+
utils.install_apache_tomcat()
4344
with utils.working_dir(os.path.abspath(os.path.dirname(__file__))):
4445
os.system("mvn package")
4546
traces = pipeline_executor.run_security_analyser_pipeline(

regression/utils.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import contextlib
2+
import fasteners
13
import os
24
import shutil
3-
import contextlib
5+
import subprocess
46

57

68
@contextlib.contextmanager
@@ -29,3 +31,18 @@ def get_security_analyzer_home():
2931
if not os.path.exists(test):
3032
return None
3133
return os.environ['SECURITY_SCANNER_HOME']
34+
35+
36+
def get_security_analyzer_root():
37+
this_folder = os.path.dirname(os.path.realpath(__file__))
38+
return os.path.abspath(os.path.join(this_folder, ".."))
39+
40+
41+
def get_security_analyzer_libraries_dir():
42+
return os.path.join(get_security_analyzer_root(), "benchmarks", "LIBRARIES")
43+
44+
45+
@fasteners.interprocess_locked(os.path.join(os.path.dirname(__file__), ".tomcat_build_lock"))
46+
def install_apache_tomcat():
47+
with working_dir(get_security_analyzer_libraries_dir()):
48+
subprocess.check_call("./install_apache_tomcat.sh")

0 commit comments

Comments
 (0)