Skip to content

Commit 98f27a5

Browse files
author
owen-jones-diffblue
authored
Merge pull request diffblue#518 from diffblue/owen-jones-diffblue/change-csvsa-test-mechanism
SEC-581: change csvsa test mechanism (and fix problems in our tests)
2 parents fd28ee9 + 4806604 commit 98f27a5

File tree

43 files changed

+367
-278
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+367
-278
lines changed
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/CMakeLists.txt

-9
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,3 @@ set_tests_properties(regression-tests
1010
PROPERTIES
1111
LABELS "CORE;REGRESSION"
1212
ENVIRONMENT SECURITY_SCANNER_HOME=${CMAKE_BINARY_DIR})
13-
14-
add_test(
15-
NAME regression-tests-with-csvsa
16-
COMMAND ${PYTHON_EXECUTABLE} -m pytest
17-
WORKING_DIRECTORY ${security-scanner_SOURCE_DIR}/regression)
18-
set_tests_properties(regression-tests-with-csvsa
19-
PROPERTIES
20-
LABELS "CORE;REGRESSION"
21-
ENVIRONMENT "SECURITY_SCANNER_HOME=${CMAKE_BINARY_DIR};SECURITY_REGRESSION_TESTS_USE_CSVSA=1")

regression/LVSA/TestArray/test_array.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
folder_name = 'TestArray'
55

66

7-
def test_lvsa_null_initialized_array(tmpdir):
7+
def test_lvsa_null_initialized_array(tmpdir, load_strategy):
88
"""Arrays are automatically null-initialized"""
99
lvsa_driver = LvsaDriver(tmpdir, folder_name).with_test_function('null_initialized_array')
10-
lvsa_expectation = lvsa_driver.run()
10+
lvsa_expectation = lvsa_driver.run(load_strategy)
1111

1212
value_set_expectation = lvsa_expectation.get_value_set_for_output()
1313

1414
value_set_expectation.check_number_of_values(1)
1515
value_set_expectation.check_contains_null_object()
1616

1717

18-
def test_lvsa_manually_filled_array_1(tmpdir):
18+
def test_lvsa_manually_filled_array_1(tmpdir, load_strategy):
1919
"""We cannot tell that the whole array has been given a non-null value"""
2020
lvsa_driver = LvsaDriver(tmpdir, folder_name).with_test_function('manually_filled_array_1')
21-
lvsa_expectation = lvsa_driver.run()
21+
lvsa_expectation = lvsa_driver.run(load_strategy)
2222

2323
value_set_expectation = lvsa_expectation.get_value_set_for_output()
2424

@@ -27,10 +27,10 @@ def test_lvsa_manually_filled_array_1(tmpdir):
2727
value_set_expectation.check_contains_dynamic_object(is_most_recent_allocation=True)
2828

2929

30-
def test_lvsa_manually_filled_array_2(tmpdir):
30+
def test_lvsa_manually_filled_array_2(tmpdir, load_strategy):
3131
"""We cannot tell that the whole array has been given a non-null value"""
3232
lvsa_driver = LvsaDriver(tmpdir, folder_name).with_test_function('manually_filled_array_2')
33-
lvsa_expectation = lvsa_driver.run()
33+
lvsa_expectation = lvsa_driver.run(load_strategy)
3434

3535
value_set_expectation = lvsa_expectation.get_value_set_for_output()
3636

@@ -40,10 +40,10 @@ def test_lvsa_manually_filled_array_2(tmpdir):
4040
value_set_expectation.check_contains_dynamic_object(is_most_recent_allocation=False)
4141

4242

43-
def test_lvsa_initialize_array(tmpdir):
43+
def test_lvsa_initialize_array(tmpdir, load_strategy):
4444
"""We use one value set for all indices"""
4545
lvsa_driver = LvsaDriver(tmpdir, folder_name).with_test_function('initialize_array')
46-
lvsa_expectation = lvsa_driver.run()
46+
lvsa_expectation = lvsa_driver.run(load_strategy)
4747

4848
value_set_expectation = lvsa_expectation.get_value_set_for_output()
4949

regression/LVSA/TestBasic/test_basic.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
folder_name = 'TestBasic'
55

66

7-
def test_outputs_null(tmpdir):
7+
def test_outputs_null(tmpdir, load_strategy):
88
lvsa_driver = LvsaDriver(tmpdir, folder_name).with_test_function('outputs_null')
9-
lvsa_expectation = lvsa_driver.run()
9+
lvsa_expectation = lvsa_driver.run(load_strategy)
1010

1111
value_set_expectation = lvsa_expectation.get_value_set_for_output()
1212

1313
value_set_expectation.check_number_of_values(1)
1414
value_set_expectation.check_contains_null_object()
1515

