Hoa Nguyen has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/33998 )

Change subject: ext,tests: Copy test's output files from /tmp to testing-results
......................................................................

ext,tests: Copy test's output files from /tmp to testing-results

When a test is complete, the output files are in a random folder
in /tmp.

This commit adds a procedure copying those files to
testing-results/SuiteUID/TestUID/ folder, where SuiteUID and
TestUID are the corresponding uid's of the test.

This procedure is triggered after a test is complete and before
the folder in /tmp being removed.

Change-Id: Id960e7f2f1629769008ae99aff4c8bfafa9ca849
Signed-off-by: Hoa Nguyen <[email protected]>
---
M tests/gem5/fixture.py
1 file changed, 18 insertions(+), 1 deletion(-)



diff --git a/tests/gem5/fixture.py b/tests/gem5/fixture.py
index fc6aee8..5b37d49 100644
--- a/tests/gem5/fixture.py
+++ b/tests/gem5/fixture.py
@@ -47,7 +47,7 @@

 from testlib.fixture import Fixture
 from testlib.configuration import config, constants
-from testlib.helper import log_call, cacheresult, joinpath, absdirpath
+from testlib.helper import log_call, cacheresult, joinpath, absdirpath, mkdir_p
 import testlib.log as log
 from testlib.state import Result

@@ -67,6 +67,23 @@
     def setup(self, testitem):
         self.path = tempfile.mkdtemp(prefix='gem5out')

+    def post_test_procedure(self, testitem):
+        suiteUID = testitem.metadata.uid.suite
+        testUID = testitem.metadata.name
+        testing_result_folder = os.path.join(config.result_path,
+                                             "SuiteUID:" + suiteUID,
+                                             "TestUID:" + testUID)
+
+        # Copy the output files of the run from /tmp to testing-results
+ # We want to wipe the entire result folder for this test first. Why? + # If the result folder exists (probably from the previous run), if
+        #   this run emits fewer files, there'll be files from the previous
+        #   run in this folder, which would cause confusion if one does not
+        #   check the timestamp of the file.
+        if os.path.exists(testing_result_folder):
+            shutil.rmtree(testing_result_folder)
+        shutil.copytree(self.path, testing_result_folder)
+
     def teardown(self, testitem):
         if testitem.result == Result.Passed:
             shutil.rmtree(self.path)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/33998
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: Id960e7f2f1629769008ae99aff4c8bfafa9ca849
Gerrit-Change-Number: 33998
Gerrit-PatchSet: 1
Gerrit-Owner: Hoa Nguyen <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to