From: Hoa Nguyen Date: Thu, 3 Sep 2020 08:36:35 +0000 (-0700) Subject: ext,tests: Copy test's output files from /tmp to testing-results X-Git-Tag: v20.1.0.0~67 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=caf09cc5653c6f1abc2ba81010a7b37e3643e80d;p=gem5.git 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 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33998 Tested-by: kokoro Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- diff --git a/tests/gem5/fixture.py b/tests/gem5/fixture.py index 94f358134..bb911dde0 100644 --- a/tests/gem5/fixture.py +++ b/tests/gem5/fixture.py @@ -67,6 +67,23 @@ class TempdirFixture(Fixture): 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)