* 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>
With these annotations, mypy no longer report any issues in strict mode:
$ mypy --strict chipsec/helper/linuxnative/cpuid.py
Success: no issues found in 1 source file
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
Make the machine code `bytes` instead of `list`. This makes it no longer
necessary to cast it to `c_ubyte * size` before using it.
While at it, add `mmap.MAP_PRIVATE` flag to the mapping, as it is not
needed to create a `MAP_SHARED` mapping for the code (which is the
default flag).
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
Now that chipsec is no longer compatible with Python2, this import is no
longer useful.
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>
There is no point in doing a lazy-import with
`chipsec.helper.linuxnative.cpuid`, as the `cpuid` function is almost
always called when starting chipsec, to display the banner.
Signed-off-by: Nicolas Iooss <nicolas.iooss_git@polytechnique.org>