`CoreConfig.handle_ima` was adding entries to `cfg.IO_BARS` instead of
`cfg.IMA_REGISTERS`. Moreover `Chipset.get_register_def` uses
`IMA_REGISTERS` when looking for registers with type `"indirect"`, which
confirms there was a bug.
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
When loading the kernel module fails on Linux, `chipsec_util.py`
raises an error in
logger().log_debug(traceback.format_exc())
because `traceback` was not imported.
Fix this issue by importing the missing modules `traceback` and `errno`.
While at it, import `traceback` too in other files where it was missing.
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
Method `add_extra_configs` used `config_path.xml_file` to format a
message when an error occurs, but `config_path` is a string.
Use the variable directly in the error message.
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
* Add test cpu info unittest cases
Signed-off-by: Jason Zhou <jun2.zhou@intel.com>
* Add __init__.py to this folder to be picked up by cmd "py setup.py test"
Signed-off-by: Jason Zhou <jun2.zhou@intel.com>
* Remove unused import
Signed-off-by: Jason Zhou <jun2.zhou@intel.com>
---------
Signed-off-by: Jason Zhou <jun2.zhou@intel.com>
`windowshelper.py` uses a path with backslashes without proper escaping.
While this works because `\s` and `\c` are not valid escape sequences,
this makes flake8 report:
/chipsec/helper/windows/windowshelper.py:71:53: W605 invalid escape sequence '\s'
/chipsec/helper/windows/windowshelper.py:71:67: W605 invalid escape sequence '\c'
Fix this by splitting the path when invoking `os.path.join`.
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
Commit 99f9052438 ("Remove filehelper") removed `from_file` and
`to_file` from `OsHelper` but it remained in `BaseHelper`. Remove these
parameters too.
While at it, remove the similar parameters from the mock helper used in
tests.
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
`chipsec/module.py` uses a normal string to define a regular expression,
which makes flake8 report:
chipsec/module.py:34:27: W605 invalid escape sequence '\w'
chipsec/module.py:34:31: W605 invalid escape sequence '\.'
chipsec/module.py:34:33: W605 invalid escape sequence '\w'
To prevent the Python interpreter from trying to interpret the escape
sequences, use a raw string.
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
the test invalid pch mock helper returned fake pch id, but valid plat id,
if plat id matched xml file defined reqs_pch=true, will cause exception,
the mocked plat id corresponding xml is reqs_pch=true.
Signed-off-by: Jason Zhou <jun2.zhou@intel.com>