ext,tests: Add back failing exceptions
authorJason Lowe-Power <jason@lowepower.com>
Thu, 14 Mar 2019 23:24:11 +0000 (16:24 -0700)
committerJason Lowe-Power <jason@lowepower.com>
Thu, 21 Mar 2019 15:57:10 +0000 (15:57 +0000)
Change-Id: Idf4ba8a2a3888787abf33d1a4ac52fcf146ce732
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17452
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
ext/testlib/test.py

index 8e2de49466b00c66c71d24e8406a2e43f104d9d5..18899d6d0ffdda40b34bf3d6f873011fc1c4ede5 100644 (file)
@@ -31,6 +31,21 @@ import functools
 import helper
 import runner as runner_mod
 
+class TestingException(Exception):
+    '''Common ancestor for manual Testing Exceptions.'''
+class TestFailException(TestingException):
+    '''Signals that a test has failed.'''
+class TestSkipException(TestingException):
+    '''Signals that a test has been skipped.'''
+
+def fail(message):
+    '''Cause the current test to fail with the given message.'''
+    raise TestFailException(message)
+
+def skip(message):
+    '''Cause the current test to skip with the given message.'''
+    raise TestSkipException(message)
+
 class TestCase(object):
     '''
     Base class for all tests.
@@ -88,4 +103,4 @@ def testfunction(function=None, name=None, fixtures=tuple()):
     if function is not None:
         return testfunctiondecorator(function)
     else:
-        return testfunctiondecorator
\ No newline at end of file
+        return testfunctiondecorator