configs: Improve error message of missing files

In PathSearchFunc.__call__(), filename is the name of the file
while filepath contains the relative path to the missing file
relative to $M5_PATH.

Outputing the filepath in the error message makes the error
message more useful as it provides the expected location of
the file as well as the name of the file.

Change-Id: I5f1fdb9e48ac9ae59a26d33331a4a40bc9ff9acd
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45105
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Hoa Nguyen
2021-05-05 01:56:29 -07:00
parent 40715206f4
commit b79300bcac

View File

@@ -70,7 +70,7 @@ class PathSearchFunc(object):
return next(p for p in paths if os.path.exists(p))
except StopIteration:
raise IOError("Can't find file '{}' on {}."
.format(filename, self.environment_variable))
.format(filepath, self.environment_variable))
disk = PathSearchFunc('disks')
binary = PathSearchFunc('binaries')