Classify methods in FAFTClient
There are too many methods in FAFTClient, so this CL is to classify them into
several groups: ec, bios, kernel. Methods which can be put into one of the
target group should be renamed with format _[group name]_[method name].
For example, dump_firmware should be modified to bios_dump. To call methods in
FAFTClient, use [group name].[method name].
BUG=chromium-os:36429
TEST=run firmware update tests
Change-Id: I7ead01246121b454c0a9f29e10bd026a77925e4f
Reviewed-on: https://gerrit.chromium.org/gerrit/38186
Reviewed-by: Tom Wai-Hong Tam <[email protected]>
Commit-Ready: Chun-Ting Chang <[email protected]>
Tested-by: Chun-Ting Chang <[email protected]>
diff --git a/client/cros/faft_client.py b/client/cros/faft_client.py
index d6b63e6..98a2024 100755
--- a/client/cros/faft_client.py
+++ b/client/cros/faft_client.py
@@ -57,7 +57,11 @@
"""A class of FAFT client which aggregates some useful functions of SAFT.
This class can be exposed via a XMLRPC server such that its functions can
- be accessed remotely.
+ be accessed remotely. Method naming should fit the naming rule
+ '_[categories]_[method_name]' where categories contains system, ec, bios,
+ kernel, cgpt, tpm, updater, etc. Methods should be called by
+ 'FAFTClient.[categories].[method_name]', because _dispatch will rename
+ this name to '_[categories]_[method_name]'.
Attributes:
_chromeos_interface: An object to encapsulate OS services functions.
@@ -117,7 +121,7 @@
self._tpm_handler.init(self._chromeos_interface)
self._cgpt_state = cgpt_state.CgptState(
- 'SHORT', self._chromeos_interface, self.get_root_dev())
+ 'SHORT', self._chromeos_interface, self._system_get_root_dev())
self._updater = FirmwareUpdater(self._chromeos_interface)
@@ -138,8 +142,15 @@
is_str = method.endswith('.__str__')
if is_str:
method = method.rsplit('.', 1)[0]
+
+ categories = ('system', 'bios', 'ec', 'kernel',
+ 'tpm', 'cgpt', 'updater')
try:
- func = getattr(self, method)
+ if method.split('.', 1)[0] in categories:
+ func = getattr(self, '_%s_%s' % (method.split('.',1)[0],
+ method.split('.',1)[1]))
+ else:
+ func = getattr(self, method)
except AttributeError:
raise Exception('method "%s" is not supported' % method)
else:
@@ -149,7 +160,7 @@
return func(*params)
- def is_available(self):
+ def _system_is_available(self):
"""Function for polling the RPC server availability.
Returns:
@@ -158,7 +169,7 @@
return True
- def run_shell_command(self, command):
+ def _system_run_shell_command(self, command):
"""Run shell command.
Args:
@@ -168,7 +179,7 @@
self._chromeos_interface.run_shell_command(command)
- def run_shell_command_get_output(self, command):
+ def _system_run_shell_command_get_output(self, command):
"""Run shell command and get its console output.
Args:
@@ -182,13 +193,13 @@
return self._chromeos_interface.run_shell_command_get_output(command)
- def software_reboot(self):
+ def _system_software_reboot(self):
"""Request software reboot."""
self._chromeos_interface.log('Requesting software reboot')
self._chromeos_interface.run_shell_command('reboot')
- def get_platform_name(self):
+ def _system_get_platform_name(self):
"""Get the platform name of the current system.
Returns:
@@ -203,7 +214,7 @@
return lines[-1]
- def get_crossystem_value(self, key):
+ def _system_get_crossystem_value(self, key):
"""Get crossystem value of the requested key.
Args:
@@ -217,7 +228,7 @@
'crossystem %s' % key)[0]
- def get_EC_version(self):
+ def _ec_get_version(self):
"""Get EC version via mosys.
Returns:
@@ -228,7 +239,7 @@
'mosys ec info | sed "s/.*| //"')[0]
- def get_root_dev(self):
+ def _system_get_root_dev(self):
"""Get the name of root device without partition number.
Returns:
@@ -238,7 +249,7 @@
return self._chromeos_interface.get_root_dev()
- def get_root_part(self):
+ def _system_get_root_part(self):
"""Get the name of root device with partition number.
Returns:
@@ -248,19 +259,19 @@
return self._chromeos_interface.get_root_part()
- def set_try_fw_b(self):
+ def _system_set_try_fw_b(self):
"""Set 'Try Frimware B' flag in crossystem."""
self._chromeos_interface.log('Requesting restart with firmware B')
self._chromeos_interface.cs.fwb_tries = 1
- def request_recovery_boot(self):
+ def _system_request_recovery_boot(self):
"""Request running in recovery mode on the restart."""
self._chromeos_interface.log('Requesting restart in recovery mode')
self._chromeos_interface.cs.request_recovery()
- def get_dev_boot_usb(self):
+ def _system_get_dev_boot_usb(self):
"""Get dev_boot_usb value which controls developer mode boot from USB.
Returns:
@@ -270,7 +281,7 @@
return self._chromeos_interface.cs.dev_boot_usb == '1'
- def set_dev_boot_usb(self, value):
+ def _system_set_dev_boot_usb(self, value):
"""Set dev_boot_usb value which controls developer mode boot from USB.
Args:
@@ -280,7 +291,7 @@
self._chromeos_interface.cs.dev_boot_usb = 1 if value else 0
- def get_gbb_flags(self):
+ def _system_get_gbb_flags(self):
"""Get the GBB flags.
Returns:
@@ -290,7 +301,7 @@
return self._bios_handler.get_gbb_flags()
- def get_firmware_flags(self, section):
+ def _bios_get_preamble_flags(self, section):
"""Get the preamble flags of a firmware section.
Args:
@@ -304,7 +315,7 @@
return self._bios_handler.get_section_flags(section)
- def set_firmware_flags(self, section, flags):
+ def _bios_set_preamble_flags(self, section, flags):
"""Set the preamble flags of a firmware section.
Args:
@@ -313,12 +324,12 @@
"""
self._chromeos_interface.log(
'Setting preamble flags of firmware %s to %s' % (section, flags))
- version = self.get_firmware_version(section)
+ version = self._bios_get_version(section)
self._bios_handler.set_section_version(section, version, flags,
write_through=True)
- def get_firmware_sha(self, section):
+ def _bios_get_body_sha(self, section):
"""Get SHA1 hash of BIOS RW firmware section.
Args:
@@ -328,23 +339,23 @@
return self._bios_handler.get_section_sha(section)
- def get_firmware_sig_sha(self, section):
+ def _bios_get_sig_sha(self, section):
"""Get SHA1 hash of firmware vblock in section."""
return self._bios_handler.get_section_sig_sha(section)
- def get_EC_firmware_sha(self):
+ def _ec_get_firmware_sha(self):
"""Get SHA1 hash of EC RW firmware section."""
return self._ec_handler.get_section_sha('rw')
- def reload_firmware(self):
+ def _bios_reload(self):
"""Reload the firmware image that may be changed."""
self._bios_handler.reload()
@allow_multiple_section_input
- def corrupt_EC(self, section):
+ def _ec_corrupt_sig(self, section):
"""Corrupt the requested EC section signature.
Args:
@@ -356,7 +367,7 @@
@allow_multiple_section_input
- def corrupt_EC_body(self, section):
+ def _ec_corrupt_body(self, section):
"""Corrupt the requested EC section body.
Args:
@@ -368,7 +379,7 @@
@allow_multiple_section_input
- def restore_EC(self, section):
+ def _ec_restore_sig(self, section):
"""Restore the previously corrupted EC section signature.
Args:
@@ -380,7 +391,7 @@
@allow_multiple_section_input
- def restore_EC_body(self, section):
+ def _ec_restore_body(self, section):
"""Restore the previously corrupted EC section body.
Args:
@@ -392,7 +403,7 @@
@allow_multiple_section_input
- def corrupt_firmware(self, section):
+ def _bios_corrupt_sig(self, section):
"""Corrupt the requested firmware section signature.
Args:
@@ -404,7 +415,7 @@
@allow_multiple_section_input
- def corrupt_firmware_body(self, section):
+ def _bios_corrupt_body(self, section):
"""Corrupt the requested firmware section body.
Args:
@@ -416,7 +427,7 @@
@allow_multiple_section_input
- def restore_firmware(self, section):
+ def _bios_restore_sig(self, section):
"""Restore the previously corrupted firmware section signature.
Args:
@@ -428,7 +439,7 @@
@allow_multiple_section_input
- def restore_firmware_body(self, section):
+ def _bios_restore_body(self, section):
"""Restore the previously corrupted firmware section body.
Args:
@@ -439,23 +450,23 @@
self._bios_handler.restore_firmware_body(section)
- def get_firmware_version(self, section):
+ def _bios_get_version(self, section):
"""Retrieve firmware version of a section."""
return self._bios_handler.get_section_version(section)
- def get_tpm_firmware_version(self):
+ def _tpm_get_firmware_version(self):
"""Retrieve tpm firmware body version."""
return self._tpm_handler.get_fw_version()
- def _modify_firmware_version(self, section, delta):
+ def __bios_modify_version(self, section, delta):
"""Modify firmware version for the requested section, by adding delta.
The passed in delta, a positive or a negative number, is added to the
original firmware version.
"""
- original_version = self.get_firmware_version(section)
+ original_version = self._bios_get_version(section)
new_version = original_version + delta
flags = self._bios_handler.get_section_flags(section)
self._chromeos_interface.log(
@@ -465,30 +476,30 @@
write_through=True)
@allow_multiple_section_input
- def move_firmware_backward(self, section):
+ def _bios_move_version_backward(self, section):
"""Decrement firmware version for the requested section."""
- self._modify_firmware_version(section, -1)
+ self.__bios_modify_version(section, -1)
@allow_multiple_section_input
- def move_firmware_forward(self, section):
+ def _bios_move_version_forward(self, section):
"""Increase firmware version for the requested section."""
- self._modify_firmware_version(section, 1)
+ self.__bios_modify_version(section, 1)
- def get_firmware_datakey_version(self, section):
+ def _bios_get_datakey_version(self, section):
"""Return firmware data key version."""
return self._bios_handler.get_section_datakey_version(section)
- def get_tpm_firmware_datakey_version(self):
+ def _tpm_get_firmware_datakey_version(self):
"""Retrieve tpm firmware data key version."""
return self._tpm_handler.get_fw_body_version()
- def retrieve_kernel_subkey_version(self,section):
+ def _bios_get_kernel_subkey_version(self,section):
"""Return kernel subkey version."""
return self._bios_handler.get_section_kernel_subkey_version(section)
@allow_multiple_section_input
- def corrupt_kernel(self, section):
+ def _kernel_corrupt_sig(self, section):
"""Corrupt the requested kernel section.
Args:
@@ -499,7 +510,7 @@
@allow_multiple_section_input
- def restore_kernel(self, section):
+ def _kernel_restore_sig(self, section):
"""Restore the requested kernel section (previously corrupted).
Args:
@@ -508,7 +519,7 @@
self._kernel_handler.restore_kernel(section)
- def _modify_kernel_version(self, section, delta):
+ def __kernel_modify_version(self, section, delta):
"""Modify kernel version for the requested section, by adding delta.
The passed in delta, a positive or a negative number, is added to the
@@ -523,28 +534,28 @@
@allow_multiple_section_input
- def move_kernel_backward(self, section):
+ def _kernel_move_version_backward(self, section):
"""Decrement kernel version for the requested section."""
- self._modify_kernel_version(section, -1)
+ self.__kernel_modify_version(section, -1)
@allow_multiple_section_input
- def move_kernel_forward(self, section):
+ def _kernel_move_version_forward(self, section):
"""Increase kernel version for the requested section."""
- self._modify_kernel_version(section, 1)
+ self.__kernel_modify_version(section, 1)
- def retrieve_kernel_version(self, section):
+ def _kernel_get_version(self, section):
"""Return kernel version."""
return self._kernel_handler.get_version(section)
- def retrieve_kernel_datakey_version(self, section):
+ def _kernel_get_datakey_version(self, section):
"""Return kernel datakey version."""
return self._kernel_handler.get_datakey_version(section)
- def diff_kernel_a_b(self):
+ def _kernel_diff_a_b(self):
"""Compare kernel A with B.
Returns:
@@ -564,7 +575,7 @@
return header_a != header_b
- def is_removable_device_boot(self):
+ def _system_is_removable_device_boot(self):
"""Check the current boot device is removable.
Returns:
@@ -575,7 +586,7 @@
return self._chromeos_interface.is_removable_device(root_part)
- def setup_EC_image(self, ec_path):
+ def _bios_setup_EC_image(self, ec_path):
"""Setup the new EC image for later update.
Args:
@@ -590,16 +601,16 @@
self._ec_image.new_image(ec_path)
- def get_EC_image_sha(self):
+ def _bios_get_EC_image_sha(self):
"""Get SHA1 hash of RW firmware section of the EC autest image."""
return self._ec_image.get_section_sha('rw')
- def update_EC_from_image(self, section, flags):
+ def _bios_update_EC_from_image(self, section, flags):
"""Update EC via software sync design.
It copys the RW section from the EC image, which is loaded by calling
- setup_EC_image(), to the EC area of the specified RW section on the
+ bios_setup_EC_image(), to the EC area of the specified RW section on the
current AP firmware.
Args:
@@ -612,7 +623,7 @@
self.set_firmware_flags(section, flags)
- def dump_firmware(self, bios_path):
+ def _bios_dump_whole(self, bios_path):
"""Dump the current BIOS firmware to a file, specified by bios_path.
Args:
@@ -621,7 +632,7 @@
self._bios_handler.dump_whole(bios_path)
- def dump_firmware_rw(self, dir_path):
+ def _bios_dump_rw(self, dir_path):
"""Dump the current BIOS firmware RW to dir_path.
VBOOTA, VBOOTB, FVMAIN, FVMAINB need to be dumped.
@@ -643,7 +654,7 @@
open(os.path.join(dir_path, 'FVMAINB'), 'w').write(FVMAINB_blob)
- def write_firmware(self, bios_path):
+ def _bios_write_whole(self, bios_path):
"""Write the firmware from bios_path to the current system.
Args:
@@ -653,7 +664,7 @@
self._bios_handler.write_whole()
- def write_firmware_rw(self, dir_path):
+ def _bios_write_rw(self, dir_path):
"""Write the firmware RW from dir_path to the current system.
VBOOTA, VBOOTB, FVMAIN, FVMAINB need to be written.
@@ -682,7 +693,7 @@
write_through=True)
- def dump_EC_firmware(self, ec_path):
+ def _ec_dump_firmware(self, ec_path):
"""Dump the current EC firmware to a file, specified by ec_path.
Args:
@@ -691,7 +702,7 @@
self._ec_handler.dump_whole(ec_path)
- def set_EC_write_protect(self, enable):
+ def _ec_set_write_protect(self, enable):
"""Enable write protect of the EC flash chip.
Args:
@@ -705,7 +716,7 @@
self._ec_handler.disable_write_protect()
- def run_cgpt_test_loop(self):
+ def _cgpt_run_test_loop(self):
"""Run the CgptState test loop. The tst logic is handled in the client.
Returns:
@@ -715,7 +726,7 @@
return self._cgpt_state.test_loop()
- def set_cgpt_test_step(self, step):
+ def _cgpt_set_test_step(self, step):
"""Set the CgptState test step.
Args:
@@ -724,7 +735,7 @@
self._cgpt_state.set_step(step)
- def get_cgpt_test_step(self):
+ def _cgpt_get_test_step(self):
"""Get the CgptState test step.
Returns:
@@ -733,18 +744,18 @@
return self._cgpt_state.get_step()
- def resign_kernel_with_keys(self, section, key_path=None):
+ def _kernel_resign_with_keys(self, section, key_path=None):
"""Resign kernel with temporary key."""
self._kernel_handler.resign_kernel(section, key_path)
- def create_temp_dir(self, prefix='backup_'):
+ def _system_create_temp_dir(self, prefix='backup_'):
"""Create a temporary directory and return the path."""
return tempfile.mkdtemp(prefix=prefix)
# for updater
- def setup_updater(self, shellball=None):
+ def _updater_setup(self, shellball=None):
"""Setup the updater.
Args:
@@ -754,11 +765,11 @@
self._updater.setup(self._chromeos_interface, shellball)
- def cleanup_updater(self):
+ def _updater_cleanup(self):
self._updater.cleanup_temp_dir()
- def retrieve_updater_fwid(self):
+ def _updater_get_fwid(self):
"""Retrieve shellball's fwid.
This method should be called after updater_setup.
@@ -769,7 +780,7 @@
return self._updater.retrieve_fwid()
- def resign_updater_firmware(self, version):
+ def _updater_resign_firmware(self, version):
"""Resign firmware with version.
Args:
@@ -778,7 +789,7 @@
self._updater.resign_firmware(version)
- def repack_updater_shellball(self, append):
+ def _updater_repack_shellball(self, append):
"""Repack shellball with new fwid.
Args:
@@ -787,7 +798,7 @@
self._updater.repack_shellball(append)
- def run_autoupdate(self, append):
+ def _updater_run_autoupdate(self, append):
"""Run chromeos-firmwareupdate with autoupdate mode."""
options = ['--noupdate_ec', '--nocheck_rw_compatible']
self._updater.run_firmwareupdate(mode='autoupdate',
@@ -795,37 +806,37 @@
options=options)
- def run_factory_install(self):
+ def _updater_run_factory_install(self):
"""Run chromeos-firmwareupdate with factory_install mode."""
options = ['--noupdate_ec']
self._updater.run_firmwareupdate(mode='factory_install',
options=options)
- def run_bootok(self, append):
+ def _updater_run_bootok(self, append):
"""Run chromeos-firmwareupdate with bootok mode."""
self._updater.run_firmwareupdate(mode='bootok',
updater_append=append)
- def run_recovery(self):
+ def _updater_run_recovery(self):
"""Run chromeos-firmwareupdate with recovery mode."""
options = ['--noupdate_ec', '--nocheck_rw_compatible']
self._updater.run_firmwareupdate(mode='recovery',
options=options)
- def get_updater_temp_path(self):
+ def _updater_get_temp_path(self):
"""Get updater's temp directory path."""
return self._updater.get_temp_path()
- def get_updater_keys_path(self):
+ def _updater_get_keys_path(self):
"""Get updater's keys directory path."""
return self._updater.get_keys_path()
- def get_updater_work_path(self):
+ def _updater_get_work_path(self):
"""Get updater's work directory path."""
return self._updater.get_work_path()
diff --git a/server/cros/faft_checkers.py b/server/cros/faft_checkers.py
index c030868..61ac874 100644
--- a/server/cros/faft_checkers.py
+++ b/server/cros/faft_checkers.py
@@ -75,7 +75,8 @@
Returns:
True if the crossystem value matched; otherwise, False.
"""
- lines = self.faft_client.run_shell_command_get_output('crossystem')
+ lines = self.faft_client.system.run_shell_command_get_output(
+ 'crossystem')
got_dict = self._parse_crossystem_output(lines)
for key in expected_dict:
if key not in got_dict:
@@ -111,7 +112,7 @@
Returns:
True if the flags matched; otherwise, False.
"""
- lines = self.faft_client.run_shell_command_get_output(
+ lines = self.faft_client.system.run_shell_command_get_output(
'crossystem vdat_flags')
vdat_flags = int(lines[0], 16)
if vdat_flags & mask != value:
@@ -155,8 +156,8 @@
Returns:
True if the currect boot device matched; otherwise, False.
"""
- return (self.crossystem_checker({'mainfw_type': 'developer'})
- and self.faft_client.is_removable_device_boot() == dev_boot_usb)
+ return (self.crossystem_checker({'mainfw_type': 'developer'}) and
+ self.faft_client.system.is_removable_device_boot() == dev_boot_usb)
def root_part_checker(self, expected_part):
@@ -169,7 +170,7 @@
Returns:
True if the currect root partition number matched; otherwise, False.
"""
- part = self.faft_client.get_root_part()[-1]
+ part = self.faft_client.system.get_root_part()[-1]
if self.faftsequence.ROOTFS_MAP[expected_part] != part:
logging.info("Expected root part %s but got %s",
self.faftsequence.ROOTFS_MAP[expected_part], part)
@@ -187,7 +188,8 @@
Returns:
True if the current EC running copy matches; otherwise, False.
"""
- lines = self.faft_client.run_shell_command_get_output('ectool version')
+ lines = self.faft_client.system.run_shell_command_get_output(
+ 'ectool version')
pattern = re.compile("Firmware copy: (.*)")
for line in lines:
matched = pattern.match(line)
diff --git a/server/cros/faftsequence.py b/server/cros/faftsequence.py
index 5047477..1519eeb 100644
--- a/server/cros/faftsequence.py
+++ b/server/cros/faftsequence.py
@@ -157,9 +157,9 @@
use_faft)
if use_faft:
self.client_attr = FAFTClientAttribute(
- self.faft_client.get_platform_name())
+ self.faft_client.system.get_platform_name())
self.delay = FAFTDelayConstants(
- self.faft_client.get_platform_name())
+ self.faft_client.system.get_platform_name())
self.checkers = FAFTCheckers(self, self.faft_client)
if self.client_attr.chrome_ec:
@@ -213,9 +213,9 @@
This info is used by generate_test_report and local_dash later.
"""
self.write_attr_keyval({
- 'fw_version': self.faft_client.get_EC_version(),
- 'hwid': self.faft_client.get_crossystem_value('hwid'),
- 'fwid': self.faft_client.get_crossystem_value('fwid'),
+ 'fw_version': self.faft_client.ec.get_version(),
+ 'hwid': self.faft_client.system.get_crossystem_value('hwid'),
+ 'fwid': self.faft_client.system.get_crossystem_value('fwid'),
})
@@ -244,7 +244,7 @@
try:
self.wait_for_client(install_deps=True)
- lines = self.faft_client.run_shell_command_get_output(
+ lines = self.faft_client.system.run_shell_command_get_output(
'crossystem recovery_reason')
recovery_reason = int(lines[0])
logging.info('Got the recovery reason %d.', recovery_reason)
@@ -290,7 +290,7 @@
# DUT may be broken by a corrupted OS image. Restore OS image.
self._ensure_client_in_recovery()
logging.info('Try restore the OS image...')
- self.faft_client.run_shell_command('chromeos-install --yes')
+ self.faft_client.system.run_shell_command('chromeos-install --yes')
self.sync_and_warm_reboot()
self.wait_for_client_offline()
self.wait_dev_screen_and_ctrl_d()
@@ -455,7 +455,8 @@
Returns:
A string of the server address.
"""
- r = self.faft_client.run_shell_command_get_output("echo $SSH_CLIENT")
+ r = self.faft_client.system.run_shell_command_get_output(
+ "echo $SSH_CLIENT")
return r[0].split()[0]
@@ -554,7 +555,8 @@
'state_checker': (self.checkers.crossystem_checker, {
'mainfw_type': ('developer', 'normal'),
}),
- 'userspace_action': self.faft_client.request_recovery_boot,
+ 'userspace_action': (
+ self.faft_client.system.request_recovery_boot),
'firmware_action': self.wait_fw_screen_and_plug_usb,
'install_deps_after_boot': True,
},
@@ -563,7 +565,7 @@
'mainfw_type': 'recovery',
'recovery_reason' : vboot.RECOVERY_REASON['US_TEST'],
}),
- 'userspace_action': (self.faft_client.run_shell_command,
+ 'userspace_action': (self.faft_client.system.run_shell_command,
install_cmd),
'reboot_action': self.cold_reboot,
'install_deps_after_boot': True,
@@ -593,15 +595,15 @@
clear_mask: A mask of flags to be cleared.
set_mask: A mask of flags to be set.
"""
- gbb_flags = self.faft_client.get_gbb_flags()
+ gbb_flags = self.faft_client.system.get_gbb_flags()
new_flags = gbb_flags & ctypes.c_uint32(~clear_mask).value | set_mask
if (gbb_flags != new_flags):
logging.info('Change the GBB flags from 0x%x to 0x%x.',
gbb_flags, new_flags)
- self.faft_client.run_shell_command(
+ self.faft_client.system.run_shell_command(
'/usr/share/vboot/bin/set_gbb_flags.sh 0x%x' % new_flags)
- self.faft_client.reload_firmware()
+ self.faft_client.bios.reload()
# If changing FORCE_DEV_SWITCH_ON flag, reboot to get a clear state
if ((gbb_flags ^ new_flags) & vboot.GBB_FLAG_FORCE_DEV_SWITCH_ON):
self.run_faft_step({
@@ -680,15 +682,15 @@
from_part: A string of partition number to be copied from.
to_part: A string of partition number to be copied to.
"""
- root_dev = self.faft_client.get_root_dev()
+ root_dev = self.faft_client.system.get_root_dev()
logging.info('Copying kernel from %s to %s. Please wait...',
from_part, to_part)
- self.faft_client.run_shell_command('dd if=%s of=%s bs=4M' %
+ self.faft_client.system.run_shell_command('dd if=%s of=%s bs=4M' %
(self._join_part(root_dev, self.KERNEL_MAP[from_part]),
self._join_part(root_dev, self.KERNEL_MAP[to_part])))
logging.info('Copying rootfs from %s to %s. Please wait...',
from_part, to_part)
- self.faft_client.run_shell_command('dd if=%s of=%s bs=4M' %
+ self.faft_client.system.run_shell_command('dd if=%s of=%s bs=4M' %
(self._join_part(root_dev, self.ROOTFS_MAP[from_part]),
self._join_part(root_dev, self.ROOTFS_MAP[to_part])))
@@ -703,7 +705,7 @@
part: A string of kernel partition number or 'a'/'b'.
"""
if not self.checkers.root_part_checker(part):
- if self.faft_client.diff_kernel_a_b():
+ if self.faft_client.kernel.diff_a_b():
self.copy_kernel_and_rootfs(
from_part=self.OTHER_KERNEL_MAP[part],
to_part=part)
@@ -747,7 +749,7 @@
if self.client_attr.chrome_ec:
self.set_chrome_ec_write_protect_and_reboot(enable)
else:
- self.faft_client.set_EC_write_protect(enable)
+ self.faft_client.ec.set_write_protect(enable)
self.sync_and_warm_reboot()
@@ -943,7 +945,7 @@
logging.info(
'Firmware is not booted with tried_fwb. Reboot into it.')
self.run_faft_step({
- 'userspace_action': self.faft_client.set_try_fw_b,
+ 'userspace_action': self.faft_client.system.set_try_fw_b,
})
else:
if not self.checkers.crossystem_checker({'tried_fwb': '0'}):
@@ -994,7 +996,7 @@
self.enable_keyboard_dev_mode()
else:
self.servo.enable_development_mode()
- self.faft_client.run_shell_command(
+ self.faft_client.system.run_shell_command(
'chromeos-firmwareupdate --mode todev && reboot')
@@ -1004,7 +1006,7 @@
self.disable_keyboard_dev_mode()
else:
self.servo.disable_development_mode()
- self.faft_client.run_shell_command(
+ self.faft_client.system.run_shell_command(
'chromeos-firmwareupdate --mode tonormal && reboot')
@@ -1067,7 +1069,7 @@
logging.info('System is not in dev mode. Reboot into it.')
self.run_faft_step({
'userspace_action': None if self.client_attr.keyboard_dev
- else (self.faft_client.run_shell_command,
+ else (self.faft_client.system.run_shell_command,
'chromeos-firmwareupdate --mode todev && reboot'),
'reboot_action': self.enable_keyboard_dev_mode if
self.client_attr.keyboard_dev else None,
@@ -1082,7 +1084,7 @@
logging.info('System is not in normal mode. Reboot into it.')
self.run_faft_step({
'userspace_action': None if self.client_attr.keyboard_dev
- else (self.faft_client.run_shell_command,
+ else (self.faft_client.system.run_shell_command,
'chromeos-firmwareupdate --mode tonormal && reboot'),
'reboot_action': self.disable_keyboard_dev_mode if
self.client_attr.keyboard_dev else None,
@@ -1099,7 +1101,7 @@
part: A string of kernel partition number or 'a'/'b'.
"""
self.ensure_kernel_boot(part)
- if self.faft_client.diff_kernel_a_b():
+ if self.faft_client.kernel.diff_a_b():
self.copy_kernel_and_rootfs(from_part=part,
to_part=self.OTHER_KERNEL_MAP[part])
self.reset_and_prioritize_kernel(part)
@@ -1113,17 +1115,17 @@
Args:
part: A string of partition number to be prioritized.
"""
- root_dev = self.faft_client.get_root_dev()
+ root_dev = self.faft_client.system.get_root_dev()
# Reset kernel A and B to bootable.
- self.faft_client.run_shell_command('cgpt add -i%s -P1 -S1 -T0 %s' %
- (self.KERNEL_MAP['a'], root_dev))
- self.faft_client.run_shell_command('cgpt add -i%s -P1 -S1 -T0 %s' %
- (self.KERNEL_MAP['b'], root_dev))
+ self.faft_client.system.run_shell_command(
+ 'cgpt add -i%s -P1 -S1 -T0 %s' % (self.KERNEL_MAP['a'], root_dev))
+ self.faft_client.system.run_shell_command(
+ 'cgpt add -i%s -P1 -S1 -T0 %s' % (self.KERNEL_MAP['b'], root_dev))
# Set kernel part highest priority.
- self.faft_client.run_shell_command('cgpt prioritize -i%s %s' %
+ self.faft_client.system.run_shell_command('cgpt prioritize -i%s %s' %
(self.KERNEL_MAP[part], root_dev))
# Safer to sync and wait until the cgpt status written to the disk.
- self.faft_client.run_shell_command('sync')
+ self.faft_client.system.run_shell_command('sync')
time.sleep(self.delay.sync)
@@ -1160,7 +1162,7 @@
This is the default reboot action on FAFT.
"""
- self.faft_client.run_shell_command('sync')
+ self.faft_client.system.run_shell_command('sync')
time.sleep(self.delay.sync)
self.warm_reboot()
@@ -1170,7 +1172,7 @@
This reboot action is used to reset EC for recovery mode.
"""
- self.faft_client.run_shell_command('sync')
+ self.faft_client.system.run_shell_command('sync')
time.sleep(self.delay.sync)
self.cold_reboot()
@@ -1184,7 +1186,7 @@
default: EC soft reboot;
'hard': EC cold/hard reboot.
"""
- self.faft_client.run_shell_command('sync')
+ self.faft_client.system.run_shell_command('sync')
time.sleep(self.delay.sync)
self.ec.reboot(flags)
time.sleep(self.delay.ec_reboot_cmd)
@@ -1461,10 +1463,10 @@
Current firmware sha follows the order (
vblock_a_sha, body_a_sha, vblock_b_sha, body_b_sha)
"""
- current_firmware_sha = (self.faft_client.get_firmware_sig_sha('a'),
- self.faft_client.get_firmware_sha('a'),
- self.faft_client.get_firmware_sig_sha('b'),
- self.faft_client.get_firmware_sha('b'))
+ current_firmware_sha = (self.faft_client.bios.get_sig_sha('a'),
+ self.faft_client.bios.get_body_sha('a'),
+ self.faft_client.bios.get_sig_sha('b'),
+ self.faft_client.bios.get_body_sha('b'))
return current_firmware_sha
@@ -1475,7 +1477,7 @@
True if it is changed, otherwise Flase.
"""
# Device may not be rebooted after test.
- self.faft_client.reload_firmware()
+ self.faft_client.bios.reload()
current_sha = self.get_current_firmware_sha()
@@ -1500,8 +1502,8 @@
Args:
suffix: a string appended to backup file name
"""
- remote_temp_dir = self.faft_client.create_temp_dir()
- self.faft_client.dump_firmware(os.path.join(remote_temp_dir, 'bios'))
+ remote_temp_dir = self.faft_client.system.create_temp_dir()
+ self.faft_client.bios.dump_whole(os.path.join(remote_temp_dir, 'bios'))
self._client.get_file(os.path.join(remote_temp_dir, 'bios'),
os.path.join(self.resultsdir, 'bios' + suffix))
@@ -1537,11 +1539,12 @@
self.backup_firmware(suffix='.corrupt')
# Restore firmware.
- remote_temp_dir = self.faft_client.create_temp_dir()
+ remote_temp_dir = self.faft_client.system.create_temp_dir()
self._client.send_file(os.path.join(self.resultsdir, 'bios' + suffix),
os.path.join(remote_temp_dir, 'bios'))
- self.faft_client.write_firmware(os.path.join(remote_temp_dir, 'bios'))
+ self.faft_client.bios.write_whole(
+ os.path.join(remote_temp_dir, 'bios'))
self.sync_and_warm_reboot()
self.wait_for_client_offline()
self.wait_dev_screen_and_ctrl_d()
@@ -1572,7 +1575,8 @@
if is_shellball:
logging.info('Device will update firmware with shellball %s',
shellball)
- temp_dir = self.faft_client.create_temp_dir('shellball_')
+ temp_dir = self.faft_client.system.create_temp_dir(
+ 'shellball_')
temp_shellball = os.path.join(temp_dir, 'updater.sh')
self._client.send_file(shellball, temp_shellball)
updater_path = temp_shellball
diff --git a/server/cros/servo_test.py b/server/cros/servo_test.py
index 1793b40..82f6bb7 100644
--- a/server/cros/servo_test.py
+++ b/server/cros/servo_test.py
@@ -63,7 +63,7 @@
'remote_log_file': '/tmp/faft_client.log',
'remote_process': None,
'ssh_tunnel': None,
- 'polling_rpc': 'is_available',
+ 'polling_rpc': 'system.is_available',
'ssh_config': '-o StrictHostKeyChecking=no '
'-o UserKnownHostsFile=/dev/null ',
},
diff --git a/server/site_tests/firmware_CgptState/firmware_CgptState.py b/server/site_tests/firmware_CgptState/firmware_CgptState.py
index d7ef5be..bc4baf0 100644
--- a/server/site_tests/firmware_CgptState/firmware_CgptState.py
+++ b/server/site_tests/firmware_CgptState/firmware_CgptState.py
@@ -34,7 +34,7 @@
'tail -f /tmp/faft_log.txt' % self.host.ip], shell=True)
# Trigger the CgptState test logic on client side.
# TODO(waihong): Move the test items and logic in FAFT.
- if self.faft_client.run_cgpt_test_loop():
+ if self.faft_client.cgpt.run_test_loop():
self.not_finished = False
# Terminate the log-showing thread and prepare for reboot.
if show_client_log and show_client_log.poll() is None:
@@ -55,10 +55,10 @@
def run_once(self):
- self.faft_client.set_cgpt_test_step(0)
+ self.faft_client.cgpt.set_test_step(0)
while self.not_finished:
logging.info('======== Running CgptState test step %d ========',
- self.faft_client.get_cgpt_test_step() + 1)
+ self.faft_client.cgpt.get_test_step() + 1)
self.run_faft_step({
'userspace_action': self.run_test_step,
'reboot_action': self.full_power_off_and_on,
diff --git a/server/site_tests/firmware_CorruptBothFwBodyAB/firmware_CorruptBothFwBodyAB.py b/server/site_tests/firmware_CorruptBothFwBodyAB/firmware_CorruptBothFwBodyAB.py
index 2a1c9e7..7b0c255 100644
--- a/server/site_tests/firmware_CorruptBothFwBodyAB/firmware_CorruptBothFwBodyAB.py
+++ b/server/site_tests/firmware_CorruptBothFwBodyAB/firmware_CorruptBothFwBodyAB.py
@@ -28,7 +28,7 @@
def setup(self, dev_mode=False):
super(firmware_CorruptBothFwBodyAB, self).setup()
self.backup_firmware()
- if (self.faft_client.get_firmware_flags('a') &
+ if (self.faft_client.bios.get_preamble_flags('a') &
vboot.PREAMBLE_USE_RO_NORMAL):
self.use_ro = True
self.setup_dev_mode(dev_mode)
@@ -52,14 +52,14 @@
'state_checker': (self.checkers.crossystem_checker, {
'mainfw_type': 'developer' if dev_mode else 'normal',
}),
- 'userspace_action': (self.faft_client.corrupt_firmware_body,
+ 'userspace_action': (self.faft_client.bios.corrupt_body,
(('a', 'b'),)),
},
{ # Step 2, still expected normal/developer boot and restore
'state_checker': (self.checkers.crossystem_checker, {
'mainfw_type': 'developer' if dev_mode else 'normal',
}),
- 'userspace_action': (self.faft_client.restore_firmware_body,
+ 'userspace_action': (self.faft_client.bios.restore_body,
(('a', 'b'),)),
},
))
@@ -69,7 +69,7 @@
'state_checker': (self.checkers.crossystem_checker, {
'mainfw_type': 'developer' if dev_mode else 'normal',
}),
- 'userspace_action': (self.faft_client.corrupt_firmware_body,
+ 'userspace_action': (self.faft_client.bios.corrupt_body,
(('a', 'b'),)),
'firmware_action': None if dev_mode else
self.wait_fw_screen_and_plug_usb,
@@ -82,7 +82,7 @@
(vboot.RECOVERY_REASON['RO_INVALID_RW'],
vboot.RECOVERY_REASON['RW_VERIFY_BODY']),
}),
- 'userspace_action': (self.faft_client.restore_firmware_body,
+ 'userspace_action': (self.faft_client.bios.restore_body,
(('a', 'b'),)),
},
{ # Step 3, expected normal boot, done
diff --git a/server/site_tests/firmware_CorruptBothFwSigAB/firmware_CorruptBothFwSigAB.py b/server/site_tests/firmware_CorruptBothFwSigAB/firmware_CorruptBothFwSigAB.py
index cead882..d2fb3ab 100644
--- a/server/site_tests/firmware_CorruptBothFwSigAB/firmware_CorruptBothFwSigAB.py
+++ b/server/site_tests/firmware_CorruptBothFwSigAB/firmware_CorruptBothFwSigAB.py
@@ -37,7 +37,7 @@
'state_checker': (self.checkers.crossystem_checker, {
'mainfw_type': 'developer' if dev_mode else 'normal',
}),
- 'userspace_action': (self.faft_client.corrupt_firmware,
+ 'userspace_action': (self.faft_client.bios.corrupt_sig,
(('a', 'b'),)),
'firmware_action': None if dev_mode else
self.wait_fw_screen_and_plug_usb,
@@ -49,7 +49,7 @@
'recovery_reason': (vboot.RECOVERY_REASON['RO_INVALID_RW'],
vboot.RECOVERY_REASON['RW_VERIFY_KEYBLOCK']),
}),
- 'userspace_action': self.faft_client.set_try_fw_b,
+ 'userspace_action': self.faft_client.system.set_try_fw_b,
'firmware_action': None if dev_mode else
self.wait_fw_screen_and_plug_usb,
},
@@ -59,7 +59,7 @@
'recovery_reason': (vboot.RECOVERY_REASON['RO_INVALID_RW'],
vboot.RECOVERY_REASON['RW_VERIFY_KEYBLOCK']),
}),
- 'userspace_action': (self.faft_client.restore_firmware,
+ 'userspace_action': (self.faft_client.bios.restore_sig,
(('a', 'b'),)),
},
{ # Step 4, expected normal boot, done
diff --git a/server/site_tests/firmware_CorruptBothKernelAB/firmware_CorruptBothKernelAB.py b/server/site_tests/firmware_CorruptBothKernelAB/firmware_CorruptBothKernelAB.py
index cf91776..a49f187 100644
--- a/server/site_tests/firmware_CorruptBothKernelAB/firmware_CorruptBothKernelAB.py
+++ b/server/site_tests/firmware_CorruptBothKernelAB/firmware_CorruptBothKernelAB.py
@@ -31,7 +31,7 @@
if not self.check_root_part_on_non_recovery(part):
logging.info('Recover the disk OS by running chromeos-install...')
self.run_faft_step({
- 'userspace_action': (self.faft_client.run_shell_command,
+ 'userspace_action': (self.faft_client.system.run_shell_command,
'chromeos-install --yes')
})
@@ -49,7 +49,7 @@
def run_once(self, dev_mode=False):
- platform = self.faft_client.get_platform_name()
+ platform = self.faft_client.system.get_platform_name()
if platform in ('Mario', 'Alex', 'ZGB'):
recovery_reason = vboot.RECOVERY_REASON['RW_NO_OS']
elif platform in ('Aebl', 'Kaen'):
@@ -60,7 +60,7 @@
self.register_faft_sequence((
{ # Step 1, corrupt kernel A and B
'state_checker': (self.check_root_part_on_non_recovery, 'a'),
- 'userspace_action': (self.faft_client.corrupt_kernel,
+ 'userspace_action': (self.faft_client.kernel.corrupt_sig,
(('a', 'b'),)),
# Kernel is verified after firmware screen.
# Should press Ctrl-D to skip the screen on dev_mode.
@@ -73,7 +73,7 @@
'mainfw_type': 'recovery',
'recovery_reason': recovery_reason,
}),
- 'userspace_action': (self.faft_client.restore_kernel,
+ 'userspace_action': (self.faft_client.kernel.restore_sig,
(('a', 'b'),)),
},
{ # Step 3, expected kernel A normal/dev boot
diff --git a/server/site_tests/firmware_CorruptFwBodyA/firmware_CorruptFwBodyA.py b/server/site_tests/firmware_CorruptFwBodyA/firmware_CorruptFwBodyA.py
index 52f19ff..5d8637b 100644
--- a/server/site_tests/firmware_CorruptFwBodyA/firmware_CorruptFwBodyA.py
+++ b/server/site_tests/firmware_CorruptFwBodyA/firmware_CorruptFwBodyA.py
@@ -34,7 +34,7 @@
def run_once(self):
- if (self.faft_client.get_firmware_flags('a') &
+ if (self.faft_client.bios.get_preamble_flags('a') &
vboot.PREAMBLE_USE_RO_NORMAL):
# USE_RO_NORMAL flag is ON. Firmware body corruption doesn't
# hurt the booting results.
@@ -45,7 +45,7 @@
'mainfw_act': 'A',
'tried_fwb': '0',
}),
- 'userspace_action': (self.faft_client.corrupt_firmware_body,
+ 'userspace_action': (self.faft_client.bios.corrupt_body,
'a'),
},
{ # Step 2, still expected firmware A boot and restore
@@ -53,7 +53,7 @@
'mainfw_act': 'A',
'tried_fwb': '0',
}),
- 'userspace_action': (self.faft_client.restore_firmware_body,
+ 'userspace_action': (self.faft_client.bios.restore_body,
'a'),
},
))
@@ -65,7 +65,7 @@
'mainfw_act': 'A',
'tried_fwb': '0',
}),
- 'userspace_action': (self.faft_client.corrupt_firmware_body,
+ 'userspace_action': (self.faft_client.bios.corrupt_body,
'a'),
},
{ # Step 2, expected firmware B boot and restore firmware A
@@ -73,7 +73,7 @@
'mainfw_act': 'B',
'tried_fwb': '0',
}),
- 'userspace_action': (self.faft_client.restore_firmware_body,
+ 'userspace_action': (self.faft_client.bios.restore_body,
'a'),
},
{ # Step 3, expected firmware A boot, done
diff --git a/server/site_tests/firmware_CorruptFwBodyB/firmware_CorruptFwBodyB.py b/server/site_tests/firmware_CorruptFwBodyB/firmware_CorruptFwBodyB.py
index 521759b..37db186 100644
--- a/server/site_tests/firmware_CorruptFwBodyB/firmware_CorruptFwBodyB.py
+++ b/server/site_tests/firmware_CorruptFwBodyB/firmware_CorruptFwBodyB.py
@@ -32,7 +32,7 @@
def run_once(self):
- RO_enabled = (self.faft_client.get_firmware_flags('b') &
+ RO_enabled = (self.faft_client.bios.get_preamble_flags('b') &
vboot.PREAMBLE_USE_RO_NORMAL)
self.register_faft_sequence((
{ # Step 1, corrupt firmware body B
@@ -40,7 +40,7 @@
'mainfw_act': 'A',
'tried_fwb': '0',
}),
- 'userspace_action': (self.faft_client.corrupt_firmware_body,
+ 'userspace_action': (self.faft_client.bios.corrupt_body,
'b'),
},
{ # Step 2, expected firmware A boot and set try_fwb flag
@@ -48,7 +48,7 @@
'mainfw_act': 'A',
'tried_fwb': '0',
}),
- 'userspace_action': self.faft_client.set_try_fw_b,
+ 'userspace_action': self.faft_client.system.set_try_fw_b,
},
{ # Step 3, if RO enabled, expected firmware B boot; otherwise,
# still A boot since B is corrupted. Restore B later.
@@ -56,7 +56,7 @@
'mainfw_act': 'B' if RO_enabled else 'A',
'tried_fwb': '1',
}),
- 'userspace_action': (self.faft_client.restore_firmware_body,
+ 'userspace_action': (self.faft_client.bios.restore_body,
'b'),
},
{ # Step 4, final check and done
diff --git a/server/site_tests/firmware_CorruptFwSigA/firmware_CorruptFwSigA.py b/server/site_tests/firmware_CorruptFwSigA/firmware_CorruptFwSigA.py
index 91c3ef5..b3dbcda 100644
--- a/server/site_tests/firmware_CorruptFwSigA/firmware_CorruptFwSigA.py
+++ b/server/site_tests/firmware_CorruptFwSigA/firmware_CorruptFwSigA.py
@@ -31,21 +31,21 @@
'mainfw_act': 'A',
'tried_fwb': '0',
}),
- 'userspace_action': (self.faft_client.corrupt_firmware, 'a'),
+ 'userspace_action': (self.faft_client.bios.corrupt_sig, 'a'),
},
{ # Step 2, expected firmware B boot and set fwb_tries flag
'state_checker': (self.checkers.crossystem_checker, {
'mainfw_act': 'B',
'tried_fwb': '0',
}),
- 'userspace_action': self.faft_client.set_try_fw_b,
+ 'userspace_action': self.faft_client.system.set_try_fw_b,
},
{ # Step 3, still expected firmware B boot and restore firmware A
'state_checker': (self.checkers.crossystem_checker, {
'mainfw_act': 'B',
'tried_fwb': '1',
}),
- 'userspace_action': (self.faft_client.restore_firmware, 'a'),
+ 'userspace_action': (self.faft_client.bios.restore_sig, 'a'),
},
{ # Step 4, expected firmware A boot, done
'state_checker': (self.checkers.crossystem_checker, {
diff --git a/server/site_tests/firmware_CorruptFwSigB/firmware_CorruptFwSigB.py b/server/site_tests/firmware_CorruptFwSigB/firmware_CorruptFwSigB.py
index 74213bb..8d2bf28 100644
--- a/server/site_tests/firmware_CorruptFwSigB/firmware_CorruptFwSigB.py
+++ b/server/site_tests/firmware_CorruptFwSigB/firmware_CorruptFwSigB.py
@@ -32,21 +32,21 @@
'mainfw_act': 'A',
'tried_fwb': '0',
}),
- 'userspace_action': (self.faft_client.corrupt_firmware, 'b'),
+ 'userspace_action': (self.faft_client.bios.corrupt_sig, 'b'),
},
{ # Step 2, expected firmware A boot and set try_fwb flag
'state_checker': (self.checkers.crossystem_checker, {
'mainfw_act': 'A',
'tried_fwb': '0',
}),
- 'userspace_action': self.faft_client.set_try_fw_b,
+ 'userspace_action': self.faft_client.system.set_try_fw_b,
},
{ # Step 3, expected firmware A boot and restore firmware B
'state_checker': (self.checkers.crossystem_checker, {
'mainfw_act': 'A',
'tried_fwb': '1',
}),
- 'userspace_action': (self.faft_client.restore_firmware, 'b'),
+ 'userspace_action': (self.faft_client.bios.restore_sig, 'b'),
},
{ # Step 4, final check and done
'state_checker': (self.checkers.crossystem_checker, {
diff --git a/server/site_tests/firmware_CorruptKernelA/firmware_CorruptKernelA.py b/server/site_tests/firmware_CorruptKernelA/firmware_CorruptKernelA.py
index 776ea30..03ff1b6 100644
--- a/server/site_tests/firmware_CorruptKernelA/firmware_CorruptKernelA.py
+++ b/server/site_tests/firmware_CorruptKernelA/firmware_CorruptKernelA.py
@@ -31,11 +31,11 @@
self.register_faft_sequence((
{ # Step 1, corrupt kernel A
'state_checker': (self.checkers.root_part_checker, 'a'),
- 'userspace_action': (self.faft_client.corrupt_kernel, 'a'),
+ 'userspace_action': (self.faft_client.kernel.corrupt_sig, 'a'),
},
{ # Step 2, expected kernel B boot and restore kernel A
'state_checker': (self.checkers.root_part_checker, 'b'),
- 'userspace_action': (self.faft_client.restore_kernel, 'a'),
+ 'userspace_action': (self.faft_client.kernel.restore_sig, 'a'),
},
{ # Step 3, expected kernel A boot
'state_checker': (self.checkers.root_part_checker, 'a'),
diff --git a/server/site_tests/firmware_CorruptKernelB/firmware_CorruptKernelB.py b/server/site_tests/firmware_CorruptKernelB/firmware_CorruptKernelB.py
index 701a965..39cf166 100644
--- a/server/site_tests/firmware_CorruptKernelB/firmware_CorruptKernelB.py
+++ b/server/site_tests/firmware_CorruptKernelB/firmware_CorruptKernelB.py
@@ -37,11 +37,11 @@
},
{ # Step 2, expected kernel B boot and corrupt kernel B
'state_checker': (self.checkers.root_part_checker, 'b'),
- 'userspace_action': (self.faft_client.corrupt_kernel, 'b'),
+ 'userspace_action': (self.faft_client.kernel.corrupt_sig, 'b'),
},
{ # Step 3, expected kernel A boot and restore kernel B
'state_checker': (self.checkers.root_part_checker, 'a'),
- 'userspace_action': (self.faft_client.restore_kernel, 'b'),
+ 'userspace_action': (self.faft_client.kernel.restore_sig, 'b'),
},
{ # Step 4, expected kernel B boot and prioritize kerenl A
'state_checker': (self.checkers.root_part_checker, 'b'),
diff --git a/server/site_tests/firmware_DevBootUSB/firmware_DevBootUSB.py b/server/site_tests/firmware_DevBootUSB/firmware_DevBootUSB.py
index 861fae5..92412c9 100644
--- a/server/site_tests/firmware_DevBootUSB/firmware_DevBootUSB.py
+++ b/server/site_tests/firmware_DevBootUSB/firmware_DevBootUSB.py
@@ -26,7 +26,7 @@
self.setup_dev_mode(dev_mode=True)
self.setup_usbkey(usbkey=True, host=False)
- self.original_dev_boot_usb = self.faft_client.get_dev_boot_usb()
+ self.original_dev_boot_usb = self.faft_client.system.get_dev_boot_usb()
logging.info('Original dev_boot_usb value: %s',
str(self.original_dev_boot_usb))
@@ -51,10 +51,10 @@
If not, it may be a test failure during step 2 or 3, try to reboot
and press Ctrl-D to internal device boot.
"""
- if self.faft_client.is_removable_device_boot():
+ if self.faft_client.system.is_removable_device_boot():
logging.info('Reboot into internal disk...')
self.run_faft_step({
- 'userspace_action': (self.faft_client.set_dev_boot_usb,
+ 'userspace_action': (self.faft_client.system.set_dev_boot_usb,
self.original_dev_boot_usb),
'firmware_action': self.wait_fw_screen_and_ctrl_d,
})
@@ -69,7 +69,8 @@
self.register_faft_sequence((
{ # Step 1, expected developer mode, set dev_boot_usb to 0
'state_checker': (self.checkers.dev_boot_usb_checker, False),
- 'userspace_action': (self.faft_client.set_dev_boot_usb, 0),
+ 'userspace_action': (self.faft_client.system.set_dev_boot_usb,
+ 0),
# Ctrl-U doesn't take effect as dev_boot_usb=0.
# Falls back to Ctrl-D internal disk boot.
'firmware_action': self.try_ctrl_u_and_ctrl_d,
@@ -78,14 +79,15 @@
{ # Step 2, expected internal disk boot, set dev_boot_usb to 1
'state_checker': (self.checkers.dev_boot_usb_checker, False,
"Not internal disk boot, dev_boot_usb misbehaved"),
- 'userspace_action': (self.faft_client.set_dev_boot_usb, 1),
+ 'userspace_action': (self.faft_client.system.set_dev_boot_usb,
+ 1),
'firmware_action': self.wait_fw_screen_and_ctrl_u,
'install_deps_after_boot': True,
},
{ # Step 3, expected USB boot, set dev_boot_usb to the original
'state_checker': (self.checkers.dev_boot_usb_checker, True,
"Not USB boot, Ctrl-U not work"),
- 'userspace_action': (self.faft_client.set_dev_boot_usb,
+ 'userspace_action': (self.faft_client.system.set_dev_boot_usb,
self.original_dev_boot_usb),
'firmware_action': self.wait_fw_screen_and_ctrl_d,
},
diff --git a/server/site_tests/firmware_DevFwNormalBoot/firmware_DevFwNormalBoot.py b/server/site_tests/firmware_DevFwNormalBoot/firmware_DevFwNormalBoot.py
index bf79283..efada83 100644
--- a/server/site_tests/firmware_DevFwNormalBoot/firmware_DevFwNormalBoot.py
+++ b/server/site_tests/firmware_DevFwNormalBoot/firmware_DevFwNormalBoot.py
@@ -26,19 +26,19 @@
def corrupt_fw_b_and_disable_devsw(self):
- self.faft_client.corrupt_firmware('b')
+ self.faft_client.bios.corrupt_sig('b')
self.servo.disable_development_mode()
def restore_fw_b_and_enable_devsw(self):
- self.faft_client.restore_firmware('b')
+ self.faft_client.bios.restore_sig('b')
self.servo.enable_development_mode()
def setup(self):
super(firmware_DevFwNormalBoot, self).setup()
# This test is only meaningful on Alex/ZGB.
- if self.faft_client.get_platform_name() in ('Alex', 'ZGB'):
+ if self.faft_client.system.get_platform_name() in ('Alex', 'ZGB'):
self.has_different_dev_fw = True
# This test is run on developer mode only.
self.setup_dev_mode(dev_mode=True)
diff --git a/server/site_tests/firmware_DevModeStress/firmware_DevModeStress.py b/server/site_tests/firmware_DevModeStress/firmware_DevModeStress.py
index 10b2dda..f6bfc92 100644
--- a/server/site_tests/firmware_DevModeStress/firmware_DevModeStress.py
+++ b/server/site_tests/firmware_DevModeStress/firmware_DevModeStress.py
@@ -47,7 +47,7 @@
"""
cmd = ('(sleep %d; powerd_suspend)&' %
self.EC_SUSPEND_DELAY)
- self.faft_client.run_shell_command(cmd)
+ self.faft_client.system.run_shell_command(cmd)
self.kill_remote()
time.sleep(self.EC_SUSPEND_DELAY)
wake_func()
diff --git a/server/site_tests/firmware_DevScreenTimeout/firmware_DevScreenTimeout.py b/server/site_tests/firmware_DevScreenTimeout/firmware_DevScreenTimeout.py
index 2a3dd28..0005d92 100644
--- a/server/site_tests/firmware_DevScreenTimeout/firmware_DevScreenTimeout.py
+++ b/server/site_tests/firmware_DevScreenTimeout/firmware_DevScreenTimeout.py
@@ -52,7 +52,7 @@
Raises:
error.TestError: If the firmware-boot-time file does not exist.
"""
- [fw_time] = self.faft_client.run_shell_command_get_output(
+ [fw_time] = self.faft_client.system.run_shell_command_get_output(
'cat /tmp/firmware-boot-time')
logging.info('Got firmware boot time: %s', fw_time)
if fw_time:
diff --git a/server/site_tests/firmware_DevTriggerRecovery/firmware_DevTriggerRecovery.py b/server/site_tests/firmware_DevTriggerRecovery/firmware_DevTriggerRecovery.py
index 1395410..ce432d7 100644
--- a/server/site_tests/firmware_DevTriggerRecovery/firmware_DevTriggerRecovery.py
+++ b/server/site_tests/firmware_DevTriggerRecovery/firmware_DevTriggerRecovery.py
@@ -27,7 +27,7 @@
# For Alex/ZGB, it is dev switch on but normal firmware boot.
# For other platforms, it is dev switch on and developer firmware boot.
def check_devsw_on_transition(self):
- if self.faft_client.get_platform_name() in ('Alex', 'ZGB'):
+ if self.faft_client.system.get_platform_name() in ('Alex', 'ZGB'):
self.need_dev_transition = True
return self.checkers.crossystem_checker({
'devsw_boot': '1',
@@ -86,7 +86,7 @@
# run "chromeos-firmwareupdate --mode todev && reboot",
# and trigger recovery boot at dev screen
'state_checker': self.check_devsw_on_transition,
- 'userspace_action': (self.faft_client.run_shell_command,
+ 'userspace_action': (self.faft_client.system.run_shell_command,
'chromeos-firmwareupdate --mode todev && reboot'),
# Ignore the default reboot_action here because the
# userspace_action (firmware updater) will reboot the system.
@@ -106,7 +106,7 @@
{ # Step 4, expected values based on platforms (see above),
# and run "chromeos-firmwareupdate --mode tonormal && reboot"
'state_checker': self.check_devsw_off_transition,
- 'userspace_action': (self.faft_client.run_shell_command,
+ 'userspace_action': (self.faft_client.system.run_shell_command,
'chromeos-firmwareupdate --mode tonormal && reboot'),
'reboot_action': None,
},
diff --git a/server/site_tests/firmware_ECBattery/firmware_ECBattery.py b/server/site_tests/firmware_ECBattery/firmware_ECBattery.py
index 35d6361..6bbebe4 100644
--- a/server/site_tests/firmware_ECBattery/firmware_ECBattery.py
+++ b/server/site_tests/firmware_ECBattery/firmware_ECBattery.py
@@ -44,7 +44,7 @@
def _get_battery_path(self):
"""Get battery path in sysfs."""
- match = self.faft_client.run_shell_command_get_output(
+ match = self.faft_client.system.run_shell_command_get_output(
'grep -iH --color=no "Battery" /sys/class/power_supply/*/type')
name = re.search("/sys/class/power_supply/([^/]+)/",
match[0]).group(1)
@@ -63,7 +63,8 @@
"""
servo_reading = int(self.servo.get('ppvar_vbat_mv'))
# Kernel gives voltage value in uV. Convert to mV here.
- kernel_reading = int(self.faft_client.run_shell_command_get_output(
+ kernel_reading = int(
+ self.faft_client.system.run_shell_command_get_output(
'cat %s' % self._battery_voltage)[0]) / 1000
logging.info("Voltage reading from servo: %dmV", servo_reading)
logging.info("Voltage reading from kernel: %dmV", kernel_reading)
@@ -85,7 +86,8 @@
# TODO([email protected]): Investigate the sign issue.
servo_reading = abs(int(self.servo.get('ppvar_vbat_ma')))
# Kernel gives current value in uA. Convert to mA here.
- kernel_reading = abs(int(self.faft_client.run_shell_command_get_output(
+ kernel_reading = abs(
+ int(self.faft_client.system.run_shell_command_get_output(
'cat %s' % self._battery_current)[0])) / 1000
logging.info("Current reading from servo: %dmA", servo_reading)
logging.info("Current reading from kernel: %dmA", kernel_reading)
diff --git a/server/site_tests/firmware_ECLidSwitch/firmware_ECLidSwitch.py b/server/site_tests/firmware_ECLidSwitch/firmware_ECLidSwitch.py
index 8a662b3..3e44a3b 100644
--- a/server/site_tests/firmware_ECLidSwitch/firmware_ECLidSwitch.py
+++ b/server/site_tests/firmware_ECLidSwitch/firmware_ECLidSwitch.py
@@ -91,7 +91,7 @@
Args:
wake_func: Delayed function to wake DUT.
"""
- self.faft_client.run_shell_command('shutdown -P now')
+ self.faft_client.system.run_shell_command('shutdown -P now')
wake_func()
@@ -106,7 +106,7 @@
pattern_percent = re.compile(
'Current keyboard backlight percent: (\d*)')
pattern_disable = re.compile('Keyboard backlight disabled.')
- lines = self.faft_client.run_shell_command_get_output(cmd)
+ lines = self.faft_client.system.run_shell_command_get_output(cmd)
for line in lines:
matched_percent = pattern_percent.match(line)
if matched_percent is not None:
@@ -124,7 +124,7 @@
value: Backlight brightness percentage 0~100.
"""
cmd = 'ectool pwmsetkblight %d' % value
- self.faft_client.run_shell_command(cmd)
+ self.faft_client.system.run_shell_command(cmd)
def check_keycode(self):
@@ -137,13 +137,13 @@
self._open_lid()
self.delayed_close_lid()
- lines = self.faft_client.run_shell_command_get_output(cmd)
+ lines = self.faft_client.system.run_shell_command_get_output(cmd)
if int(lines[0].strip()) != 0:
logging.error("Captured power button keycode on lid close.")
self._open_lid()
return False
self.delayed_open_lid()
- lines = self.faft_client.run_shell_command_get_output(cmd)
+ lines = self.faft_client.system.run_shell_command_get_output(cmd)
if int(lines[0].strip()) != 0:
logging.error("Captured power button keycode on lid close.")
return False
@@ -181,8 +181,8 @@
"""
ok = True
logging.info("Stopping power management daemons")
- self.faft_client.run_shell_command('stop powerd')
- self.faft_client.run_shell_command('stop powerm')
+ self.faft_client.system.run_shell_command('stop powerd')
+ self.faft_client.system.run_shell_command('stop powerm')
if not self.check_keycode():
logging.error("check_keycode failed.")
ok = False
@@ -190,8 +190,8 @@
logging.error("check_backlight failed.")
ok = False
logging.info("Restarting power management daemons")
- self.faft_client.run_shell_command('start powerd')
- self.faft_client.run_shell_command('start powerm')
+ self.faft_client.system.run_shell_command('start powerd')
+ self.faft_client.system.run_shell_command('start powerm')
return ok
diff --git a/server/site_tests/firmware_ECPowerButton/firmware_ECPowerButton.py b/server/site_tests/firmware_ECPowerButton/firmware_ECPowerButton.py
index ae03a91..b4b6d38 100644
--- a/server/site_tests/firmware_ECPowerButton/firmware_ECPowerButton.py
+++ b/server/site_tests/firmware_ECPowerButton/firmware_ECPowerButton.py
@@ -39,7 +39,7 @@
def kill_powerd(self):
"""Stop powerd on client."""
- self.faft_client.run_shell_command("stop powerd")
+ self.faft_client.system.run_shell_command("stop powerd")
def debounce_power_button(self):
@@ -51,7 +51,7 @@
# Delay 3 seconds to allow "showkey" to start on client machine.
# Press power button for only 10ms. Should be debounced.
Timer(3, self.servo.power_key, [0.001]).start()
- lines = self.faft_client.run_shell_command_get_output("showkey")
+ lines = self.faft_client.system.run_shell_command_get_output("showkey")
for line in lines:
if re.search("keycode 116", line) is not None:
return False
diff --git a/server/site_tests/firmware_ECPowerG3/firmware_ECPowerG3.py b/server/site_tests/firmware_ECPowerG3/firmware_ECPowerG3.py
index c809e5c..5f3fef6 100644
--- a/server/site_tests/firmware_ECPowerG3/firmware_ECPowerG3.py
+++ b/server/site_tests/firmware_ECPowerG3/firmware_ECPowerG3.py
@@ -52,7 +52,7 @@
def check_G3(self):
"""Shutdown the system and check if X86 drop into G3 correctly."""
- self.faft_client.run_shell_command("shutdown -P now")
+ self.faft_client.system.run_shell_command("shutdown -P now")
if not self.wait_power("x86 power state 1 = S5", self.S5_TIMEOUT):
logging.error("Fails to wait for S5 state")
self._failed = True
diff --git a/server/site_tests/firmware_ECThermal/firmware_ECThermal.py b/server/site_tests/firmware_ECThermal/firmware_ECThermal.py
index 9235825..62c5f09 100644
--- a/server/site_tests/firmware_ECThermal/firmware_ECThermal.py
+++ b/server/site_tests/firmware_ECThermal/firmware_ECThermal.py
@@ -74,7 +74,7 @@
current_id = 0
while True:
try:
- lines = self.faft_client.run_shell_command_get_output(
+ lines = self.faft_client.system.run_shell_command_get_output(
'ectool thermalget %d %d' % (type_id, current_id))
except xmlrpclib.Fault:
break
@@ -127,7 +127,7 @@
self._num_temp_sensor = 0
while True:
try:
- self.faft_client.run_shell_command('ectool temps %d' %
+ self.faft_client.system.run_shell_command('ectool temps %d' %
self._num_temp_sensor)
self._num_temp_sensor = self._num_temp_sensor + 1
except xmlrpclib.Fault:
@@ -138,7 +138,7 @@
def setup(self):
super(firmware_ECThermal, self).setup()
try:
- self.faft_client.run_shell_command('stop temp_metrics')
+ self.faft_client.system.run_shell_command('stop temp_metrics')
except xmlrpclib.Fault:
self._has_temp_metrics = False
else:
@@ -155,7 +155,7 @@
self.enable_auto_fan_control()
if self._has_temp_metrics:
logging.info('Starting temp_metrics')
- self.faft_client.run_shell_command('start temp_metrics')
+ self.faft_client.system.run_shell_command('start temp_metrics')
super(firmware_ECThermal, self).cleanup()
@@ -171,7 +171,7 @@
ectool.
"""
for temp_id in range(self._num_temp_sensor):
- lines = self.faft_client.run_shell_command_get_output(
+ lines = self.faft_client.system.run_shell_command_get_output(
'ectool tempsinfo %d' % temp_id)
for line in lines:
matched = re.match('Sensor name: (.*)', line)
@@ -196,7 +196,7 @@
"""
assert sensor_id < self._num_temp_sensor
pattern = re.compile('Reading temperature...(\d*)')
- lines = self.faft_client.run_shell_command_get_output(
+ lines = self.faft_client.system.run_shell_command_get_output(
'ectool temps %d' % sensor_id)
for line in lines:
matched = pattern.match(line)
@@ -250,19 +250,20 @@
if block_count != -1:
stress_cmd = 'dd if=/dev/urandom of=/dev/null bs=1M count=%d'
logging.info("Stressing DUT...")
- self.faft_client.run_shell_command(stress_cmd % block_count)
+ self.faft_client.system.run_shell_command(stress_cmd % block_count)
return None
else:
logging.info("Stressing DUT with %d threads...", thread)
- self.faft_client.run_shell_command('pkill dd')
+ self.faft_client.system.run_shell_command('pkill dd')
stress_cmd = 'dd if=/dev/urandom of=/dev/null bs=1M &'
# Grep for [d]d instead of dd to prevent getting the PID of grep
# itself.
pid_cmd = "ps -ef | grep '[d]d if=/dev/urandom' | awk '{print $2}'"
self._stress_pid = list()
for _ in xrange(thread):
- self.faft_client.run_shell_command(stress_cmd)
- lines = self.faft_client.run_shell_command_get_output(pid_cmd)
+ self.faft_client.system.run_shell_command(stress_cmd)
+ lines = self.faft_client.system.run_shell_command_get_output(
+ pid_cmd)
for line in lines:
logging.info("PID is %s", line)
self._stress_pid.append(int(line.strip()))
@@ -273,7 +274,7 @@
"""Stop stressing DUT system"""
stop_cmd = 'kill -9 %d'
for pid in self._stress_pid:
- self.faft_client.run_shell_command(stop_cmd % pid)
+ self.faft_client.system.run_shell_command(stop_cmd % pid)
def check_fan_off(self):
@@ -322,7 +323,7 @@
"""
assert sensor_id < self._num_temp_sensor
pattern = re.compile('Sensor type: (\d*)')
- lines = self.faft_client.run_shell_command_get_output(
+ lines = self.faft_client.system.run_shell_command_get_output(
'ectool tempsinfo %d' % sensor_id)
for line in lines:
matched = pattern.match(line)
diff --git a/server/site_tests/firmware_ECUsbPorts/firmware_ECUsbPorts.py b/server/site_tests/firmware_ECUsbPorts/firmware_ECUsbPorts.py
index 2aa435c..71bd43a 100644
--- a/server/site_tests/firmware_ECUsbPorts/firmware_ECUsbPorts.py
+++ b/server/site_tests/firmware_ECUsbPorts/firmware_ECUsbPorts.py
@@ -46,7 +46,7 @@
(self.RPC_DELAY, ports_off_cmd,
self.REBOOT_DELAY,
ports_on_cmd))
- self.faft_client.run_shell_command(cmd)
+ self.faft_client.system.run_shell_command(cmd)
self.kill_remote()
@@ -104,7 +104,7 @@
"""Shutdown the system and check USB ports are disabled."""
self._failed = False
port_cnt = self.get_port_count()
- self.faft_client.run_shell_command("shutdown -P now")
+ self.faft_client.system.run_shell_command("shutdown -P now")
if not self.wait_port_disabled(port_cnt, self.SHUTDOWN_TIMEOUT):
logging.info("Fails to wait for USB port disabled")
self._failed = True
diff --git a/server/site_tests/firmware_ECWakeSource/firmware_ECWakeSource.py b/server/site_tests/firmware_ECWakeSource/firmware_ECWakeSource.py
index 0e98d08..683e910 100644
--- a/server/site_tests/firmware_ECWakeSource/firmware_ECWakeSource.py
+++ b/server/site_tests/firmware_ECWakeSource/firmware_ECWakeSource.py
@@ -67,7 +67,7 @@
"""
cmd = ('(sleep %d; powerd_suspend)&' %
self.EC_SUSPEND_DELAY)
- self.faft_client.run_shell_command(cmd)
+ self.faft_client.system.run_shell_command(cmd)
self.kill_remote()
time.sleep(self.EC_SUSPEND_DELAY)
wake_func()
@@ -75,7 +75,7 @@
def hibernate_and_wake_by_power_button(self):
"""Shutdown and hibernate EC. Then wake by power button."""
- self.faft_client.run_shell_command("shutdown -P now")
+ self.faft_client.system.run_shell_command("shutdown -P now")
time.sleep(self.SHUTDOWN_DELAY)
self.ec.send_command("hibernate 1000")
time.sleep(self.WAKE_DELAY)
diff --git a/server/site_tests/firmware_ECWatchdog/firmware_ECWatchdog.py b/server/site_tests/firmware_ECWatchdog/firmware_ECWatchdog.py
index 31eec34..29b1e1f 100644
--- a/server/site_tests/firmware_ECWatchdog/firmware_ECWatchdog.py
+++ b/server/site_tests/firmware_ECWatchdog/firmware_ECWatchdog.py
@@ -30,7 +30,7 @@
"""
Trigger a watchdog reset.
"""
- self.faft_client.run_shell_command("sync")
+ self.faft_client.system.run_shell_command("sync")
self.ec.send_command("waitms %d" % self.WATCHDOG_DELAY)
time.sleep((self.WATCHDOG_DELAY + self.EC_BOOT_DELAY) / 1000.0)
self.check_lid_and_power_on()
diff --git a/server/site_tests/firmware_ECWriteProtect/firmware_ECWriteProtect.py b/server/site_tests/firmware_ECWriteProtect/firmware_ECWriteProtect.py
index c0eafae..967002c 100644
--- a/server/site_tests/firmware_ECWriteProtect/firmware_ECWriteProtect.py
+++ b/server/site_tests/firmware_ECWriteProtect/firmware_ECWriteProtect.py
@@ -45,7 +45,7 @@
def run_once(self):
- flags = self.faft_client.get_firmware_flags('a')
+ flags = self.faft_client.bios.get_preamble_flags('a')
if flags & vboot.PREAMBLE_USE_RO_NORMAL == 0:
logging.info('The firmware USE_RO_NORMAL flag is disabled.')
return
@@ -59,7 +59,7 @@
# and reboot EC.
'state_checker': [(self.checkers.ro_normal_checker, 'A'),
self.write_protect_checker],
- 'userspace_action': (self.faft_client.set_firmware_flags,
+ 'userspace_action': (self.faft_client.bios.set_preamble_flags,
('a', 0)),
'reboot_action': self.sync_and_cold_reboot,
},
@@ -75,7 +75,7 @@
'state_checker': [(self.checkers.ro_normal_checker,
('A', True)),
self.write_protect_checker],
- 'userspace_action': (self.faft_client.set_firmware_flags,
+ 'userspace_action': (self.faft_client.bios.set_preamble_flags,
('a', vboot.PREAMBLE_USE_RO_NORMAL)),
'reboot_action': (self.set_ec_write_protect_and_reboot, False),
},
diff --git a/server/site_tests/firmware_FAFTSetup/firmware_FAFTSetup.py b/server/site_tests/firmware_FAFTSetup/firmware_FAFTSetup.py
index 30d1537..6b2d64e 100644
--- a/server/site_tests/firmware_FAFTSetup/firmware_FAFTSetup.py
+++ b/server/site_tests/firmware_FAFTSetup/firmware_FAFTSetup.py
@@ -134,12 +134,12 @@
expected_output: Expected output from "showkey".
"""
# Stop UI so that key presses don't go to X.
- self.faft_client.run_shell_command("stop ui")
+ self.faft_client.system.run_shell_command("stop ui")
# Press the keys
Timer(self.KEY_PRESS_DELAY, press_action).start()
- lines = self.faft_client.run_shell_command_get_output("showkey")
+ lines = self.faft_client.system.run_shell_command_get_output("showkey")
# Turn UI back on
- self.faft_client.run_shell_command("start ui")
+ self.faft_client.system.run_shell_command("start ui")
# We may be getting multiple key-press or key-release.
# Let's remove duplicated items.
diff --git a/server/site_tests/firmware_FwScreenCloseLid/firmware_FwScreenCloseLid.py b/server/site_tests/firmware_FwScreenCloseLid/firmware_FwScreenCloseLid.py
index 4b2cf88..5e10e49 100644
--- a/server/site_tests/firmware_FwScreenCloseLid/firmware_FwScreenCloseLid.py
+++ b/server/site_tests/firmware_FwScreenCloseLid/firmware_FwScreenCloseLid.py
@@ -97,7 +97,8 @@
'devsw_boot': '1',
'mainfw_type': 'developer',
}),
- 'userspace_action': self.faft_client.request_recovery_boot,
+ 'userspace_action':
+ (self.faft_client.system.request_recovery_boot),
'firmware_action': (self.run_shutdown_process,
(self.wait_longer_fw_screen_and_close_lid,
self.servo.lid_open,
@@ -110,7 +111,8 @@
'devsw_boot': '1',
'mainfw_type': 'developer',
}),
- 'userspace_action': self.faft_client.request_recovery_boot,
+ 'userspace_action': (
+ self.faft_client.system.request_recovery_boot),
'firmware_action': (self.run_shutdown_process,
(self.wait_yuck_screen_and_close_lid,
self.servo.lid_open,
@@ -131,7 +133,8 @@
'devsw_boot': '0',
'mainfw_type': 'normal',
}),
- 'userspace_action': self.faft_client.request_recovery_boot,
+ 'userspace_action':
+ (self.faft_client.system.request_recovery_boot),
'firmware_action': (self.run_shutdown_process,
(self.wait_longer_fw_screen_and_close_lid,
self.servo.lid_open,
diff --git a/server/site_tests/firmware_FwScreenPressPower/firmware_FwScreenPressPower.py b/server/site_tests/firmware_FwScreenPressPower/firmware_FwScreenPressPower.py
index e136fe8..36299ec 100644
--- a/server/site_tests/firmware_FwScreenPressPower/firmware_FwScreenPressPower.py
+++ b/server/site_tests/firmware_FwScreenPressPower/firmware_FwScreenPressPower.py
@@ -86,7 +86,8 @@
'devsw_boot': '1',
'mainfw_type': 'developer',
}),
- 'userspace_action': self.faft_client.request_recovery_boot,
+ 'userspace_action':
+ (self.faft_client.system.request_recovery_boot),
'firmware_action': (self.run_shutdown_process,
(self.wait_longer_fw_screen_and_press_power,
None,
@@ -99,7 +100,8 @@
'devsw_boot': '1',
'mainfw_type': 'developer',
}),
- 'userspace_action': self.faft_client.request_recovery_boot,
+ 'userspace_action':
+ (self.faft_client.system.request_recovery_boot),
'firmware_action': (self.run_shutdown_process,
(self.wait_yuck_screen_and_press_power,
None,
@@ -120,7 +122,8 @@
'devsw_boot': '0',
'mainfw_type': 'normal',
}),
- 'userspace_action': self.faft_client.request_recovery_boot,
+ 'userspace_action':
+ (self.faft_client.system.request_recovery_boot),
'firmware_action': (self.run_shutdown_process,
(self.wait_longer_fw_screen_and_press_power,
None,
diff --git a/server/site_tests/firmware_InvalidUSB/firmware_InvalidUSB.py b/server/site_tests/firmware_InvalidUSB/firmware_InvalidUSB.py
index 9923b5e..4ca62c6 100644
--- a/server/site_tests/firmware_InvalidUSB/firmware_InvalidUSB.py
+++ b/server/site_tests/firmware_InvalidUSB/firmware_InvalidUSB.py
@@ -69,7 +69,8 @@
'devsw_boot': '0',
'mainfw_type': 'normal',
}),
- 'userspace_action': self.faft_client.request_recovery_boot,
+ 'userspace_action':
+ (self.faft_client.system.request_recovery_boot),
'firmware_action': self.insert_corrupted_usb_and_restore,
'install_deps_after_boot': True,
},
diff --git a/server/site_tests/firmware_RONormalBoot/firmware_RONormalBoot.py b/server/site_tests/firmware_RONormalBoot/firmware_RONormalBoot.py
index 04760e6..efb7948 100644
--- a/server/site_tests/firmware_RONormalBoot/firmware_RONormalBoot.py
+++ b/server/site_tests/firmware_RONormalBoot/firmware_RONormalBoot.py
@@ -36,7 +36,7 @@
def run_once(self):
- flags = self.faft_client.get_firmware_flags('a')
+ flags = self.faft_client.bios.get_preamble_flags('a')
if flags & vboot.PREAMBLE_USE_RO_NORMAL == 0:
logging.info('The firmware USE_RO_NORMAL flag is disabled.')
return
@@ -44,13 +44,14 @@
self.register_faft_sequence((
{ # Step 1, disable the RO normal boot flag
'state_checker': (self.checkers.ro_normal_checker, 'A'),
- 'userspace_action': (self.faft_client.set_firmware_flags, ('a',
- flags ^ vboot.PREAMBLE_USE_RO_NORMAL)),
+ 'userspace_action': (self.faft_client.bios.set_preamble_flags,
+ ('a',
+ flags ^ vboot.PREAMBLE_USE_RO_NORMAL)),
},
{ # Step 2, expected TwoStop boot, restore the original flags
'state_checker': (lambda: self.checkers.ro_normal_checker('A',
twostop=True)),
- 'userspace_action': (self.faft_client.set_firmware_flags,
+ 'userspace_action': (self.faft_client.bios.set_preamble_flags,
('a', flags)),
},
{ # Step 3, done
diff --git a/server/site_tests/firmware_RecoveryButton/firmware_RecoveryButton.py b/server/site_tests/firmware_RecoveryButton/firmware_RecoveryButton.py
index 10c1448..b0b685d 100644
--- a/server/site_tests/firmware_RecoveryButton/firmware_RecoveryButton.py
+++ b/server/site_tests/firmware_RecoveryButton/firmware_RecoveryButton.py
@@ -44,7 +44,7 @@
def run_once(self, dev_mode=False):
# The old models need users to remove and insert USB stick during boot.
- remove_usb = (self.faft_client.get_platform_name() in
+ remove_usb = (self.faft_client.system.get_platform_name() in
('Mario', 'Alex', 'ZGB', 'Aebl', 'Kaen'))
self.register_faft_sequence((
{ # Step 1, switch to recovery mode and reboot
diff --git a/server/site_tests/firmware_RollbackFirmware/firmware_RollbackFirmware.py b/server/site_tests/firmware_RollbackFirmware/firmware_RollbackFirmware.py
index fbe36e2..6ef73b3 100644
--- a/server/site_tests/firmware_RollbackFirmware/firmware_RollbackFirmware.py
+++ b/server/site_tests/firmware_RollbackFirmware/firmware_RollbackFirmware.py
@@ -32,7 +32,8 @@
def run_once(self, dev_mode=False):
# Recovery reason RW_FW_ROLLBACK available after Alex/ZGB.
- if self.faft_client.get_platform_name() in ('Mario', 'Alex', 'ZGB'):
+ if self.faft_client.system.get_platform_name() in (
+ 'Mario', 'Alex', 'ZGB'):
recovery_reason = vboot.RECOVERY_REASON['RO_INVALID_RW']
else:
recovery_reason = vboot.RECOVERY_REASON['RW_FW_ROLLBACK']
@@ -44,8 +45,8 @@
'mainfw_type': 'developer' if dev_mode else 'normal',
'tried_fwb': '0',
}),
- 'userspace_action': (self.faft_client.move_firmware_backward,
- 'a'),
+ 'userspace_action':
+ (self.faft_client.bios.move_version_backward, 'a'),
},
{ # Step 2, expected firmware B boot and rollbacks firmware B.
'state_checker': (self.checkers.crossystem_checker, {
@@ -53,8 +54,8 @@
'mainfw_type': ('normal', 'developer'),
'tried_fwb': '0',
}),
- 'userspace_action': (self.faft_client.move_firmware_backward,
- 'b'),
+ 'userspace_action':
+ (self.faft_client.bios.move_version_backward, 'b'),
'firmware_action': None if dev_mode else
self.wait_fw_screen_and_plug_usb,
'install_deps_after_boot': True,
@@ -64,8 +65,9 @@
'mainfw_type': 'recovery',
'recovery_reason' : recovery_reason,
}),
- 'userspace_action': (self.faft_client.move_firmware_forward,
- (('a', 'b'),)),
+ 'userspace_action': (
+ self.faft_client.bios.move_version_forward,
+ (('a', 'b'),)),
},
{ # Step 4, expected firmware A boot and done.
'state_checker': (self.checkers.crossystem_checker, {
diff --git a/server/site_tests/firmware_RollbackKernel/firmware_RollbackKernel.py b/server/site_tests/firmware_RollbackKernel/firmware_RollbackKernel.py
index 2635338..647afbb 100644
--- a/server/site_tests/firmware_RollbackKernel/firmware_RollbackKernel.py
+++ b/server/site_tests/firmware_RollbackKernel/firmware_RollbackKernel.py
@@ -31,7 +31,7 @@
if not self.check_root_part_on_non_recovery(part):
logging.info('Recover the disk OS by running chromeos-install...')
self.run_faft_step({
- 'userspace_action': (self.faft_client.run_shell_command,
+ 'userspace_action': (self.faft_client.system.run_shell_command,
'chromeos-install --yes')
})
@@ -50,7 +50,8 @@
def run_once(self, dev_mode=False):
# Historical reason that the old models use a different value.
- if self.faft_client.get_platform_name() in ('Mario', 'Alex', 'ZGB'):
+ if self.faft_client.system.get_platform_name() in (
+ 'Mario', 'Alex', 'ZGB'):
recovery_reason = vboot.RECOVERY_REASON['RW_NO_OS']
else:
# TODO(waihong): Should be RW_INVALID_OS but the current vboot
@@ -63,14 +64,16 @@
'state_checker':
(self.check_root_part_on_non_recovery, 'a'),
'userspace_action':
- (self.faft_client.move_kernel_backward, 'a'),
+ (self.faft_client.kernel.move_version_backward,
+ 'a'),
},
{ # Step 2, still kernel A boot since dev_mode ignores
# kernel rollback check.
'state_checker':
(self.check_root_part_on_non_recovery, 'a'),
'userspace_action':
- (self.faft_client.move_kernel_forward, 'a'),
+ (self.faft_client.kernel.move_version_forward,
+ 'a'),
},
)
else:
@@ -79,13 +82,15 @@
'state_checker':
(self.check_root_part_on_non_recovery, 'a'),
'userspace_action':
- (self.faft_client.move_kernel_backward, 'a'),
+ (self.faft_client.kernel.move_version_backward,
+ 'a'),
},
{ # Step 2, expected kernel B boot and rollbacks kernel B.
'state_checker':
(self.check_root_part_on_non_recovery, 'b'),
'userspace_action':
- (self.faft_client.move_kernel_backward, 'b'),
+ (self.faft_client.kernel.move_version_backward,
+ 'b'),
'firmware_action': self.wait_fw_screen_and_plug_usb,
'install_deps_after_boot': True,
},
@@ -94,8 +99,9 @@
'mainfw_type': 'recovery',
'recovery_reason' : recovery_reason,
}),
- 'userspace_action': (self.faft_client.move_kernel_forward,
- (('a', 'b'),)),
+ 'userspace_action': (
+ self.faft_client.kernel.move_version_forward,
+ (('a', 'b'),)),
},
{ # Step 4, expected kernel A boot and done.
'state_checker':
diff --git a/server/site_tests/firmware_ShellBall/firmware_ShellBall.py b/server/site_tests/firmware_ShellBall/firmware_ShellBall.py
index a2bc611..e96af08 100644
--- a/server/site_tests/firmware_ShellBall/firmware_ShellBall.py
+++ b/server/site_tests/firmware_ShellBall/firmware_ShellBall.py
@@ -18,7 +18,7 @@
_shellball_name = None
def update_firmware(self, mode):
- self.faft_client.run_shell_command('%s --mode %s' %
+ self.faft_client.system.run_shell_command('%s --mode %s' %
(self._shellball_name, mode))
# Enalbe dev mode if the mode is todev.
if mode == 'todev':
@@ -28,8 +28,8 @@
self.servo.disable_development_mode()
def install_original_firmware(self):
- self.faft_client.run_shell_command('sudo chromeos-firmwareupdate' \
- ' --mode=factory_install')
+ self.faft_client.system.run_shell_command(
+ 'sudo chromeos-firmwareupdate --mode=factory_install')
self.invalidate_firmware_setup()
def setup(self, host=None, shellball_path=None, shellball_name=None):
@@ -37,18 +37,20 @@
self._shellball_name = "/home/chronos/%s" % self._shellball_name
host.send_file("%s/%s" %(shellball_path, shellball_name),
self._shellball_name)
- self.faft_client.run_shell_command('chmod +x %s' %
+ self.faft_client.system.run_shell_command('chmod +x %s' %
self._shellball_name)
self.setup_dev_mode(dev_mode=False)
# Get crossystem fwid.
- [self._current_fwid] = self.faft_client.run_shell_command_get_output(
- 'crossystem fwid')
+ [self._current_fwid] = (
+ self.faft_client.system.run_shell_command_get_output(
+ 'crossystem fwid'))
# Get BIOS version from shellball.
- [self._shellball_fwid] = self.faft_client.run_shell_command_get_output(
- '%s -V | grep "BIOS version"' \
- ' | sed "s/BIOS version: ' \
- '\(.*\)/\\1/" '
- % self._shellball_name)
+ [self._shellball_fwid] = self.faft_client. \
+ system.run_shell_command_get_output(
+ '%s -V | grep "BIOS version"' \
+ ' | sed "s/BIOS version: ' \
+ '\(.*\)/\\1/" '
+ % self._shellball_name)
def cleanup(self):
if os.path.exists(self._shellball_name):
diff --git a/server/site_tests/firmware_SoftwareSync/firmware_SoftwareSync.py b/server/site_tests/firmware_SoftwareSync/firmware_SoftwareSync.py
index 351a939..1b6ce2f 100644
--- a/server/site_tests/firmware_SoftwareSync/firmware_SoftwareSync.py
+++ b/server/site_tests/firmware_SoftwareSync/firmware_SoftwareSync.py
@@ -17,11 +17,11 @@
def ensure_rw(self):
"""Ensure firmware A is not in RO-normal mode."""
- flags = self.faft_client.get_firmware_flags('a')
+ flags = self.faft_client.bios.get_preamble_flags('a')
if flags & vboot.PREAMBLE_USE_RO_NORMAL:
flags = flags ^ vboot.PREAMBLE_USE_RO_NORMAL
self.run_faft_step({
- 'userspace_action': (self.faft_client.set_firmware_flags,
+ 'userspace_action': (self.faft_client.bios.set_preamble_flags,
('a', flags))
})
@@ -40,13 +40,13 @@
def record_hash_and_corrupt(self):
- self._ec_hash = self.faft_client.get_EC_firmware_sha()
+ self._ec_hash = self.faft_client.ec.get_firmware_sha()
logging.info("Stored EC hash: %s", self._ec_hash)
- self.faft_client.corrupt_EC_body('rw')
+ self.faft_client.ec.corrupt_body('rw')
def software_sync_checker(self):
- ec_hash = self.faft_client.get_EC_firmware_sha()
+ ec_hash = self.faft_client.ec.get_firmware_sha()
logging.info("Current EC hash: %s", self._ec_hash)
if self._ec_hash != ec_hash:
return False
diff --git a/server/site_tests/firmware_TryFwB/firmware_TryFwB.py b/server/site_tests/firmware_TryFwB/firmware_TryFwB.py
index 344bde7..c444027 100644
--- a/server/site_tests/firmware_TryFwB/firmware_TryFwB.py
+++ b/server/site_tests/firmware_TryFwB/firmware_TryFwB.py
@@ -31,7 +31,7 @@
'mainfw_act': 'A',
'tried_fwb': '0',
}),
- 'userspace_action': self.faft_client.set_try_fw_b,
+ 'userspace_action': self.faft_client.system.set_try_fw_b,
},
{ # Step 2, expected firmware B boot, reboot
'state_checker': (self.checkers.crossystem_checker, {
diff --git a/server/site_tests/firmware_UpdateECBin/firmware_UpdateECBin.py b/server/site_tests/firmware_UpdateECBin/firmware_UpdateECBin.py
index acf4a68..ce5a3e2 100644
--- a/server/site_tests/firmware_UpdateECBin/firmware_UpdateECBin.py
+++ b/server/site_tests/firmware_UpdateECBin/firmware_UpdateECBin.py
@@ -54,11 +54,11 @@
self.setup_dev_mode(dev_mode)
self.setup_usbkey(usbkey=False)
- temp_path = self.faft_client.get_updater_temp_path()
- self.faft_client.setup_updater()
+ temp_path = self.faft_client.updater.get_temp_path()
+ self.faft_client.updater.setup()
self.old_bios_path = os.path.join(temp_path, 'old_bios.bin')
- self.faft_client.dump_firmware(self.old_bios_path)
+ self.faft_client.bios.dump_whole(self.old_bios_path)
self.new_ec_path = os.path.join(temp_path, 'new_ec.bin')
host.send_file(self.arg_new_ec, self.new_ec_path)
@@ -66,34 +66,34 @@
def cleanup(self):
self.restore_firmware()
- self.faft_client.cleanup_updater()
+ self.faft_client.updater.cleanup()
super(firmware_UpdateECBin, self).cleanup()
def do_ronormal_update(self):
- self.faft_client.setup_EC_image(self.new_ec_path)
- self.new_ec_sha = self.faft_client.get_EC_image_sha()
- self.faft_client.update_EC_from_image('a', 0)
+ self.faft_client.bios.setup_EC_image(self.new_ec_path)
+ self.new_ec_sha = self.faft_client.bios.get_EC_image_sha()
+ self.faft_client.bios.update_EC_from_image('a', 0)
def do_twostop_update(self):
# We update the original BIOS image back. This BIOS image contains
# the original EC binary. But set RW boot. So it is a TWOSTOP ->
# TWOSTOP update.
- self.faft_client.write_firmware(self.old_bios_path)
- self.faft_client.set_firmware_flags('a', 0)
+ self.faft_client.bios.write_whole(self.old_bios_path)
+ self.faft_client.bios.set_preamble_flags('a', 0)
def new_ec_checker(self):
return (self.checkers.ro_normal_checker('A', twostop=True) and
- (self.faft_client.get_EC_firmware_sha() == self.new_ec_sha))
+ (self.faft_client.bios.get_EC_firmware_sha() == self.new_ec_sha))
def run_once(self):
if not self.check_ec_capability():
return
- flags = self.faft_client.get_firmware_flags('a')
+ flags = self.faft_client.bios.get_preamble_flags('a')
if flags & vboot.PREAMBLE_USE_RO_NORMAL == 0:
logging.info('The firmware USE_RO_NORMAL flag is disabled.')
return
@@ -116,7 +116,7 @@
},
{ # Step 3, expected different EC and RW boot, enable RO flag
'state_checker': self.new_ec_checker,
- 'userspace_action': (self.faft_client.set_firmware_flags,
+ 'userspace_action': (self.faft_client.bios.set_preamble_flags,
('a', flags)),
'reboot_action': self.sync_and_warm_reboot,
},
diff --git a/server/site_tests/firmware_UpdateFirmwareDataKeyVersion/firmware_UpdateFirmwareDataKeyVersion.py b/server/site_tests/firmware_UpdateFirmwareDataKeyVersion/firmware_UpdateFirmwareDataKeyVersion.py
index 14375c5..06b83e3 100644
--- a/server/site_tests/firmware_UpdateFirmwareDataKeyVersion/firmware_UpdateFirmwareDataKeyVersion.py
+++ b/server/site_tests/firmware_UpdateFirmwareDataKeyVersion/firmware_UpdateFirmwareDataKeyVersion.py
@@ -24,24 +24,24 @@
host.send_file(os.path.join(
'~/trunk/src/platform/vboot_reference/scripts',
'keygeneration/common.sh'),
- os.path.join(self.faft_client.get_updater_temp_path(),
+ os.path.join(self.faft_client.updater.get_temp_path(),
'common.sh'))
host.send_file(os.path.join('~/trunk/src/third_party/autotest/files/',
'server/site_tests',
'firmware_UpdateFirmwareDataKeyVersion',
'files/make_keys.sh'),
- os.path.join(self.faft_client.get_updater_temp_path(),
+ os.path.join(self.faft_client.updater.get_temp_path(),
'make_keys.sh'))
- self.faft_client.run_shell_command('/bin/bash %s %s' % (
- os.path.join(self.faft_client.get_updater_temp_path(),
+ self.faft_client.system.run_shell_command('/bin/bash %s %s' % (
+ os.path.join(self.faft_client.updater.get_temp_path(),
'make_keys.sh'),
self._update_version))
def check_firmware_datakey_version(self, expected_ver):
- actual_ver = self.faft_client.get_firmware_datakey_version('a')
- actual_tpm_fwver = self.faft_client.get_tpm_firmware_datakey_version()
+ actual_ver = self.faft_client.bios.get_datakey_version('a')
+ actual_tpm_fwver = self.faft_client.tpm.get_firmware_datakey_version()
if actual_ver != expected_ver or actual_tpm_fwver != expected_ver:
raise error.TestFail(
'Firmware data key version should be %s,'
@@ -54,7 +54,7 @@
def check_version_and_run_recovery(self):
self.check_firmware_datakey_version(self._update_version)
- self.faft_client.run_recovery()
+ self.faft_client.updater.run_recovery()
def initialize(self, host, cmdline_args, use_pyauto=False, use_faft=True):
@@ -67,12 +67,12 @@
def setup(self, host=None):
self.backup_firmware()
updater_path = self.setup_firmwareupdate_shellball(self.use_shellball)
- self.faft_client.setup_updater(updater_path)
+ self.faft_client.updater.setup(updater_path)
# Update firmware if needed
if updater_path:
self.set_hardware_write_protect(enable=False)
- self.faft_client.run_factory_install()
+ self.faft_client.updater.run_factory_install()
self.sync_and_warm_reboot()
self.wait_for_client_offline()
self.wait_for_client()
@@ -80,21 +80,21 @@
super(firmware_UpdateFirmwareDataKeyVersion, self).setup()
self.setup_usbkey(usbkey=True, host=True, install_shim=True)
self.setup_dev_mode(dev_mode=False)
- self._fwid = self.faft_client.retrieve_updater_fwid()
+ self._fwid = self.faft_client.updater.get_fwid()
- actual_ver = self.faft_client.get_firmware_datakey_version('a')
+ actual_ver = self.faft_client.bios.get_datakey_version('a')
logging.info('Origin version is %s', actual_ver)
self._update_version = actual_ver + 1
logging.info('Firmware version will update to version %s',
self._update_version)
self.resign_datakey_version(host)
- self.faft_client.resign_updater_firmware(1)
- self.faft_client.repack_updater_shellball('test')
+ self.faft_client.updater.resign_firmware(1)
+ self.faft_client.updater.repack_shellball('test')
def cleanup(self):
- self.faft_client.cleanup_updater()
+ self.faft_client.updater.cleanup()
self.restore_firmware()
self.invalidate_firmware_setup()
super(firmware_UpdateFirmwareDataKeyVersion, self).cleanup()
@@ -110,7 +110,7 @@
'fwid': self._fwid
}),
'userspace_action': (
- self.faft_client.run_autoupdate,
+ self.faft_client.updater.run_autoupdate,
'test'
)
},
@@ -119,7 +119,7 @@
'mainfw_act': 'B',
'tried_fwb': '1'
}),
- 'userspace_action': (self.faft_client.run_bootok,
+ 'userspace_action': (self.faft_client.updater.run_bootok,
'test')
},
{ # Step3, Check firmware and TPM version, then recovery.
diff --git a/server/site_tests/firmware_UpdateFirmwareVersion/firmware_UpdateFirmwareVersion.py b/server/site_tests/firmware_UpdateFirmwareVersion/firmware_UpdateFirmwareVersion.py
index 1cdfa96..d08ad29 100644
--- a/server/site_tests/firmware_UpdateFirmwareVersion/firmware_UpdateFirmwareVersion.py
+++ b/server/site_tests/firmware_UpdateFirmwareVersion/firmware_UpdateFirmwareVersion.py
@@ -24,8 +24,8 @@
version = 1
def check_firmware_version(self, expected_ver):
- actual_ver = self.faft_client.get_firmware_version('a')
- actual_tpm_fwver = self.faft_client.get_tpm_firmware_version()
+ actual_ver = self.faft_client.bios.get_version('a')
+ actual_tpm_fwver = self.faft_client.tpm.get_firmware_version()
if actual_ver != expected_ver or actual_tpm_fwver != expected_ver:
raise error.TestFail(
'Firmware version should be %s,'
@@ -39,7 +39,7 @@
def check_version_and_run_recovery(self):
self.check_firmware_version(self._update_version)
- self.faft_client.run_recovery()
+ self.faft_client.updater.run_recovery()
def initialize(self, host, cmdline_args, use_pyauto=False, use_faft=True):
@@ -51,12 +51,12 @@
def setup(self):
self.backup_firmware()
updater_path = self.setup_firmwareupdate_shellball(self.use_shellball)
- self.faft_client.setup_updater(updater_path)
+ self.faft_client.updater.setup(updater_path)
# Update firmware if needed
if updater_path:
self.set_hardware_write_protect(enable=False)
- self.faft_client.run_factory_install()
+ self.faft_client.updater.run_factory_install()
self.sync_and_warm_reboot()
self.wait_for_client_offline()
self.wait_for_client()
@@ -64,19 +64,19 @@
super(firmware_UpdateFirmwareVersion, self).setup()
self.setup_usbkey(usbkey=True, host=True, install_shim=True)
self.setup_dev_mode(dev_mode=False)
- self._fwid = self.faft_client.retrieve_updater_fwid()
+ self._fwid = self.faft_client.updater.get_fwid()
- actual_ver = self.faft_client.get_firmware_version('a')
+ actual_ver = self.faft_client.bios.get_version('a')
logging.info('Origin version is %s', actual_ver)
self._update_version = actual_ver + 1
logging.info('Firmware version will update to version %s',
self._update_version)
- self.faft_client.resign_updater_firmware(self._update_version)
- self.faft_client.repack_updater_shellball('test')
+ self.faft_client.updater.resign_firmware(self._update_version)
+ self.faft_client.updater.repack_shellball('test')
def cleanup(self):
- self.faft_client.cleanup_updater()
+ self.faft_client.updater.cleanup()
self.restore_firmware()
self.invalidate_firmware_setup()
super(firmware_UpdateFirmwareVersion, self).cleanup()
@@ -92,7 +92,7 @@
'fwid': self._fwid
}),
'userspace_action': (
- self.faft_client.run_autoupdate,
+ self.faft_client.updater.run_autoupdate,
'test'
)
},
@@ -101,7 +101,7 @@
'mainfw_act': 'B',
'tried_fwb': '1'
}),
- 'userspace_action': (self.faft_client.run_bootok,
+ 'userspace_action': (self.faft_client.updater.run_bootok,
'test')
},
{ # Step3, Check firmware and TPM version, then recovery.
diff --git a/server/site_tests/firmware_UpdateKernelDataKeyVersion/firmware_UpdateKernelDataKeyVersion.py b/server/site_tests/firmware_UpdateKernelDataKeyVersion/firmware_UpdateKernelDataKeyVersion.py
index 9805c84..3486217 100644
--- a/server/site_tests/firmware_UpdateKernelDataKeyVersion/firmware_UpdateKernelDataKeyVersion.py
+++ b/server/site_tests/firmware_UpdateKernelDataKeyVersion/firmware_UpdateKernelDataKeyVersion.py
@@ -19,7 +19,7 @@
version = 1
def check_kernel_datakey_version(self, expected_ver):
- actual_ver = self.faft_client.retrieve_kernel_datakey_version('b')
+ actual_ver = self.faft_client.kernel.get_datakey_version('b')
if actual_ver != expected_ver:
raise error.TestFail(
'Kernel Version should be %s, but got %s.'
@@ -34,28 +34,28 @@
host.send_file(os.path.join(
'~/trunk/src/platform/vboot_reference/scripts',
'keygeneration/common.sh'),
- os.path.join(self.faft_client.get_updater_temp_path(),
+ os.path.join(self.faft_client.updater.get_temp_path(),
'common.sh'))
host.send_file(os.path.join('~/trunk/src/third_party/autotest/files/',
'server/site_tests',
'firmware_UpdateKernelDataKeyVersion',
'files/make_keys.sh'),
- os.path.join(self.faft_client.get_updater_temp_path(),
+ os.path.join(self.faft_client.updater.get_temp_path(),
'make_keys.sh'))
- self.faft_client.run_shell_command('/bin/bash %s %s' % (
- os.path.join(self.faft_client.get_updater_temp_path(),
+ self.faft_client.system.run_shell_command('/bin/bash %s %s' % (
+ os.path.join(self.faft_client.updater.get_temp_path(),
'make_keys.sh'),
self._update_version))
def modify_kernel_b_and_set_cgpt_priority(self, delta, target_dev):
if delta == 1:
- self.faft_client.resign_kernel_with_keys(
- 'b', self.faft_client.get_updater_keys_path())
+ self.faft_client.kernel.resign_with_keys(
+ 'b', self.faft_client.updater.get_keys_path())
elif delta == -1:
self.check_kernel_datakey_version(self._update_version)
- self.faft_client.resign_kernel_with_keys('b')
+ self.faft_client.kernel.resign_with_keys('b')
if target_dev == 'a':
self.reset_and_prioritize_kernel('a')
@@ -68,19 +68,19 @@
self.setup_dev_mode(dev_mode)
- actual_ver = self.faft_client.retrieve_kernel_datakey_version('b')
+ actual_ver = self.faft_client.kernel.get_datakey_version('b')
logging.info('Original Kernel Version of KERN-B is %s', actual_ver)
self._update_version = actual_ver + 1
logging.info('KERN-B will update to version %s', self._update_version)
self.setup_kernel('a')
- self.faft_client.setup_updater()
+ self.faft_client.updater.setup()
self.resign_kernel_datakey_version(host)
def cleanup(self):
- self.faft_client.cleanup_updater()
+ self.faft_client.updater.cleanup()
super(firmware_UpdateKernelDataKeyVersion, self).cleanup()
diff --git a/server/site_tests/firmware_UpdateKernelSubkeyVersion/firmware_UpdateKernelSubkeyVersion.py b/server/site_tests/firmware_UpdateKernelSubkeyVersion/firmware_UpdateKernelSubkeyVersion.py
index 4cbbe29..06c6651 100644
--- a/server/site_tests/firmware_UpdateKernelSubkeyVersion/firmware_UpdateKernelSubkeyVersion.py
+++ b/server/site_tests/firmware_UpdateKernelSubkeyVersion/firmware_UpdateKernelSubkeyVersion.py
@@ -21,23 +21,23 @@
host.send_file(os.path.join(
'~/trunk/src/platform/vboot_reference/scripts',
'keygeneration/common.sh'),
- os.path.join(self.faft_client.get_updater_temp_path(),
+ os.path.join(self.faft_client.updater.get_temp_path(),
'common.sh'))
host.send_file(os.path.join(
'~/trunk/src/third_party/autotest/files/server',
'site_tests/firmware_UpdateKernelSubkeyVersion',
'files/make_keys.sh'),
- os.path.join(self.faft_client.get_updater_temp_path(),
+ os.path.join(self.faft_client.updater.get_temp_path(),
'make_keys.sh'))
- self.faft_client.run_shell_command('/bin/bash %s %s' % (
- os.path.join(self.faft_client.get_updater_temp_path(),
+ self.faft_client.system.run_shell_command('/bin/bash %s %s' % (
+ os.path.join(self.faft_client.updater.get_temp_path(),
'make_keys.sh'),
self._update_version))
def check_kernel_subkey_version(self, expected_ver):
- actual_ver = self.faft_client.retrieve_kernel_subkey_version('a')
+ actual_ver = self.faft_client.bios.get_kernel_subkey_version('a')
if actual_ver != expected_ver:
raise error.TestFail(
'Kernel subkey version should be %s, but got %s.' %
@@ -49,9 +49,9 @@
def run_bootok_and_recovery(self):
- self.faft_client.run_bootok('test')
+ self.faft_client.updater.run_bootok('test')
self.check_kernel_subkey_version(self._update_version)
- self.faft_client.run_recovery()
+ self.faft_client.updater.run_recovery()
def initialize(self, host, cmdline_args, use_pyauto=False, use_faft=True):
@@ -64,32 +64,32 @@
def setup(self, host=None):
self.backup_firmware()
updater_path = self.setup_firmwareupdate_shellball(self.use_shellball)
- self.faft_client.setup_updater(updater_path)
+ self.faft_client.updater.setup(updater_path)
# Update firmware if needed
if updater_path:
self.set_hardware_write_protect(enable=False)
- self.faft_client.run_factory_install()
+ self.faft_client.updater.run_factory_install()
self.sync_and_warm_reboot()
self.wait_for_client_offline()
self.wait_for_client()
super(firmware_UpdateKernelSubkeyVersion, self).setup()
- self._fwid = self.faft_client.retrieve_updater_fwid()
+ self._fwid = self.faft_client.updater.get_fwid()
- ver = self.faft_client.retrieve_kernel_subkey_version('a')
+ ver = self.faft_client.bios.get_kernel_subkey_version('a')
logging.info('Origin version is %s', ver)
self._update_version = ver + 1
logging.info('Kernel subkey version will update to version %s',
self._update_version)
self.resign_kernel_subkey_version(host)
- self.faft_client.resign_updater_firmware(1)
- self.faft_client.repack_updater_shellball('test')
+ self.faft_client.updater.resign_firmware(1)
+ self.faft_client.updater.repack_shellball('test')
def cleanup(self):
- self.faft_client.cleanup_updater()
+ self.faft_client.updater.cleanup()
self.restore_firmware()
self.invalidate_firmware_setup()
super(firmware_UpdateKernelSubkeyVersion, self).cleanup()
@@ -104,7 +104,7 @@
'fwid': self._fwid
}),
'userspace_action': (
- self.faft_client.run_autoupdate,
+ self.faft_client.updater.run_autoupdate,
'test'
),
},
diff --git a/server/site_tests/firmware_UpdateKernelVersion/firmware_UpdateKernelVersion.py b/server/site_tests/firmware_UpdateKernelVersion/firmware_UpdateKernelVersion.py
index 85b2b71..a42d9a9 100644
--- a/server/site_tests/firmware_UpdateKernelVersion/firmware_UpdateKernelVersion.py
+++ b/server/site_tests/firmware_UpdateKernelVersion/firmware_UpdateKernelVersion.py
@@ -18,7 +18,7 @@
version = 1
def check_kernel_version(self, expected_ver):
- actual_ver = self.faft_client.retrieve_kernel_version('b')
+ actual_ver = self.faft_client.kernel.get_version('b')
if actual_ver != expected_ver:
raise error.TestFail(
'Kernel Version should be %s, but got %s.'
@@ -31,10 +31,10 @@
def modify_kernel_b_and_set_cgpt_priority(self, delta, target_dev):
if delta == 1:
- self.faft_client.move_kernel_forward('b')
+ self.faft_client.kernel.move_version_forward('b')
elif delta == -1:
self.check_kernel_version(self._update_version)
- self.faft_client.move_kernel_backward('b')
+ self.faft_client.kernel.move_version_backward('b')
if target_dev == 'a':
self.reset_and_prioritize_kernel('a')
@@ -47,7 +47,7 @@
self.setup_dev_mode(dev_mode)
- actual_ver = self.faft_client.retrieve_kernel_version('b')
+ actual_ver = self.faft_client.kernel.get_version('b')
logging.info('Original Kernel Version of KERN-B is %s', actual_ver)
self._update_version = actual_ver + 1
diff --git a/server/site_tests/firmware_UserRequestRecovery/firmware_UserRequestRecovery.py b/server/site_tests/firmware_UserRequestRecovery/firmware_UserRequestRecovery.py
index 4a8936f..de8141f 100644
--- a/server/site_tests/firmware_UserRequestRecovery/firmware_UserRequestRecovery.py
+++ b/server/site_tests/firmware_UserRequestRecovery/firmware_UserRequestRecovery.py
@@ -59,7 +59,8 @@
'state_checker': (self.checkers.crossystem_checker, {
'mainfw_type': 'developer' if dev_mode else 'normal',
}),
- 'userspace_action': self.faft_client.request_recovery_boot,
+ 'userspace_action':
+ (self.faft_client.system.request_recovery_boot),
'firmware_action': (self.try_dev_switching_and_plug_usb,
dev_mode),
'install_deps_after_boot': True,
@@ -69,7 +70,8 @@
'mainfw_type': 'recovery',
'recovery_reason' : vboot.RECOVERY_REASON['US_TEST'],
}),
- 'userspace_action': self.faft_client.request_recovery_boot,
+ 'userspace_action':
+ (self.faft_client.system.request_recovery_boot),
'firmware_action': None if dev_mode else
self.wait_fw_screen_and_plug_usb,
},