Bobby Bruce has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/64092?usp=email )

Change subject: tests: Add 'checkpoint-path' to simpoints stdlib example
......................................................................

tests: Add 'checkpoint-path' to simpoints stdlib example

The
'configs/example/gem5_library_checkpoints/simpoints-se-checkpoint.py'
example would dump the savepoint in the CWD. This is fine when running
as an example, but we also run this script as a test. In this case the
checkpoint litters the repository.

To fix this, an optional 'checkpoint-path' argument is added to this
example which specifies where the checkpoint is to be saved. In the
tests, the checkpoint is saved to 'tests/gem5/resources'. This is our
default location for resources needed/produced by tests and is ignored
by git.

Change-Id: I3dccc574b9e64d32386fd822ed7248ee365a0a08
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/64092
Maintainer: Jason Lowe-Power <power...@gmail.com>
Reviewed-by: Jason Lowe-Power <power...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M configs/example/gem5_library/checkpoints/simpoints-se-checkpoint.py
M tests/gem5/gem5_library_example_tests/test_gem5_library_examples.py
2 files changed, 43 insertions(+), 2 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/configs/example/gem5_library/checkpoints/simpoints-se-checkpoint.py b/configs/example/gem5_library/checkpoints/simpoints-se-checkpoint.py
index 6094f09..e3b3c4c 100644
--- a/configs/example/gem5_library/checkpoints/simpoints-se-checkpoint.py
+++ b/configs/example/gem5_library/checkpoints/simpoints-se-checkpoint.py
@@ -52,6 +52,7 @@
 ```
 """

+import argparse
 from gem5.simulate.exit_event import ExitEvent
 from gem5.simulate.simulator import Simulator
 from gem5.utils.requires import requires
@@ -68,6 +69,18 @@
     save_checkpoint_generator,
 )

+parser = argparse.ArgumentParser()
+
+parser.add_argument(
+    "--checkpoint-path",
+    type=str,
+    required=False,
+    default="se_checkpoint_folder/",
+    help="The directory to store the checkpoint.",
+)
+
+args = parser.parse_args()
+
 requires(isa_required=ISA.X86)

 # When taking a checkpoint, the cache state is not saved, so the cache
@@ -109,7 +122,7 @@
     simpoint=simpoint,
 )

-dir = Path("se_checkpoint_folder/")
+dir = Path(args.checkpoint_path)
 dir.mkdir(exist_ok=True)

 simulator = Simulator(
diff --git a/tests/gem5/gem5_library_example_tests/test_gem5_library_examples.py b/tests/gem5/gem5_library_example_tests/test_gem5_library_examples.py
index d60fbb3..d8bcf6b 100644
--- a/tests/gem5/gem5_library_example_tests/test_gem5_library_examples.py
+++ b/tests/gem5/gem5_library_example_tests/test_gem5_library_examples.py
@@ -106,7 +106,10 @@
         "checkpoints",
         "simpoints-se-checkpoint.py",
     ),
-    config_args=[],
+    config_args=[
+        "--checkpoint-path",
+        joinpath(resource_path, "se_checkpoint_folder-save"),
+    ],
     valid_isas=(constants.all_compiled_tag,),
     valid_hosts=constants.supported_hosts,
     length=constants.quick_tag,

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/64092?usp=email 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: I3dccc574b9e64d32386fd822ed7248ee365a0a08
Gerrit-Change-Number: 64092
Gerrit-PatchSet: 3
Gerrit-Owner: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.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

Reply via email to