tests: Add Simpoints example scripts as tests
These both ensure these example scripts still work as intended and
provides tests for the stdlib Simpoint API.
Change-Id: I549c3d22458a5013a335857c83a4e78dc425e37d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63931
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
diff --git a/configs/example/gem5_library/checkpoints/simpoints-se-restore.py b/configs/example/gem5_library/checkpoints/simpoints-se-restore.py
index 1a1bb05..4d49d9d 100644
--- a/configs/example/gem5_library/checkpoints/simpoints-se-restore.py
+++ b/configs/example/gem5_library/checkpoints/simpoints-se-restore.py
@@ -107,12 +107,13 @@
binary=Resource("x86-print-this"), arguments=["print this", 15000]
)
-# configs/example/gem5_library/checkpoints/simpoints-se-checkpoint.py has to
-# run before running this script.
-# In here, it will get the path of the first SimPoint checkpoint taken by the
-# simpoints-se-checkpoint.py
-dir = Path("se_checkpoint_folder")
-subfolder = [int(str(name).split(".")[1]) for name in dir.iterdir()]
+# Here we obtain the checkpoints from gem5 resources, but these are generated
+# from `configs/example/gem5_library/checkpoints/simpoints-se-checkpoint.py`.If
+# run prior to this script the `dir = Path("se_checkpoint_folder")` line may be
+# used. The resource is pulled so we may run this script as a test.
+# dir = Path("se_checkpoint_folder")
+dir = Path(Resource("simpoints-se-checkpoints-v22-1").get_local_path())
+subfolder = [int(str(name).rsplit(".", 1)[1]) for name in dir.iterdir()]
dir = Path(dir / f"cpt.{min(subfolder)}").as_posix()
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 0acc1ae..ee212ae 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
@@ -86,6 +86,42 @@
length=constants.quick_tag,
)
+gem5_verify_config(
+ name="test-simpoints-se-checkpoint",
+ fixtures=(),
+ verifiers=(),
+ config=joinpath(
+ config.base_dir,
+ "configs",
+ "example",
+ "gem5_library",
+ "checkpoints",
+ "simpoints-se-checkpoint.py",
+ ),
+ config_args=[],
+ valid_isas=(constants.all_compiled_tag,),
+ valid_hosts=constants.supported_hosts,
+ length=constants.quick_tag,
+)
+
+gem5_verify_config(
+ name="test-simpoints-se-restore",
+ fixtures=(),
+ verifiers=(),
+ config=joinpath(
+ config.base_dir,
+ "configs",
+ "example",
+ "gem5_library",
+ "checkpoints",
+ "simpoints-se-restore.py",
+ ),
+ config_args=[],
+ valid_isas=(constants.all_compiled_tag,),
+ valid_hosts=constants.supported_hosts,
+ length=constants.quick_tag,
+)
+
if os.access("/dev/kvm", mode=os.R_OK | os.W_OK):
# The x86-ubuntu-run uses KVM cores, this test will therefore only be run
# on systems that support KVM.