Example #1
0
 def testDumpFlashImageVerbose(self):
   """Test the basic dump with the verbose mode enabled."""
   args = chipsec_types.DumpFlashImageRequest(log_level=1)
   result = self.RunAction("DumpFlashImage", args)[0]
   with vfs.VFSOpen(result.path) as image:
     self.assertEqual(image.read(0x20000), "\xff" * 0x10000)
   self.assertNotEqual(grr_chipsec.logger.call_count, 0)
Example #2
0
  def testDumpFlashImageUnknownChipsetVerbose(self):
    """Test 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.
    """
    with utils.Stubber(grr_chipsec.chipset, "cs", FaultyChipset):
      args = chipsec_types.DumpFlashImageRequest(log_level=1)
      self.RunAction("DumpFlashImage", args)
      self.assertNotEquals(grr_chipsec.logger.call_count, 0)
      self.assertGreaterEqual(len(self.results), 1)
      self.assertNotEquals(len(self.results[0].logs), 0)
      self.assertEquals(self.results[0].path.path, "")
Example #3
0
 def testDumpFlashImageUnknownChipset(self):
   """By default, if the chipset is unknown, no exception is raised."""
   with utils.Stubber(grr_chipsec.chipset, "cs", FaultyChipset):
     args = chipsec_types.DumpFlashImageRequest()
     self.RunAction("DumpFlashImage", args)
Example #4
0
 def testDumpFlashImage(self):
   """Test the basic dump."""
   args = chipsec_types.DumpFlashImageRequest()
   result = self.RunAction("DumpFlashImage", args)[0]
   with vfs.VFSOpen(result.path) as image:
     self.assertEqual(image.read(0x20000), "\xff" * 0x10000)