Skip to content

Commit

Permalink
Testsuite: update after --disable-cleanup removal in e3-testsuite
Browse files Browse the repository at this point in the history
(cherry picked from commit cd76dd9)

TN: U920-044
Change-Id: If53103dde319aa7196374dcb523a9642a79ff4f4
  • Loading branch information
pmderodat committed Oct 6, 2021
1 parent 4f782f0 commit 9dae735
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
39 changes: 23 additions & 16 deletions testsuite/drivers/data_validation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from e3.fs import rm
from e3.testsuite.result import TestStatus, TestResult
from e3.testsuite.utils import CleanupMode
from drivers import GNATcollTestDriver, gprbuild
import os

Expand Down Expand Up @@ -55,22 +56,28 @@ def validate_result(self, process, data_file, result):
return True

def tear_down(self, previous_values, slot):
# If the test program build failed, there is nothing we can do (and the
# result for this test is alredy pushed anyway).
if not previous_values.get('build'):
return False

failures = [v for v in previous_values.values() if
not isinstance(v, TestStatus) or v != TestStatus.PASS]
if failures:
self.result.set_status(TestStatus.FAIL,
msg="%s subtests failed" % len(failures))
else:
self.result.set_status(TestStatus.PASS)

self.push_result()

if self.env.enable_cleanup:
# If the build failed in the "build" fragment, we already pushed the
# result.
failed = True
if previous_values.get('build'):
failures = [v for v in previous_values.values() if
not isinstance(v, TestStatus) or v != TestStatus.PASS]
if failures:
self.result.set_status(
TestStatus.FAIL,
msg="%s subtests failed" % len(failures)
)
else:
failed = False
self.result.set_status(TestStatus.PASS)

self.push_result()

# Cleanup temporaries if requested
if (
self.env.cleanup_mode == CleanupMode.ALL
or (self.env.cleanup_mode == CleanupMode.PASSING and not failed)
):
rm(self.test_env['working_dir'], recursive=True)

def build(self, previous_values, slot):
Expand Down
1 change: 0 additions & 1 deletion testsuite/run-tests
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class MyTestsuite(Testsuite):
self.env.gcov = self.main.args.gcov
self.env.gnatcov = self.main.args.gnatcov
self.env.valgrind = self.main.args.valgrind
self.env.enable_cleanup = self.main.args.enable_cleanup

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

0 comments on commit 9dae735

Please sign in to comment.