Skip to content

Commit 9dae735

Browse files
committed
Testsuite: update after --disable-cleanup removal in e3-testsuite
(cherry picked from commit cd76dd9) TN: U920-044 Change-Id: If53103dde319aa7196374dcb523a9642a79ff4f4
1 parent 4f782f0 commit 9dae735

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

testsuite/drivers/data_validation.py

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from e3.fs import rm
22
from e3.testsuite.result import TestStatus, TestResult
3+
from e3.testsuite.utils import CleanupMode
34
from drivers import GNATcollTestDriver, gprbuild
45
import os
56

@@ -55,22 +56,28 @@ def validate_result(self, process, data_file, result):
5556
return True
5657

5758
def tear_down(self, previous_values, slot):
58-
# If the test program build failed, there is nothing we can do (and the
59-
# result for this test is alredy pushed anyway).
60-
if not previous_values.get('build'):
61-
return False
62-
63-
failures = [v for v in previous_values.values() if
64-
not isinstance(v, TestStatus) or v != TestStatus.PASS]
65-
if failures:
66-
self.result.set_status(TestStatus.FAIL,
67-
msg="%s subtests failed" % len(failures))
68-
else:
69-
self.result.set_status(TestStatus.PASS)
70-
71-
self.push_result()
72-
73-
if self.env.enable_cleanup:
59+
# If the build failed in the "build" fragment, we already pushed the
60+
# result.
61+
failed = True
62+
if previous_values.get('build'):
63+
failures = [v for v in previous_values.values() if
64+
not isinstance(v, TestStatus) or v != TestStatus.PASS]
65+
if failures:
66+
self.result.set_status(
67+
TestStatus.FAIL,
68+
msg="%s subtests failed" % len(failures)
69+
)
70+
else:
71+
failed = False
72+
self.result.set_status(TestStatus.PASS)
73+
74+
self.push_result()
75+
76+
# Cleanup temporaries if requested
77+
if (
78+
self.env.cleanup_mode == CleanupMode.ALL
79+
or (self.env.cleanup_mode == CleanupMode.PASSING and not failed)
80+
):
7481
rm(self.test_env['working_dir'], recursive=True)
7582

7683
def build(self, previous_values, slot):

testsuite/run-tests

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ class MyTestsuite(Testsuite):
4949
self.env.gcov = self.main.args.gcov
5050
self.env.gnatcov = self.main.args.gnatcov
5151
self.env.valgrind = self.main.args.valgrind
52-
self.env.enable_cleanup = self.main.args.enable_cleanup
5352

5453
# Reject incompatible options
5554
incompatible = [name for name in ('gcov', 'gnatcov', 'valgrind')

0 commit comments

Comments
 (0)