Exemple #1
0
    def testFailedEficheckCollectHashes(self, glob, client_utils_common):

        client_utils_common.Execute = FailedMockExecute
        glob.glob.return_value = []
        args = rdf_apple_firmware.EficheckConfig()
        result = self.RunAction(firmware.EficheckCollectHashes, args)[0]

        self.assertEqual(result.response.stderr,
                         b"Unable to find the eficheck binary")
Exemple #2
0
    def testFailedEficheckDumpImageVersion(self, glob, client_utils_common):
        """Test for failure of the dump action when reading the version."""

        client_utils_common.Execute = FailedMockExecute

        args = rdf_apple_firmware.EficheckConfig()
        result = self.RunAction(firmware.EficheckDumpImage, args)[0]

        self.assertEqual(result.response.stderr,
                         b"Unable to find the eficheck binary")
Exemple #3
0
  def testEficheckCollectHashesWithExtra(self, glob, client_utils_common):
    """Test the hash collection action when extra unknown files are present."""

    client_utils_common.Execute = MockExecute
    glob.glob.return_value = ["./MBP61.ealf", "$(id).ealf", "`id`.ealf"]

    args = rdf_apple_firmware.EficheckConfig()
    with utils.Stubber(tempfiles, "DeleteGRRTempFile", lambda filename: None):
      results = self.RunAction(firmware.EficheckCollectHashes, args)
    self.assertLen(results, 1)
Exemple #4
0
  def testFailedEficheckDumpImage(self, glob, client_utils_common):
    """Test for failure of the basic dump action."""

    client_utils_common.Execute = FailedDumpMockExecute

    args = rdf_apple_firmware.EficheckConfig()
    result = self.RunAction(firmware.EficheckDumpImage, args)[0]

    self.assertEqual(result.eficheck_version, "v1.14")
    self.assertEqual(result.response.stderr, b"Unable to dump the binary image")
Exemple #5
0
    def testEficheckDumpImage(self, glob, client_utils_common):
        """Test the basic dump action."""

        client_utils_common.Execute = MockExecute

        args = rdf_apple_firmware.EficheckConfig()
        with utils.Stubber(tempfiles, "GetDefaultGRRTempDirectory",
                           lambda **kw: os.path.abspath(self.temp_dir)):
            result = self.RunAction(firmware.EficheckDumpImage, args)[0]

        self.assertEqual(result.eficheck_version, "v1.14")
        self.assertEqual(result.response.stderr, b"")
        self.assertStartsWith(result.path.path, self.temp_dir)
        self.assertEndsWith(result.path.path, "/firmware.bin")
Exemple #6
0
  def testEficheckCollectHashes(self, glob, client_utils_common):
    """Test the basic hash collection action."""

    client_utils_common.Execute = MockExecute
    glob.glob.return_value = ["./MBP142.88Z.F000.B00.123.0.ealf"]

    args = rdf_apple_firmware.EficheckConfig()
    with utils.Stubber(tempfiles, "DeleteGRRTempFile", lambda filename: None):
      result = self.RunAction(firmware.EficheckCollectHashes, args)[0]

    self.assertEqual(result.boot_rom_version, "MBP142.88Z.F000.B00.123.0")
    self.assertEqual(result.eficheck_version, "v1.14")
    self.assertEqual(result.response.stdout, b"00:01:02:12345:abcd-12345")
    self.assertEqual(result.response.stderr, b"")