• Home
  • Raw
  • Download

Lines Matching +full:write +full:- +full:host

2 # Use of this source code is governed by a BSD-style license that can be
37 def initialize(self, host): argument
39 self.servo = host.servo
41 self._client = host
42 self.faft_client = RPCProxy(host)
114 def initialize(self, host, cmdline_args, ec_wp=None): argument
115 super(FirmwareTest, self).initialize(host)
120 self.power_control = host.POWER_CONTROL_RPM
127 if self.power_control not in host.POWER_CONTROL_VALID_ARGS:
128 raise error.TestError('Valid values for --args=power_control '
131 % (host.POWER_CONTROL_VALID_ARGS,
155 self.plankton = host.plankton
156 self.plankton_host = host._plankton_host
213 'servod --version').stdout.strip(),
235 This method is called when the firmware is re-flashed. It resets all
269 - halt on a firmware screen without timeout, e.g. REC_INSERT screen;
270 - corrupted firmware;
271 - corrutped OS image.
316 self.faft_client.system.run_shell_command('chromeos-install --yes')
336 self.servo.switch_usbkey('host')
370 """Assert an USB disk plugged-in on servo and a test image inside.
372 @param usb_dev: A string of USB stick path on the host, like '/dev/sdc'.
379 assert self.servo.get_usbkey_direction() == 'host'
381 self.servo.switch_usbkey('host')
389 tmpd = self.servo.system_output('mktemp -d -t usbcheck.XXXX')
390 self.servo.system('mount -o ro %s %s' % (rootfs, tmpd))
394 os.path.join(tmpd, 'etc/lsb-release'))
395 logging.debug('Dumping lsb-release on USB stick:\n%s', usb_lsb)
397 run_shell_command_get_output('cat /etc/lsb-release'))
398 logging.debug('Dumping lsb-release on DUT:\n%s', dut_lsb)
407 for cmd in ('umount -l %s' % tmpd, 'sync', 'rm -rf %s' % tmpd):
412 def setup_usbkey(self, usbkey, host=None, used_for_recovery=None): argument
416 It also muxes the USB disk to either the host or DUT by request.
420 @param host: Optional, True to mux the USB disk to host, False to mux it
424 used for recovery boot, like Ctrl-U USB boot.
428 elif host is None:
429 # USB disk is not required for the test. Better to mux it to host.
430 host = True
432 if host is True:
433 self.servo.switch_usbkey('host')
434 elif host is False:
470 """Get the path of the USB disk device plugged-in the servo on DUT.
476 cmd = 'ls -d /dev/s*[a-z]'
494 diff_set = has_usb_set - no_usb_set
509 command = 'rm -f %s' % (self.lockfile)
645 """Set hardware write protect pin.
647 @param enable: True if asserting write protect pin. Otherwise, False.
652 """Set EC write protect status and reboot to take effect.
654 The write protect state is only activated if both hardware write
655 protect pin is asserted and software write protect flag is set.
656 This method asserts/deasserts hardware write protect pin first, and
657 set corresponding EC software write protect flag.
659 If the device uses non-Chrome EC, set the software write protect via
662 If the device uses Chrome EC, a reboot is required for write protect
663 to take effect. Since the software write protect flag cannot be unset
664 if hardware write protect pin is asserted, we need to deasserted the
665 pin first if we are deactivating write protect. Similarly, a reboot
668 @param enable: True if activating EC write protect. Otherwise, False.
678 """Set Chrome EC write protect status and reboot to take effect.
680 @param enable: True if activating EC write protect. Otherwise, False.
683 # Set write protect flag and reboot to take effect.
687 # Reboot after deasserting hardware write protect pin to deactivate
688 # write protect. And then remove software write protect flag.
693 """Setup for EC write-protection.
695 It makes sure the EC in the requested write-protection state. If not, it
696 flips the state. Flipping the write-protection requires DUT reboot.
698 @param ec_wp: True to request EC write-protected; False to request EC
699 not write-protected; None to do nothing.
711 "Cannot change EC write-protect for this device")
713 logging.info('The test required EC is %swrite-protected. Reboot '
723 """Restore the original EC write-protection."""
729 logging.info('Restore original EC write protection and reboot.')
795 f.write(ast.literal_eval(self.servo.get('cpu_uart_stream')))
798 f.write(ast.literal_eval(self.servo.get('cr50_uart_stream')))
801 f.write(ast.literal_eval(self.servo.get('ec_uart_stream')))
804 f.write(ast.literal_eval(self.servo.get(
808 f.write(ast.literal_eval(self.servo.get(
813 f.write(ast.literal_eval(self.servo.get('usbpd_uart_stream')))
851 retries = retries - 1
866 cmd = '[ -e %s ] && cat %s || echo NOTFOUND' % ((self._SERVOD_LOG,) * 2)
872 self.servo_log_original_len = -1
885 if self.servo_log_original_len != -1:
889 f.write(servo_log[self.servo_log_original_len:])
896 f.write(client_log)
927 # speed-up purpose, don't restore it.
966 """Make sure firmware is in RW-boot mode.
968 If the given firmware section is in RO-boot mode, turn off the RO-boot
969 flag and reboot DUT into RW-boot mode.
1006 'cgpt add -i%s -P1 -S1 -T0 %s' % (self.KERNEL_MAP['a'], root_dev))
1008 'cgpt add -i%s -P1 -S1 -T0 %s' % (self.KERNEL_MAP['b'], root_dev))
1010 self.faft_client.system.run_shell_command('cgpt prioritize -i%s %s' %
1023 # Assumes the output format from nvme list-ns command will
1028 'nvme list-ns %s -a' % device)
1030 ns = ns.split(':')[-1]
1032 # and metadata to non-volatile media.
1034 'nvme flush %s -n %s' % (device, ns))
1038 self.faft_client.system.run_shell_command('hdparm -f %s' % device)
1050 # This function will perform a device-specific sync command.
1062 @param flags: Optional, a space-separated string of flags passed to EC
1075 self.faft_client.system.run_shell_command('chromeos-tpm-recovery')
1082 # We use a customized delay since the normal-press 1.2s is not enough.
1084 # device can take 44-51 seconds to restart,
1120 The kernel header magic is the first 8-byte of kernel partition.
1123 @param usb_dev: A string of USB stick path on the host, like '/dev/sdc'.
1142 write_cmd = ("echo -n '%s' | sudo dd of=%s oflag=sync conv=notrunc "
1147 raise error.TestError("Failed to write new magic.")
1152 @param usb_dev: A string of USB stick path on the host, like '/dev/sdc'.
1160 @param usb_dev: A string of USB stick path on the host, like '/dev/sdc'.
1258 retry -= 1
1285 logging.info("-[FAFT]-[ start stepstate_checker ]----------")
1287 logging.info("-[FAFT]-[ end state_checker ]----------------")
1328 """Backup firmware to file, and then send it to host.
1344 self._client.run('rm -rf %s' % remote_temp_dir)
1362 """Restore firmware from host in resultsdir.
1394 send it to the remote host. Otherwise, use the
1395 /usr/sbin/chromeos-firmwareupdate in the image and replace its inside
1403 "shell script") != -1)
1409 'chromeos-firmwareupdate')
1445 """Backup kernel to files, and the send them to host.
1472 """Restore kernel from host in resultsdir.
1489 self.faft_client.kernel.write(p, remote_path)