stdlib,configs,tests: Remove deprecated Resource classes usage (#102)

* stdlib,configs,tests: Remove `Resource` class use

This class is deprecated, but was still used in various example
configuration scriots and tests. This patch replaces it with the
`obtain_resource` function.

Change-Id: I0c89bf17783ccaaafc18072aaeefb5d1e207bc55

* configs: Remove `CustomDiskImageResource` use

The class is deprecated but was still used in the SPEC example scripts.
This patch replaces it with the `DiskImageResource` class.

Change-Id: Ie0697fe59a3d737b05eb45ff3bc964f42b0387e0

* configs,tests: Remove `CustomResource` use

This class is deprecated but was still used in example scripts and
mentioned, incorrectly, in comments in the pyunit tests. This patch
removes these.

Change-Id: Icb6d02f47a5b72cd58551e5dcd59cc72d6a91a01

* stdlib: Remove '\' in Workload docstring example

This example shows how to use the Workload. The backslash is not correct Python and would fail if used in this way.

Co-authored-by: Jason Lowe-Power <jason@lowepower.com>

---------

Co-authored-by: Jason Lowe-Power <jason@lowepower.com>
This commit is contained in:
Bobby R. Bruce
2023-07-20 23:08:39 -07:00
committed by GitHub
parent 427b4d596e
commit 01623fac68
25 changed files with 73 additions and 73 deletions

View File

@@ -52,7 +52,7 @@ class AbstractWorkload:
workload = CustomWorkload(
function = "set_se_binary_workload",
parameters = {
"binary" : Resource("x86-print-this"),
"binary" : obtain_resource("x86-print-this"),
"arguments" : ["hello", 6]
},
)
@@ -64,7 +64,7 @@ class AbstractWorkload:
```py
board.set_se_binary_workload(
binary = Resource("x86-print-this"),
binary = obtain_resource("x86-print-this"),
arguments = ["hello", 6],
)
```
@@ -121,7 +121,7 @@ class CustomWorkload(AbstractWorkload):
workload = CustomWorkload(
function = "set_se_binary_workload",
parameters = {
"binary" : Resource("x86-print-this"),
"binary" : obtain_resource("x86-print-this"),
"arguments" : ["hello", 6]
},
)
@@ -148,7 +148,9 @@ class Workload(AbstractWorkload):
# Optionally we can override a parameter in the workload. In this example
# we are going to run this workload with a difference kernel.
workload.set_parameter("kernel", Resource("arm64-linux-kernel-4.14.134"))
workload.set_parameter("kernel",
obtain_resource("arm64-linux-kernel-4.14.134")
)
# We then set this workload to the board.
board.set_workload(workload)
@@ -193,8 +195,8 @@ class Workload(AbstractWorkload):
```python
board.set_kernel_disk_workload(
kernel = Resource("x86-linux-kernel-5.4.49"),
disk-image = Resource("x86-ubuntu-18.04-img"),
kernel = obtain_resource("x86-linux-kernel-5.4.49"),
disk-image = obtain_resource("x86-ubuntu-18.04-img"),
readfile_contents = "m5_exit; echo 'hello'; m5_exit",
)
```

View File

@@ -48,8 +48,8 @@ def run_sim(name):
from gem5.simulate.simulator import Simulator
board = X86DemoBoard()
board.set_kernel_disk_workload(
kernel=Resource("x86-linux-kernel-5.4.49"),
disk_image=Resource("x86-ubuntu-18.04-img"),
kernel=obtain_resource("x86-linux-kernel-5.4.49"),
disk_image=obtain_resource("x86-ubuntu-18.04-img"),
)
simulator = Simulator(board=board)
simulator.run(max_ticks=10000000)