コード例 #1
0
    def testSignatures(self):
        """Verify that the --signatures option shows the present signatures."""
        payload_cmd = payload_info.PayloadCommand(
            FakeOption(action='show', signatures=True))
        payload = FakePayload(payload_info.MAJOR_PAYLOAD_VERSION_BRILLO)
        payload.AddPayloadSignature(version=1,
                                    data='12345678abcdefgh\x00\x01\x02\x03')
        payload.AddPayloadSignature(data='I am a signature so access is yes.')
        payload.AddMetadataSignature(data='\x00\x0a\x0c')
        expected_out = """Payload version:             2
Manifest length:             222
Number of partitions:        2
  Number of "root" ops:      1
  Number of "kernel" ops:    1
Block size:                  4096
Minor version:               4
Metadata signatures blob:    file_offset=246 (7 bytes)
Metadata signatures: (1 entries)
  version=None, hex_data: (3 bytes)
    00 0a 0c                                        | ...
Payload signatures blob:     blob_offset=1234 (64 bytes)
Payload signatures: (2 entries)
  version=1, hex_data: (20 bytes)
    31 32 33 34 35 36 37 38 61 62 63 64 65 66 67 68 | 12345678abcdefgh
    00 01 02 03                                     | ....
  version=None, hex_data: (34 bytes)
    49 20 61 6d 20 61 20 73 69 67 6e 61 74 75 72 65 | I am a signature
    20 73 6f 20 61 63 63 65 73 73 20 69 73 20 79 65 |  so access is ye
    73 2e                                           | s.
"""
        self.TestCommand(payload_cmd, payload, expected_out)
コード例 #2
0
    def testListOpsOnVersion2(self):
        """Verify that the --list_ops option gives the correct output."""
        payload_cmd = payload_info.PayloadCommand(
            FakeOption(list_ops=True, action='show'))
        payload = FakePayload(payload_info.MAJOR_PAYLOAD_VERSION_BRILLO)
        expected_out = """Payload version:             2
Manifest length:             222
Number of partitions:        2
  Number of "root" ops:      1
  Number of "kernel" ops:    1
Block size:                  4096
Minor version:               4

root install operations:
  0: REPLACE_BZ
    Data offset: 1
    Data length: 1
    Destination: 2 extents (3 blocks)
      (1,1) (2,2)
kernel install operations:
  0: SOURCE_COPY
    Source: 1 extent (1 block)
      (1,1)
    Destination: 20 extents (190 blocks)
      (0,0) (1,1) (2,2) (3,3) (4,4) (5,5) (6,6) (7,7) (8,8) (9,9) (10,10)
      (11,11) (12,12) (13,13) (14,14) (15,15) (16,16) (17,17) (18,18) (19,19)
"""
        self.TestCommand(payload_cmd, payload, expected_out)
コード例 #3
0
    def testRun(self):
        """Verify that Run parses and displays the payload like we expect."""
        payload_cmd = payload_info.PayloadCommand(FakeOption(action='show'))
        payload = FakePayload(payload_info.MAJOR_PAYLOAD_VERSION_CHROMEOS)
        expected_out = """Payload version:             1
Manifest length:             222
Number of operations:        1
Number of kernel ops:        1
Block size:                  4096
Minor version:               4
"""
        self.TestCommand(payload_cmd, payload, expected_out)
コード例 #4
0
  def testRun(self):
    """Verify that Run parses and displays the payload like we expect."""
    payload_cmd = payload_info.PayloadCommand(FakeOption(action='show'))
    payload = FakePayload()
    expected_out = """Payload version:             2
Manifest length:             222
Number of partitions:        2
  Number of "root" ops:      1
  Number of "kernel" ops:    1
Block size:                  4096
Minor version:               4
"""
    self.TestCommand(payload_cmd, payload, expected_out)
コード例 #5
0
    def testEmptySignatures(self):
        """Verify that the --signatures option works with unsigned payloads."""
        payload_cmd = payload_info.PayloadCommand(
            FakeOption(action='show', signatures=True))
        payload = FakePayload(payload_info.MAJOR_PAYLOAD_VERSION_CHROMEOS)
        expected_out = """Payload version:             1
Manifest length:             222
Number of operations:        1
Number of kernel ops:        1
Block size:                  4096
Minor version:               4
No metadata signatures stored in the payload
No payload signatures stored in the payload
"""
        self.TestCommand(payload_cmd, payload, expected_out)
コード例 #6
0
    def testStatsOnVersion1(self):
        """Verify that the --stats option works correctly."""
        payload_cmd = payload_info.PayloadCommand(
            FakeOption(stats=True, action='show'))
        payload = FakePayload(payload_info.MAJOR_PAYLOAD_VERSION_CHROMEOS)
        expected_out = """Payload version:             1
Manifest length:             222
Number of operations:        1
Number of kernel ops:        1
Block size:                  4096
Minor version:               4
Blocks read:                 11
Blocks written:              193
Seeks when writing:          18
"""
        self.TestCommand(payload_cmd, payload, expected_out)
コード例 #7
0
  def testEmptySignatures(self):
    """Verify that the --signatures option works with unsigned payloads."""
    payload_cmd = payload_info.PayloadCommand(
        FakeOption(action='show', signatures=True))
    payload = FakePayload()
    expected_out = """Payload version:             2
Manifest length:             222
Number of partitions:        2
  Number of "root" ops:      1
  Number of "kernel" ops:    1
Block size:                  4096
Minor version:               4
No metadata signatures stored in the payload
No payload signatures stored in the payload
"""
    self.TestCommand(payload_cmd, payload, expected_out)
コード例 #8
0
  def testStatsOnVersion2(self):
    """Verify that the --stats option works correctly on version 2."""
    payload_cmd = payload_info.PayloadCommand(
        FakeOption(stats=True, action='show'))
    payload = FakePayload()
    expected_out = """Payload version:             2
Manifest length:             222
Number of partitions:        2
  Number of "root" ops:      1
  Number of "kernel" ops:    1
Block size:                  4096
Minor version:               4
Blocks read:                 11
Blocks written:              193
Seeks when writing:          18
"""
    self.TestCommand(payload_cmd, payload, expected_out)