stdlib: Add null/None versioning in resources.json

This patch allows for the "version" field in the resources.json file to
be `null` (translated to `None` in the Python JSON package) or not
declared. In this case the resources.json file will be used regardless
as to what version the gem5 binary is set. This is useful for testing
purposes.

Tests have been updated to utilize this where possible.

Change-Id: I9d8ae18cb3e61d58bc822bad30853fa3442cb33f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67337
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
Bobby R. Bruce
2023-01-19 14:30:19 +00:00
committed by Zhantong Qiu
parent 4ee724e054
commit a9b69ee055
4 changed files with 76 additions and 87 deletions

View File

@@ -154,8 +154,13 @@ def _get_resources_json() -> Dict:
# If the current version pulled is not correct, look up the
# "previous-versions" field to find the correct one.
# If the resource JSON file does not have a "version" field or it's
# null/None, then we will use this resource JSON file (this is usefull for
# testing purposes).
version = _resources_json_version_required()
if to_return["version"] != version:
json_version = None if "version" not in to_return else to_return["version"]
if json_version and json_version != version:
if version in to_return["previous-versions"].keys():
to_return = _get_resources_json_at_path(
path=to_return["previous-versions"][version]