Skip to content

Commit dbdd915

Browse files
feat: updated test structure
1 parent 9974344 commit dbdd915

File tree

39 files changed

+352
-469
lines changed

39 files changed

+352
-469
lines changed

test/end_to_end/do_all/backwards_array_access/test.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
class TestMethods(unittest.TestCase):
15-
def test(self):
15+
def setUp(self):
1616
current_dir = pathlib.Path(__file__).parent.resolve()
1717
dp_build_dir = run_config_provider(
1818
ConfigProviderArguments(
@@ -44,19 +44,16 @@ def test(self):
4444
cwd = os.path.join(src_dir, ".discopop")
4545
cmd = "discopop_explorer --enable-patterns doall,reduction"
4646
run_cmd(cmd, cwd, env_vars)
47-
# validate results
48-
try:
49-
self.validate_results(current_dir, src_dir)
50-
# clean environment
51-
run_cmd("make veryclean", src_dir, env_vars)
52-
except Exception as ex:
53-
# clean environment
54-
run_cmd("make veryclean", src_dir, env_vars)
55-
raise ex
5647

57-
def validate_results(self, test_dir, src_dir):
48+
self.src_dir = src_dir
49+
self.env_vars = env_vars
50+
51+
def tearDown(self):
52+
run_cmd("make veryclean", self.src_dir, self.env_vars)
53+
54+
def test(self):
5855
"""Check that exactly one do-all is suggested"""
59-
test_output_file = os.path.join(src_dir, ".discopop", "explorer", "detection_result_dump.json")
56+
test_output_file = os.path.join(self.src_dir, ".discopop", "explorer", "detection_result_dump.json")
6057
# load detection results
6158
with open(test_output_file, "r") as f:
6259
tmp_str = f.read()

test/end_to_end/do_all/calls/LULESH_proxy/test.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
class TestMethods(unittest.TestCase):
17-
def test(self):
17+
def setUp(self):
1818
current_dir = pathlib.Path(__file__).parent.resolve()
1919
dp_build_dir = run_config_provider(
2020
ConfigProviderArguments(
@@ -46,19 +46,16 @@ def test(self):
4646
cwd = os.path.join(src_dir, ".discopop")
4747
cmd = "discopop_explorer --enable-patterns doall,reduction"
4848
run_cmd(cmd, cwd, env_vars)
49-
# validate results
50-
try:
51-
self.validate_results(current_dir, src_dir)
52-
# clean environment
53-
run_cmd("make veryclean", src_dir, env_vars)
54-
except Exception as ex:
55-
# clean environment
56-
run_cmd("make veryclean", src_dir, env_vars)
57-
raise ex
49+
50+
self.src_dir = src_dir
51+
self.env_vars = env_vars
52+
53+
def tearDown(self):
54+
run_cmd("make veryclean", self.src_dir, self.env_vars)
5855

59-
def validate_results(self, test_dir, src_dir):
56+
def test(self):
6057
"""Check that main loop do-all is suggested"""
61-
test_output_file = os.path.join(src_dir, ".discopop", "explorer", "detection_result_dump.json")
58+
test_output_file = os.path.join(self.src_dir, ".discopop", "explorer", "detection_result_dump.json")
6259
# load detection results
6360
with open(test_output_file, "r") as f:
6461
tmp_str = f.read()

test/end_to_end/do_all/calls/above_nesting_level_3/test.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
class TestMethods(unittest.TestCase):
15-
def test(self):
15+
def setUp(self):
1616
current_dir = pathlib.Path(__file__).parent.resolve()
1717
dp_build_dir = run_config_provider(
1818
ConfigProviderArguments(
@@ -44,19 +44,17 @@ def test(self):
4444
cwd = os.path.join(src_dir, ".discopop")
4545
cmd = "discopop_explorer --enable-patterns doall,reduction"
4646
run_cmd(cmd, cwd, env_vars)
47-
# validate results
48-
try:
49-
self.validate_results(current_dir, src_dir)
50-
# clean environment
51-
run_cmd("make veryclean", src_dir, env_vars)
52-
except Exception as ex:
53-
# clean environment
54-
run_cmd("make veryclean", src_dir, env_vars)
55-
raise ex
5647

57-
def validate_results(self, test_dir, src_dir):
48+
self.src_dir = src_dir
49+
self.env_vars = env_vars
50+
51+
def tearDown(self):
52+
run_cmd("make veryclean", self.src_dir, self.env_vars)
53+
54+
55+
def test(self):
5856
"""Check that exactly one do-all is suggested"""
59-
test_output_file = os.path.join(src_dir, ".discopop", "explorer", "detection_result_dump.json")
57+
test_output_file = os.path.join(self.src_dir, ".discopop", "explorer", "detection_result_dump.json")
6058
# load detection results
6159
with open(test_output_file, "r") as f:
6260
tmp_str = f.read()

test/end_to_end/do_all/calls/allowing/test.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
class TestMethods(unittest.TestCase):
15-
def test(self):
15+
def setUp(self):
1616
current_dir = pathlib.Path(__file__).parent.resolve()
1717
dp_build_dir = run_config_provider(
1818
ConfigProviderArguments(
@@ -44,19 +44,16 @@ def test(self):
4444
cwd = os.path.join(src_dir, ".discopop")
4545
cmd = "discopop_explorer --enable-patterns doall,reduction"
4646
run_cmd(cmd, cwd, env_vars)
47-
# validate results
48-
try:
49-
self.validate_results(current_dir, src_dir)
50-
# clean environment
51-
run_cmd("make veryclean", src_dir, env_vars)
52-
except Exception as ex:
53-
# clean environment
54-
run_cmd("make veryclean", src_dir, env_vars)
55-
raise ex
47+
48+
self.src_dir = src_dir
49+
self.env_vars = env_vars
50+
51+
def tearDown(self):
52+
run_cmd("make veryclean", self.src_dir, self.env_vars)
5653

57-
def validate_results(self, test_dir, src_dir):
54+
def test(self):
5855
"""Check that exactly one do-all is suggested"""
59-
test_output_file = os.path.join(src_dir, ".discopop", "explorer", "detection_result_dump.json")
56+
test_output_file = os.path.join(self.src_dir, ".discopop", "explorer", "detection_result_dump.json")
6057
# load detection results
6158
with open(test_output_file, "r") as f:
6259
tmp_str = f.read()

test/end_to_end/do_all/calls/allowing_2/test.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
class TestMethods(unittest.TestCase):
15-
def test(self):
15+
def setUp(self):
1616
current_dir = pathlib.Path(__file__).parent.resolve()
1717
dp_build_dir = run_config_provider(
1818
ConfigProviderArguments(
@@ -44,19 +44,16 @@ def test(self):
4444
cwd = os.path.join(src_dir, ".discopop")
4545
cmd = "discopop_explorer --enable-patterns doall,reduction"
4646
run_cmd(cmd, cwd, env_vars)
47-
# validate results
48-
try:
49-
self.validate_results(current_dir, src_dir)
50-
# clean environment
51-
run_cmd("make veryclean", src_dir, env_vars)
52-
except Exception as ex:
53-
# clean environment
54-
run_cmd("make veryclean", src_dir, env_vars)
55-
raise ex
47+
48+
self.src_dir = src_dir
49+
self.env_vars = env_vars
50+
51+
def tearDown(self):
52+
run_cmd("make veryclean", self.src_dir, self.env_vars)
5653

57-
def validate_results(self, test_dir, src_dir):
54+
def test(self):
5855
"""Check that exactly one do-all is suggested"""
59-
test_output_file = os.path.join(src_dir, ".discopop", "explorer", "detection_result_dump.json")
56+
test_output_file = os.path.join(self.src_dir, ".discopop", "explorer", "detection_result_dump.json")
6057
# load detection results
6158
with open(test_output_file, "r") as f:
6259
tmp_str = f.read()

test/end_to_end/do_all/calls/complex/test.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
class TestMethods(unittest.TestCase):
17-
def test(self):
17+
def setUp(self):
1818
current_dir = pathlib.Path(__file__).parent.resolve()
1919
dp_build_dir = run_config_provider(
2020
ConfigProviderArguments(
@@ -45,19 +45,16 @@ def test(self):
4545
# execute DiscoPoP analysis
4646
cmd = "discopop_explorer --enable-patterns doall,reduction"
4747
run_cmd(cmd, os.path.join(src_dir, ".discopop"), env_vars)
48-
# validate results
49-
try:
50-
self.validate_results(current_dir, src_dir)
51-
# clean environment
52-
run_cmd("make veryclean", src_dir, env_vars)
53-
except Exception as ex:
54-
# clean environment
55-
run_cmd("make veryclean", src_dir, env_vars)
56-
raise ex
48+
49+
self.src_dir = src_dir
50+
self.env_vars = env_vars
51+
52+
def tearDown(self):
53+
run_cmd("make veryclean", self.src_dir, self.env_vars)
5754

58-
def validate_results(self, test_dir, src_dir):
55+
def test(self):
5956
"""Check that exactly one do-all is suggested"""
60-
test_output_file = os.path.join(src_dir, ".discopop", "explorer", "detection_result_dump.json")
57+
test_output_file = os.path.join(self.src_dir, ".discopop", "explorer", "detection_result_dump.json")
6158
# load detection results
6259
with open(test_output_file, "r") as f:
6360
tmp_str = f.read()

test/end_to_end/do_all/calls/preventing/simple/test.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
class TestMethods(unittest.TestCase):
16-
def test(self):
16+
def setUp(self):
1717
current_dir = pathlib.Path(__file__).parent.resolve()
1818
dp_build_dir = run_config_provider(
1919
ConfigProviderArguments(
@@ -47,19 +47,16 @@ def test(self):
4747
cwd = os.path.join(src_dir, ".discopop")
4848
cmd = "discopop_explorer --enable-patterns doall,reduction"
4949
run_cmd(cmd, cwd, env_vars)
50-
# validate results
51-
try:
52-
self.validate_results(current_dir, src_dir)
53-
# clean environment
54-
run_cmd("make veryclean", src_dir, env_vars)
55-
except Exception as ex:
56-
# clean environment
57-
run_cmd("make veryclean", src_dir, env_vars)
58-
raise ex
5950

60-
def validate_results(self, test_dir, src_dir):
51+
self.src_dir = src_dir
52+
self.env_vars = env_vars
53+
54+
def tearDown(self):
55+
run_cmd("make veryclean", self.src_dir, self.env_vars)
56+
57+
def test(self):
6158
"""Check that exactly one do-all is suggested"""
62-
test_output_file = os.path.join(src_dir, ".discopop", "explorer", "detection_result_dump.json")
59+
test_output_file = os.path.join(self.src_dir, ".discopop", "explorer", "detection_result_dump.json")
6360
# load detection results
6461
with open(test_output_file, "r") as f:
6562
tmp_str = f.read()

test/end_to_end/do_all/calls/second_order/allowing/test.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
class TestMethods(unittest.TestCase):
15-
def test(self):
15+
def setUp(self):
1616
current_dir = pathlib.Path(__file__).parent.resolve()
1717
dp_build_dir = run_config_provider(
1818
ConfigProviderArguments(
@@ -44,19 +44,16 @@ def test(self):
4444
cwd = os.path.join(src_dir, ".discopop")
4545
cmd = "discopop_explorer --enable-patterns doall,reduction"
4646
run_cmd(cmd, cwd, env_vars)
47-
# validate results
48-
try:
49-
self.validate_results(current_dir, src_dir)
50-
# clean environment
51-
run_cmd("make veryclean", src_dir, env_vars)
52-
except Exception as ex:
53-
# clean environment
54-
run_cmd("make veryclean", src_dir, env_vars)
55-
raise ex
5647

57-
def validate_results(self, test_dir, src_dir):
48+
self.src_dir = src_dir
49+
self.env_vars = env_vars
50+
51+
def tearDown(self):
52+
run_cmd("make veryclean", self.src_dir, self.env_vars)
53+
54+
def validate_results(self):
5855
"""Check that exactly one do-all is suggested"""
59-
test_output_file = os.path.join(src_dir, ".discopop", "explorer", "detection_result_dump.json")
56+
test_output_file = os.path.join(self.src_dir, ".discopop", "explorer", "detection_result_dump.json")
6057
# load detection results
6158
with open(test_output_file, "r") as f:
6259
tmp_str = f.read()

test/end_to_end/do_all/calls/second_order/allowing_2/test.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
class TestMethods(unittest.TestCase):
15-
def test(self):
15+
def setUp(self):
1616
current_dir = pathlib.Path(__file__).parent.resolve()
1717
dp_build_dir = run_config_provider(
1818
ConfigProviderArguments(
@@ -44,19 +44,16 @@ def test(self):
4444
cwd = os.path.join(src_dir, ".discopop")
4545
cmd = "discopop_explorer --enable-patterns doall,reduction"
4646
run_cmd(cmd, cwd, env_vars)
47-
# validate results
48-
try:
49-
self.validate_results(current_dir, src_dir)
50-
# clean environment
51-
run_cmd("make veryclean", src_dir, env_vars)
52-
except Exception as ex:
53-
# clean environment
54-
run_cmd("make veryclean", src_dir, env_vars)
55-
raise ex
5647

57-
def validate_results(self, test_dir, src_dir):
48+
self.src_dir = src_dir
49+
self.env_vars = env_vars
50+
51+
def tearDown(self):
52+
run_cmd("make veryclean", self.src_dir, self.env_vars)
53+
54+
def test(self):
5855
"""Check that exactly one do-all is suggested"""
59-
test_output_file = os.path.join(src_dir, ".discopop", "explorer", "detection_result_dump.json")
56+
test_output_file = os.path.join(self.src_dir, ".discopop", "explorer", "detection_result_dump.json")
6057
# load detection results
6158
with open(test_output_file, "r") as f:
6259
tmp_str = f.read()

test/end_to_end/do_all/calls/second_order/preventing/test.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
class TestMethods(unittest.TestCase):
16-
def test(self):
16+
def setUp(self):
1717
current_dir = pathlib.Path(__file__).parent.resolve()
1818
dp_build_dir = run_config_provider(
1919
ConfigProviderArguments(
@@ -47,19 +47,16 @@ def test(self):
4747
cwd = os.path.join(src_dir, ".discopop")
4848
cmd = "discopop_explorer --enable-patterns doall,reduction"
4949
run_cmd(cmd, cwd, env_vars)
50-
# validate results
51-
try:
52-
self.validate_results(current_dir, src_dir)
53-
# clean environment
54-
run_cmd("make veryclean", src_dir, env_vars)
55-
except Exception as ex:
56-
# clean environment
57-
run_cmd("make veryclean", src_dir, env_vars)
58-
raise ex
5950

60-
def validate_results(self, test_dir, src_dir):
51+
self.src_dir = src_dir
52+
self.env_vars = env_vars
53+
54+
def tearDown(self):
55+
run_cmd("make veryclean", self.src_dir, self.env_vars)
56+
57+
def test(self):
6158
"""Check that exactly one do-all is suggested"""
62-
test_output_file = os.path.join(src_dir, ".discopop", "explorer", "detection_result_dump.json")
59+
test_output_file = os.path.join(self.src_dir, ".discopop", "explorer", "detection_result_dump.json")
6360
# load detection results
6461
with open(test_output_file, "r") as f:
6562
tmp_str = f.read()

0 commit comments

Comments
 (0)