stdlib: Fix 'set_{text/json}_stats_output' in Simulator
These functions were using "os.is_path_exists_or_creatable". This is a non-existant function. It has been replaced with a simple test to ensure the specified stats file either exists or is creatable. Change-Id: I9a1b2c575d18356fdc87c8b1848c09735e0f18e7 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/62971 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:
committed by
Bobby Bruce
parent
d791827f17
commit
3a1c9ad904
@@ -210,9 +210,19 @@ class Simulator:
|
||||
|
||||
:param path: That path in which the file should be output to.
|
||||
"""
|
||||
if not os.is_path_exists_or_creatable(path):
|
||||
path_path = Path(path)
|
||||
parent = path_path.parent
|
||||
|
||||
if (
|
||||
not parent.is_dir()
|
||||
or not os.access(parent, os.W_OK)
|
||||
or (
|
||||
path_path.exists()
|
||||
and (path_path.is_dir() or not os.access(path_path, os.W_OK))
|
||||
)
|
||||
):
|
||||
raise Exception(
|
||||
f"Path '{path}' is is not a valid text stats output location."
|
||||
f"Specified text stats output path '{path}' is invalid."
|
||||
)
|
||||
addStatVisitor(path)
|
||||
|
||||
@@ -224,9 +234,19 @@ class Simulator:
|
||||
|
||||
:param path: That path in which the JSON should be output to.
|
||||
"""
|
||||
if not os.is_path_exists_or_creatable(path):
|
||||
path_path = Path(path)
|
||||
parent = path_path.parent
|
||||
|
||||
if (
|
||||
not parent.is_dir()
|
||||
or not os.access(parent, os.W_OK)
|
||||
or (
|
||||
path_path.exists()
|
||||
and (path_path.is_dir() or not os.access(path_path, os.W_OK))
|
||||
)
|
||||
):
|
||||
raise Exception(
|
||||
f"Path '{path}' is is not a valid JSON output location."
|
||||
f"Specified json stats output path '{path}' is invalid."
|
||||
)
|
||||
addStatVisitor(f"json://{path}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user