Files
Nathaniel Mitchell 291632c0ee Apply flake8 code formatting rules against repo
Signed-off-by: Nathaniel Mitchell <nathaniel.p.mitchell@intel.com>
2022-07-28 09:17:10 -07:00

47 lines
1.5 KiB
Python

# CHIPSEC: Platform Security Assessment Framework
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; Version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
import unittest
from tests.software import mock_helper, util
class TestCMOSChipsecUtil(util.TestChipsecUtil):
"""Test the CMOS commands exposed by chipsec_utils."""
def test_cmos_dump(self):
"""Test to verify the output of 'cmos dump'.
Check that we only access CMOS IO ports.
"""
class CMOSHelper(mock_helper.TestHelper):
def read_io_port(self, io_port, size):
if io_port < 0x70 or io_port > 0x73:
raise Exception("Reading outside CMOS IO port")
return io_port
def write_io_port(self, io_port, value, size):
if io_port < 0x70 or io_port > 0x73:
raise Exception("Writing outside CMOS IO port")
self._chipsec_util("cmos dump", CMOSHelper)
if __name__ == '__main__':
unittest.main()