Jason Lowe-Power has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/19529 )

Change subject: tests: Update tests to save output on failure
......................................................................

tests: Update tests to save output on failure

The previous commit which tried to do this, did not work with parallel
execution. In this case, the fixtures that were modified were in the
child process and the parent process's fixtures were never updated.
Instead of modifying the object, use the information passed in from the
testlib.

See 4c28149ffa5d09e6fe14952dcaf8df5d0cd8f328
Previous review:
https://gem5-review.googlesource.com/c/public/gem5/+/17451

Change-Id: Ib4c06c5e3f82994199d6f0c1fa69452e93444d75
Signed-off-by: Jason Lowe-Power <ja...@lowepower.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/19529
Reviewed-by: Bobby R. Bruce <bbr...@ucdavis.edu>
Reviewed-by: Nikos Nikoleris <nikos.nikole...@arm.com>
Maintainer: Jason Lowe-Power <power...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M tests/gem5/fixture.py
M tests/gem5/verifier.py
2 files changed, 2 insertions(+), 17 deletions(-)

Approvals:
  Nikos Nikoleris: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved
  Jason Lowe-Power: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/tests/gem5/fixture.py b/tests/gem5/fixture.py
index aa316e7..fc31b30 100644
--- a/tests/gem5/fixture.py
+++ b/tests/gem5/fixture.py
@@ -49,6 +49,7 @@
 from testlib.config import config, constants
 from testlib.helper import log_call, cacheresult, joinpath, absdirpath
 import testlib.log as log
+from testlib.state import Result


 class VariableFixture(Fixture):
@@ -67,13 +68,9 @@
         self.path = tempfile.mkdtemp(prefix='gem5out')

     def teardown(self, testitem):
-        if self.path is not None:
+        if testitem.result == Result.Passed:
             shutil.rmtree(self.path)

-    def skip_cleanup(self):
-        # Set path to none so it's not deleted
-        self.path = None
-
 class UniqueFixture(Fixture):
     '''
     Base class for fixtures that generate a target in the
diff --git a/tests/gem5/verifier.py b/tests/gem5/verifier.py
index 73a7499..c955c40 100644
--- a/tests/gem5/verifier.py
+++ b/tests/gem5/verifier.py
@@ -47,16 +47,6 @@
         return test.TestFunction(self._test,
                 name=name, fixtures=self.fixtures)

-    def failed(self, fixtures):
-        '''
-        Called if this verifier fails to cleanup (or not) as needed.
-        '''
-        try:
-            fixtures[constants.tempdir_fixture_name].skip_cleanup()
-        except KeyError:
- pass # No need to do anything if the tempdir fixture doesn't exist
-
-
 class MatchGoldStandard(Verifier):
     '''
     Compares a standard output to the test output and passes if they match,
@@ -90,7 +80,6 @@
                             ignore_regexes=self.ignore_regex,
                             logger=params.log)
         if diff is not None:
-            self.failed(fixtures)
             test.fail('Stdout did not match:\n%s\nSee %s for full results'
                       % (diff, tempdir))

@@ -195,7 +184,6 @@
             if parse_file(joinpath(tempdir,
                                    constants.gem5_simulation_stderr)):
                 return # Success
-        self.failed(fixtures)
         test.fail('Could not match regex.')

 _re_type = type(re.compile(''))

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/19529
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: Ib4c06c5e3f82994199d6f0c1fa69452e93444d75
Gerrit-Change-Number: 19529
Gerrit-PatchSet: 4
Gerrit-Owner: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
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