1# Copyright 2018 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import os 6import logging 7 8from autotest_lib.server.cros.faft.fingerprint_test import FingerprintTest 9 10 11class firmware_Fingerprint(FingerprintTest): 12 """ 13 Common class for running fingerprint firmware tests. Initializes the 14 firmware to a known state and then runs the test executable with 15 specified arguments on the DUT. 16 """ 17 version = 1 18 19 def initialize(self, host, test_exe, test_exe_args=None, 20 use_dev_signed_fw=False, 21 enable_hardware_write_protect=True, 22 enable_software_write_protect=True, 23 force_firmware_flashing=False, 24 init_entropy=True): 25 test_dir = os.path.join(self.bindir, 'tests/') 26 logging.info('test_dir: %s', test_dir) 27 super(firmware_Fingerprint, self).initialize( 28 host, test_dir, use_dev_signed_fw, enable_hardware_write_protect, 29 enable_software_write_protect, force_firmware_flashing, 30 init_entropy) 31 32 self._test_exe = test_exe 33 34 # Convert the arguments (test image names) to the actual filenames of 35 # the test images. 36 image_args = [] 37 if test_exe_args: 38 for arg in test_exe_args: 39 image_args.append(getattr(self, arg)) 40 self._test_exe_args = image_args 41 42 def run_once(self): 43 """Run the test.""" 44 logging.info('Running test: %s', self._test_exe) 45 self.run_test(self._test_exe, *self._test_exe_args) 46 47