From b540954e20a82c69ac5704de78f1855e47c1247e Mon Sep 17 00:00:00 2001 From: Hoa Nguyen Date: Thu, 3 Sep 2020 01:35:24 -0700 Subject: [PATCH] ext: Add post_test_procedure to testlib runner 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 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33997 Tested-by: kokoro Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- ext/testlib/fixture.py | 3 +++ ext/testlib/runner.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/ext/testlib/fixture.py b/ext/testlib/fixture.py index 79b57c00d..bcd22d922 100644 --- a/ext/testlib/fixture.py +++ b/ext/testlib/fixture.py @@ -70,6 +70,9 @@ class Fixture(object): def setup(self, testitem): pass + def post_test_procedure(self, testitem): + pass + def teardown(self, testitem): pass diff --git a/ext/testlib/runner.py b/ext/testlib/runner.py index a59aca3a4..ee658c966 100644 --- a/ext/testlib/runner.py +++ b/ext/testlib/runner.py @@ -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: -- 2.30.2