|
1 | 1 | from e3.fs import rm
|
2 | 2 | from e3.testsuite.result import TestStatus, TestResult
|
| 3 | +from e3.testsuite.utils import CleanupMode |
3 | 4 | from drivers import GNATcollTestDriver, gprbuild
|
4 | 5 | import os
|
5 | 6 |
|
@@ -55,22 +56,28 @@ def validate_result(self, process, data_file, result):
|
55 | 56 | return True
|
56 | 57 |
|
57 | 58 | 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 | + ): |
74 | 81 | rm(self.test_env['working_dir'], recursive=True)
|
75 | 82 |
|
76 | 83 | def build(self, previous_values, slot):
|
|
0 commit comments