1616

17-
def test_outputs_null_or_dynamic_object(tmpdir):
17+
def test_outputs_null_or_dynamic_object(tmpdir, load_strategy):
1818
lvsa_driver = LvsaDriver(tmpdir, folder_name).with_test_function('outputs_null_or_dynamic_object')
19-
lvsa_expectation = lvsa_driver.run()
19+
lvsa_expectation = lvsa_driver.run(load_strategy)
2020

2121
value_set_expectation = lvsa_expectation.get_value_set_for_output()
2222

@@ -25,9 +25,9 @@ def test_outputs_null_or_dynamic_object(tmpdir):
2525
value_set_expectation.check_contains_dynamic_object()
2626

2727

28-
def test_outputs_dynamic_object_with_allocated_field(tmpdir):
28+
def test_outputs_dynamic_object_with_allocated_field(tmpdir, load_strategy):
2929
lvsa_driver = LvsaDriver(tmpdir, folder_name).with_test_function('outputs_dynamic_object_with_allocated_field')
30-
lvsa_expectation = lvsa_driver.run()
30+
lvsa_expectation = lvsa_driver.run(load_strategy)
3131

3232
value_set_expectation = lvsa_expectation.get_value_set_for_output()
3333

@@ -41,9 +41,9 @@ def test_outputs_dynamic_object_with_allocated_field(tmpdir):
4141
value_set_expectation.check_contains_dynamic_object()
4242

4343

44-
def test_only_track_pointers(tmpdir):
44+
def test_only_track_pointers(tmpdir, load_strategy):
4545
lvsa_driver = LvsaDriver(tmpdir, folder_name).with_test_function('only_track_pointers')
46-
lvsa_expectation = lvsa_driver.run()
46+
lvsa_expectation = lvsa_driver.run(load_strategy)
4747

4848
fq_class = lvsa_expectation.fq_class_with_java_prefix
4949
fq_variable_name = fq_class + '.output_int'

regression/LVSA/TestCasts/test_casts.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ def _get_folder_name():
1313

1414

1515
@fasteners.interprocess_locked(os.path.join(os.path.dirname(__file__), ".build_lock"))
16-
def test_cast_from_child(tmpdir):
16+
def test_cast_from_child(tmpdir, load_strategy):
1717
""" Test addition and removal of casts to DO's """
1818
with utils.working_dir(_get_this_file_dir()):
1919
os.system("javac Test.java")
2020
lvsa_driver = driver.LvsaDriver(tmpdir, _get_folder_name()).with_test_function('cast_from_child')
21-
lvsa_expectation = lvsa_driver.run()
21+
lvsa_expectation = lvsa_driver.run(load_strategy)
2222

2323
value_set_expectation = lvsa_expectation.get_value_set_for_public_static('interfaceFromChild')
2424
value_set_expectation.check_number_of_values(1)
@@ -30,12 +30,12 @@ def test_cast_from_child(tmpdir):
3030

3131

3232
@fasteners.interprocess_locked(os.path.join(os.path.dirname(__file__), ".build_lock"))
33-
def test_cast_from_parent(tmpdir):
33+
def test_cast_from_parent(tmpdir, load_strategy):
3434
""" Test addition and removal of casts to DO's """
3535
with utils.working_dir(_get_this_file_dir()):
3636
os.system("javac Test.java")
3737
lvsa_driver = driver.LvsaDriver(tmpdir, _get_folder_name()).with_test_function('cast_from_parent')
38-
lvsa_expectation = lvsa_driver.run()
38+
lvsa_expectation = lvsa_driver.run(load_strategy)
3939

4040
value_set_expectation = lvsa_expectation.get_value_set_for_public_static('interfaceFromParent')
4141
value_set_expectation.check_number_of_values(1)
@@ -47,12 +47,12 @@ def test_cast_from_parent(tmpdir):
4747

4848

4949
@fasteners.interprocess_locked(os.path.join(os.path.dirname(__file__), ".build_lock"))
50-
def test_cast_from_interface(tmpdir):
50+
def test_cast_from_interface(tmpdir, load_strategy):
5151
""" Test addition and removal of casts to DO's """
5252
with utils.working_dir(_get_this_file_dir()):
5353
os.system("javac Test.java")
5454
lvsa_driver = driver.LvsaDriver(tmpdir, _get_folder_name()).with_test_function('cast_from_interface')
55-
lvsa_expectation = lvsa_driver.run()
55+
lvsa_expectation = lvsa_driver.run(load_strategy)
5656

5757
value_set_expectation = lvsa_expectation.get_value_set_for_public_static('parentFromInterface')
5858
value_set_expectation.check_number_of_values(1)

0 commit comments

Comments
 (0)