| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import gzip | 5 import gzip |
| 6 import pprint | 6 import pprint |
| 7 import subprocess | 7 import subprocess |
| 8 import sys | 8 import sys |
| 9 import StringIO | 9 import StringIO |
| 10 from autotest_lib.client.bin import factory | 10 from autotest_lib.client.bin import factory |
| 11 from autotest_lib.client.bin import test, utils | 11 from autotest_lib.client.bin import test, utils |
| 12 from autotest_lib.client.common_lib import error | 12 from autotest_lib.client.common_lib import error |
| 13 from autotest_lib.client.common_lib import flashrom_util | 13 from autotest_lib.client.cros import flashrom_util |
| 14 | 14 |
| 15 | 15 |
| 16 class factory_LogVpd(test.test): | 16 class factory_LogVpd(test.test): |
| 17 version = 1 | 17 version = 1 |
| 18 | 18 |
| 19 def blob_to_gzipped_hex(self, blob_data): | 19 def blob_to_gzipped_hex(self, blob_data): |
| 20 """ Compresses a blob and return as hex string """ | 20 """ Compresses a blob and return as hex string """ |
| 21 blob = StringIO.StringIO() | 21 blob = StringIO.StringIO() |
| 22 gzblob = gzip.GzipFile(fileobj=blob, mode='w') | 22 gzblob = gzip.GzipFile(fileobj=blob, mode='w') |
| 23 gzblob.write(blob_data) | 23 gzblob.write(blob_data) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 44 tool_report = ' '.join(tool_report.split('\n')).strip() | 44 tool_report = ' '.join(tool_report.split('\n')).strip() |
| 45 if tool_report: | 45 if tool_report: |
| 46 factory.log('VPD Data (key-value): ' + tool_report) | 46 factory.log('VPD Data (key-value): ' + tool_report) |
| 47 | 47 |
| 48 # we need at least one VPD to success. | 48 # we need at least one VPD to success. |
| 49 return valid_vpds > 0 | 49 return valid_vpds > 0 |
| 50 | 50 |
| 51 def run_once(self): | 51 def run_once(self): |
| 52 if not self.log_vpds(): | 52 if not self.log_vpds(): |
| 53 raise error.TestFail('Cannot find any Vendor Product Data (VPD.') | 53 raise error.TestFail('Cannot find any Vendor Product Data (VPD.') |
| OLD | NEW |