ext: Add post_test_procedure to testlib runner
authorHoa Nguyen <hoanguyen@ucdavis.edu>
Thu, 3 Sep 2020 08:35:24 +0000 (01:35 -0700)
committerHoa Nguyen <hoanguyen@ucdavis.edu>
Tue, 8 Sep 2020 18:28:17 +0000 (18:28 +0000)
This procedure is trigger after a test has finished and before
the tearing down process kicks in.

Change-Id: I58ce10814fbc80d96f2f72565491b18de0ec290a
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33997
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>

ext/testlib/fixture.py
ext/testlib/runner.py

index 79b57c00d6ec3402ba545a4c0320511c9f90a728..bcd22d9220d91f1c4180b393e258a91fdb195c9a 100644 (file)
@@ -70,6 +70,9 @@ class Fixture(object):
     def setup(self, testitem):
         pass
 
+    def post_test_procedure(self, testitem):
+        pass
+
     def teardown(self, testitem):
         pass
 
index a59aca3a49e6733a75960a1087f880d60e63d331..ee658c966515946db24bcfe61cba8f5e355eac99 100644 (file)
@@ -128,6 +128,7 @@ class RunnerPattern:
             self.testable.status = Status.Running
             self.test()
         finally:
+            self.builder.post_test_procedure(self.testable)
             self.testable.status = Status.TearingDown
             self.builder.teardown(self.testable)
 
@@ -209,6 +210,10 @@ class FixtureBuilder(object):
                 raise BrokenFixtureException(fixture, testitem,
                         traceback.format_exc())
 
+    def post_test_procedure(self, testitem):
+        for fixture in self.built_fixtures:
+            fixture.post_test_procedure(testitem)
+
     def teardown(self, testitem):
         for fixture in self.built_fixtures:
             try: