Пример #1
0
 def testDumpValidSingleACPITable(self):
   """Tests basic valid ACPI table dump."""
   args = rdf_chipsec_types.DumpACPITableRequest(table_signature="DSDT")
   result = self.RunAction(self.grr_chipsec_module.DumpACPITable, args)[0]
   self.assertLen(result.acpi_tables, 1)
   self.assertEqual(result.acpi_tables[0].table_address, 0xAABBCCDDEEFF0011)
   self.assertEqual(result.acpi_tables[0].table_blob,
                    b"\xFF" * 0xFF + b"\xEE" * 0xFF)
Пример #2
0
 def testDumpValidSingleACPITableVerbose(self):
   """Tests valid ACPI table dump with verbose mode enabled."""
   args = rdf_chipsec_types.DumpACPITableRequest(
       table_signature="XSDT", logging=True)
   result = self.RunAction(self.grr_chipsec_module.DumpACPITable, args)[0]
   self.assertEqual(result.acpi_tables[0].table_address, 0x1122334455667788)
   self.assertEqual(result.acpi_tables[0].table_blob,
                    b"\xAB" * 0xFF + b"\xCD" * 0xFF)
   self.assertNotEquals(self.chipsec_mock.logger.logger.call_count, 0)
Пример #3
0
    def testDumpACPITableTriggeringDevMemError(self):
        """Tests the condition where OSError is triggered due to using /dev/mem.

    No exception should be raised, and the log describing the error should be
    returned.
    """
        self.chipsec_mock.acpi.ACPI = MockACPIReadingRestrictedArea
        args = rdf_chipsec_types.DumpACPITableRequest(table_signature="FACP")
        self.RunAction(self.grr_chipsec_module.DumpACPITable, args)
        self.assertNotEmpty(self.results)
        self.assertNotEmpty(self.results[0].logs)
Пример #4
0
    def testDumpACPITableUnknownChipsetVerbose(self):
        """Tests unknown chipset with verbose mode.

    If the chipset is unknown but verbose enabled, no exception is raised
    and at least one response should be returned with non-empty logs.
    """
        self.chipsec_mock.chipset.cs = UnsupportedChipset
        args = rdf_chipsec_types.DumpACPITableRequest(table_signature="FACP",
                                                      logging=True)
        self.RunAction(self.grr_chipsec_module.DumpACPITable, args)
        self.assertNotEqual(self.chipsec_mock.logger.logger.call_count, 0)
        self.assertNotEmpty(self.results)
        self.assertNotEmpty(self.results[0].logs)
Пример #5
0
 def testDumpValidMultipleACPITables(self):
   """Tests valid ACPI table dump that would yield several tables."""
   args = rdf_chipsec_types.DumpACPITableRequest(table_signature="SSDT")
   result = self.RunAction(self.grr_chipsec_module.DumpACPITable, args)[0]
   self.assertLen(result.acpi_tables, 3)
   self.assertEqual(result.acpi_tables[0].table_address, 0x1234567890ABCDEF)
   self.assertEqual(result.acpi_tables[0].table_blob,
                    b"\xEF" * 0xFF + b"\xFE" * 0xFF)
   self.assertEqual(result.acpi_tables[1].table_address, 0x2234567890ABCDEF)
   self.assertEqual(result.acpi_tables[1].table_blob,
                    b"\xDC" * 0xFF + b"\xBA" * 0xFF)
   self.assertEqual(result.acpi_tables[2].table_address, 0x3234567890ABCDEF)
   self.assertEqual(result.acpi_tables[2].table_blob,
                    b"\xAA" * 0xFF + b"\xBB" * 0xFF)
Пример #6
0
 def testDumpACPITableUnknownChipset(self):
     """By default, if the chipset is unknown, no exception is raised."""
     self.chipsec_mock.chipset.cs = UnsupportedChipset
     args = rdf_chipsec_types.DumpACPITableRequest(table_signature="FACP")
     self.RunAction(self.grr_chipsec_module.DumpACPITable, args)
Пример #7
0
 def testDumpInvalidACPITable(self):
     """Tests dumping invalid ACPI table."""
     args = rdf_chipsec_types.DumpACPITableRequest(
         table_signature="INVALID_TABLE")
     result = self.RunAction(self.grr_chipsec_module.DumpACPITable, args)[0]
     self.assertNotEqual(len(result.logs), 0)