util-gem5art: Simplify gem5art Run

This changeset removes some of the duplicate information in the gem5 run
object making it a little simpler to use the createRun functions.

Change-Id: I36ee105166e41407c21e36d9bc71fd4db89fb1e8
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/47465
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
diff --git a/util/gem5art/run/gem5art/run.py b/util/gem5art/run/gem5art/run.py
index a32d899..89bd463 100644
--- a/util/gem5art/run/gem5art/run.py
+++ b/util/gem5art/run/gem5art/run.py
@@ -57,7 +57,7 @@
     hash: str
     type: str
     name: str
-    gem5_binary: Path
+    gem5_binary_path: Path
     run_script: Path
     gem5_artifact: Artifact
     gem5_git_artifact: Artifact
@@ -74,8 +74,8 @@
 
     outdir: Path
 
-    linux_binary: Path
-    disk_image: Path
+    linux_binary_path: Path
+    disk_image_path: Path
     linux_binary_artifact: Artifact
     disk_image_artifact: Artifact
 
@@ -100,7 +100,6 @@
     def _create(
         cls,
         name: str,
-        gem5_binary: Path,
         run_script: Path,
         outdir: Path,
         gem5_artifact: Artifact,
@@ -115,7 +114,7 @@
         """
         run = cls()
         run.name = name
-        run.gem5_binary = gem5_binary
+        run.gem5_binary_path = gem5_artifact.path
         run.run_script = run_script
         run.gem5_artifact = gem5_artifact
         run.gem5_git_artifact = gem5_git_artifact
@@ -131,7 +130,7 @@
         run.outdir = outdir.resolve()  # ensure this is absolute
 
         # Assumes **/<gem5_name>/gem5.<anything>
-        run.gem5_name = run.gem5_binary.parent.name
+        run.gem5_name = run.gem5_binary_path.parent.name
         # Assumes **/<script_name>.py
         run.script_name = run.run_script.stem
 
@@ -157,7 +156,6 @@
     def createSERun(
         cls,
         name: str,
-        gem5_binary: str,
         run_script: str,
         outdir: str,
         gem5_artifact: Artifact,
@@ -171,8 +169,7 @@
         name is the name of the run. The name is not necessarily unique. The
         name could be used to query the results of the run.
 
-        gem5_binary and run_script are the paths to the binary to run
-        and the script to pass to gem5. Full paths are better.
+        run_script is the path to the run script to pass to gem5.
 
         The artifact parameters (gem5_artifact, gem5_git_artifact, and
         run_script_git_artifact) are used to ensure this is reproducible run.
@@ -188,7 +185,6 @@
 
         run = cls._create(
             name,
-            Path(gem5_binary),
             Path(run_script),
             Path(outdir),
             gem5_artifact,
@@ -209,7 +205,7 @@
         run.string += " ".join(run.params)
 
         run.command = [
-            str(run.gem5_binary),
+            str(run.gem5_binary_path),
             "-re",
             f"--outdir={run.outdir}",
             str(run.run_script),
@@ -229,14 +225,11 @@
     def createFSRun(
         cls,
         name: str,
-        gem5_binary: str,
         run_script: str,
         outdir: str,
         gem5_artifact: Artifact,
         gem5_git_artifact: Artifact,
         run_script_git_artifact: Artifact,
-        linux_binary: str,
-        disk_image: str,
         linux_binary_artifact: Artifact,
         disk_image_artifact: Artifact,
         *params: str,
@@ -247,11 +240,7 @@
         name is the name of the run. The name is not necessarily unique. The
         name could be used to query the results of the run.
 
-        gem5_binary and run_script are the paths to the binary to run
-        and the script to pass to gem5.
-
-        The linux_binary is the kernel to run and the disk_image is the path
-        to the disk image to use.
+        run_script is the path to the run script to pass to gem5.
 
         Further parameters can be passed via extra arguments. These
         parameters will be passed in order to the gem5 run script.
@@ -264,10 +253,8 @@
         a file `info.json` in the outdir which contains a serialized version
         of this class.
         """
-
         run = cls._create(
             name,
-            Path(gem5_binary),
             Path(run_script),
             Path(outdir),
             gem5_artifact,
@@ -277,15 +264,15 @@
             timeout,
             check_failure,
         )
-        run.linux_binary = Path(linux_binary)
-        run.disk_image = Path(disk_image)
+        run.linux_binary_path = Path(linux_binary_artifact.path)
+        run.disk_image_path = Path(disk_image_artifact.path)
         run.linux_binary_artifact = linux_binary_artifact
         run.disk_image_artifact = disk_image_artifact
 
         # Assumes **/<linux_name>
-        run.linux_name = run.linux_binary.name
+        run.linux_name = run.linux_binary_path.name
         # Assumes **/<disk_name>
-        run.disk_name = run.disk_image.name
+        run.disk_name = disk_image_artifact.name
 
         run.artifacts = [
             gem5_artifact,
@@ -298,14 +285,13 @@
         run.string = f"{run.gem5_name} {run.script_name} "
         run.string += f"{run.linux_name} {run.disk_name} "
         run.string += " ".join(run.params)
-
         run.command = [
-            str(run.gem5_binary),
+            str(run.gem5_binary_path),
             "-re",
             f"--outdir={run.outdir}",
             str(run.run_script),
-            str(run.linux_binary),
-            str(run.disk_image),
+            str(run.linux_binary_path),
+            str(run.disk_image_path),
         ]
         run.command += list(params)
 
diff --git a/util/gem5art/run/tests/test_run.py b/util/gem5art/run/tests/test_run.py
index 35011c2..1710dbc 100644
--- a/util/gem5art/run/tests/test_run.py
+++ b/util/gem5art/run/tests/test_run.py
@@ -45,7 +45,7 @@
                 "type": "test-binary",
                 "documentation": "This is a description of gem5 artifact",
                 "command": "scons build/X86/gem5.opt",
-                "path": "/",
+                "path": "gem5/build/X86/gem5.opt",
                 "hash": hashlib.md5().hexdigest(),
                 "git": artifact.getGit(Path(".")),
                 "cwd": "/",
@@ -85,7 +85,6 @@
 
         self.run = gem5Run.createSERun(
             "test SE run",
-            "gem5/build/X86/gem5.opt",
             "configs-tests/run_test.py",
             "results/run_test/out",
             self.gem5art,