Giacomo Travaglini has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/48969 )

Change subject: tests: pyunit always exiting with 0
......................................................................

tests: pyunit always exiting with 0

As unittest.TextTestRunner().run(suite) doesn't exit the script,
it won't set the exit code, even when some tests are failing.
This means testlib is always interpreting those unittests as passing
even when there are failures.

With this patch we are propagating the error to our CI system (testlib)

Change-Id: I63b7622661a19a9b40243d13b7391e510c2007d4
Signed-off-by: Giacomo Travaglini <giacomo.travagl...@arm.com>
---
M tests/run_pyunit.py
1 file changed, 7 insertions(+), 2 deletions(-)



diff --git a/tests/run_pyunit.py b/tests/run_pyunit.py
index 00f5f9c..8bc4f17 100644
--- a/tests/run_pyunit.py
+++ b/tests/run_pyunit.py
@@ -35,8 +35,9 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+import sys
+
 if __name__ == "__main__":
-    import sys
     print("ERROR: This file must be run from gem5.", file=sys.stderr)
     sys.exit(1)

@@ -47,5 +48,9 @@
     tests = loader.discover("pyunit", pattern='pyunit*.py')

     runner = unittest.runner.TextTestRunner(verbosity=2)
-    runner.run(tests)
+    result = runner.run(tests)
+    if result.wasSuccessful():
+        sys.exit(0)
+    else:
+        sys.exit(1)


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/48969
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I63b7622661a19a9b40243d13b7391e510c2007d4
Gerrit-Change-Number: 48969
Gerrit-PatchSet: 1
Gerrit-Owner: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to