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 test_dir = os.path.join(self.bindir, 'tests/') 22 logging.info('test_dir: %s', test_dir) 23 super(firmware_Fingerprint, self).initialize( 24 host, test_dir, use_dev_signed_fw) 25 26 self._test_exe = test_exe 27 28 # Convert the arguments (test image names) to the actual filenames of 29 # the test images. 30 image_args = [] 31 if test_exe_args: 32 for arg in test_exe_args: 33 image_args.append(getattr(self, arg)) 34 self._test_exe_args = image_args 35 36 def run_once(self): 37 """Run the test.""" 38 logging.info('Running test: %s', self._test_exe) 39 self.set_hardware_write_protect(True) 40 self.run_test(self._test_exe, *self._test_exe_args) 41 42