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.jg@gmail.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Bobby Bruce
parent
64a087e5e8
commit
f59eb93660
@@ -52,6 +52,7 @@ scons build/X86/gem5.opt
|
||||
```
|
||||
"""
|
||||
|
||||
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 @@ from gem5.simulate.exit_event_generators import (
|
||||
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 @@ board.set_se_binary_workload(
|
||||
simpoint=simpoint,
|
||||
)
|
||||
|
||||
dir = Path("se_checkpoint_folder/")
|
||||
dir = Path(args.checkpoint_path)
|
||||
dir.mkdir(exist_ok=True)
|
||||
|
||||
simulator = Simulator(
|
||||
|
||||
Reference in New Issue
Block a user