def initialize(self, host, cmdline_args):
        dict_args = utils.args_to_dict(cmdline_args)
        super(firmware_ChipFwUpdate, self).initialize(host, cmdline_args)

        self.new_bios_path = dict_args['bios'] if 'bios' in dict_args else None

        self.clear_set_gbb_flags(
            vboot.GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC
            | vboot.GBB_FLAG_DISABLE_PD_SOFTWARE_SYNC, 0)

        self.dut_bios_path = None
        self.cbfs_work_dir = None

        # set of chip types found in CBFS
        self.cbfs_chip_types = set()
        # dict of chip FW updates from the cmd line
        self.req_chip_updates = {}

        # see if comand line specified new firmware blobs
        # for chips we know about

        for chip in chip_utils.chip_id_map.itervalues():
            chip_name = chip.chip_name
            if chip_name not in dict_args:
                continue
            chip_file = dict_args[chip_name]
            if not os.path.exists(chip_file):
                raise error.TestError('file %s not found' % chip_file)
            c = chip()
            c.set_from_file(chip_file)
            if chip_name in self.req_chip_updates:
                raise error.TestError('multiple %s args' % chip_name)
            logging.info('request chip %s fw 0x%02x from command line',
                         c.chip_name, c.fw_ver)
            self.req_chip_updates[chip_name] = c
 def initialize(self, host, cmdline_args):
     super(firmware_CompareChipFwToShellBall,
           self).initialize(host, cmdline_args)
     dict_args = utils.args_to_dict(cmdline_args)
     self.new_bios_path = dict_args['bios'] if 'bios' in dict_args else None
     self.cbfs_work_dir = None
     self.dut_bios_path = None
Пример #3
0
 def initialize(self, host, cmdline_args):
     dict_args = utils.args_to_dict(cmdline_args)
     super(firmware_FWupdate, self).initialize(host, cmdline_args)
     if not set(('new_ec', 'new_bios')).issubset(set(dict_args)):
       raise error.TestError('Missing new_ec and/or new_bios argument')
     self.new_ec = dict_args['new_ec']
     self.new_bios = dict_args['new_bios']
     if not os.path.isfile(self.new_ec) or not os.path.isfile(self.new_bios):
       raise error.TestError('Failed to locate ec or bios file')
     self.new_pd = ''
     if 'new_pd' in dict_args:
       self.new_pd = dict_args['new_pd']
       if not os.path.isfile(self.new_pd):
         raise error.TestError('Failed to locate pd file')
     logging.info('EC=%s BIOS=%s PD=%s',
                  self.new_ec, self.new_bios, self.new_pd)
     self.mode = 'recovery'
     if 'mode' in dict_args:
       self.mode = dict_args['mode']
       if self.mode == 'recovery':
         self.switcher.setup_mode('normal')  # Set device to normal mode
       elif self.mode == 'factory':
         self.switcher.setup_mode('dev')   # Set device to dev mode
       else:
         raise error.TestError('Unknown mode:%s' % self.mode)
Пример #4
0
 def initialize(self, host, cmdline_args):
     # Parse arguments from command line
     dict_args = utils.args_to_dict(cmdline_args)
     self.faft_iterations = int(dict_args.get('faft_iterations', 1))
     super(firmware_ConsecutiveLidSwitch,
           self).initialize(host, cmdline_args)
     self.setup_usbkey(usbkey=False)
Пример #5
0
 def initialize(self, host, cmdline_args):
     # Parse arguments from command line
     dict_args = utils.args_to_dict(cmdline_args)
     self.faft_iterations = int(dict_args.get('faft_iterations', 1))
     super(firmware_DevModeStress, self).initialize(host, cmdline_args)
     self.switcher.setup_mode('dev')
     self.setup_usbkey(usbkey=False)
    def initialize(self, host, cmdline_args):
        # This test assume the system already have the latest RW from
        # shellball.  If you not sure, run chromeos-firmware --mode=factory.
        # Device should have WP disable.

        # Parse arguments from command line
        dict_args = utils.args_to_dict(cmdline_args)
        super(platform_Flashrom, self).initialize(host, cmdline_args)
Пример #7
0
 def initialize(self, host, cmdline_args, dev_mode=False):
     # Parse arguments from command line
     dict_args = utils.args_to_dict(cmdline_args)
     self.faft_iterations = int(dict_args.get('faft_iterations', 1))
     super(firmware_ConsecutiveBootPowerButton,
           self).initialize(host, cmdline_args)
     self.switcher.setup_mode('dev' if dev_mode else 'normal')
     self.setup_usbkey(usbkey=False)
 def initialize(self, host, cmdline_args, dev_mode):
     # Parse arguments from command line
     dict_args = utils.args_to_dict(cmdline_args)
     self.faft_iterations = int(dict_args.get('faft_iterations', 1))
     super(firmware_CgptStress, self).initialize(host, cmdline_args)
     self.backup_cgpt_attributes()
     self.switcher.setup_mode('dev' if dev_mode else 'normal')
     self.setup_usbkey(usbkey=False)
     self.setup_kernel('a')
Пример #9
0
 def initialize(self, host, cmdline_args, dev_mode=False):
     # Parse arguments from command line
     dict_args = utils.args_to_dict(cmdline_args)
     self.faft_iterations = int(dict_args.get('faft_iterations', 1))
     self.faft_waitup_time = int(dict_args.get('faft_waitup_time', 0))
     self.faft_localrun = int(dict_args.get('faft_localrun', 0))
     super(firmware_ConsecutiveBoot, self).initialize(host, cmdline_args)
     self.switcher.setup_mode('dev' if dev_mode else 'normal')
     if dev_mode:
         self.clear_set_gbb_flags(0, vboot.GBB_FLAG_DEV_SCREEN_SHORT_DELAY)
     self.setup_usbkey(usbkey=False)
Пример #10
0
    def warmup(self, raw_cmdline_args):
        """Possibly parse the router hostname from the commandline.

        @param raw_cmdline_args raw input from autotest.

        """
        cmdline_args = utils.args_to_dict(raw_cmdline_args)
        logging.info('Running wifi test with commandline arguments: %r',
                     cmdline_args)
        self._router_hostname_from_cmdline = cmdline_args.get(
                wifi_test_context_manager.WiFiTestContextManager. \
                        CMDLINE_ROUTER_ADDR)
 def test_matches(self):
     result = utils.args_to_dict(
         ['aBc:DeF', 'SyS=DEf', 'XY_Z:', 'F__o0O=', 'B8r:=:=', '_bAZ_=:=:'])
     self.assertEqual(
         result, {
             'abc': 'DeF',
             'sys': 'DEf',
             'xy_z': '',
             'f__o0o': '',
             'b8r': '=:=',
             '_baz_': ':=:'
         })
Пример #12
0
    def test_unmatches(self):
        # Temporarily shut warning messages from args_to_dict() when an argument
        # doesn't match its pattern.
        logger = logging.getLogger()
        saved_level = logger.level
        logger.setLevel(logging.ERROR)

        try:
            result = utils.args_to_dict(['ab-c:DeF', '--SyS=DEf', 'a*=b', 'a*b',
                                         ':VAL', '=VVV', 'WORD'])
            self.assertEqual({}, result)
        finally:
            # Restore level.
            logger.setLevel(saved_level)
    def test_unmatches(self):
        # Temporarily shut warning messages from args_to_dict() when an argument
        # doesn't match its pattern.
        logger = logging.getLogger()
        saved_level = logger.level
        logger.setLevel(logging.ERROR)

        try:
            result = utils.args_to_dict([
                'ab-c:DeF', '--SyS=DEf', 'a*=b', 'a*b', ':VAL', '=VVV', 'WORD'
            ])
            self.assertEqual({}, result)
        finally:
            # Restore level.
            logger.setLevel(saved_level)
def get_chart_address(host_address, args):
    """Get address of chart tablet from commandline args or mapping logic in
    test lab.

    @param host_address: a list of hostname strings.
    @param args: a dict parse from commandline args.
    @return:
        A list of strings for chart tablet addresses.
    """
    address = utils.args_to_dict(args).get('chart')
    if address is not None:
        return address.split(',')
    elif utils.is_in_container():
        return [utils.get_lab_chart_address(host) for host in host_address]
    else:
        return None
 def initialize(self, host, cmdline_args, dev_mode=False):
     # Parse arguments from command line
     dict_args = utils.args_to_dict(cmdline_args)
     super(firmware_Mosys, self).initialize(host, cmdline_args)
     self.switcher.setup_mode('dev' if dev_mode else 'normal')
     # a list contain failed execution.
     self.failed_command = []
     # Get a list of available mosys commands.
     lines = self.run_cmd('mosys help')
     self.command_list = []
     cmdlist_start = False
     for line in lines:
         if cmdlist_start:
             cmdlst = re.split('\s+', line)
             if len(cmdlst) > 2:
                 self.command_list.append(cmdlst[1])
         elif 'Commands:' in line:
             cmdlist_start = True
     logging.info('Available commands: %s', ' '.join(self.command_list))
Пример #16
0
    def warmup(self, host, raw_cmdline_args, additional_params=None):
        """
        Use the additional_params argument to pass in custom test data from
        control file to reuse test logic.  This object will be passed down via
        parse_additional_arguments.

        @param host host object representing the client DUT.
        @param raw_cmdline_args raw input from autotest.
        @param additional_params object passed in from control file.

        """
        cmdline_args = utils.args_to_dict(raw_cmdline_args)
        logging.info('Running wifi test with commandline arguments: %r',
                     cmdline_args)
        self._wifi_context = wifi_test_context_manager.WiFiTestContextManager(
            self.__class__.__name__, host, cmdline_args, self.debugdir)

        self._wifi_context.setup()
        self.parse_additional_arguments(cmdline_args, additional_params)

        msg = '======= WiFi autotest setup complete. Starting test... ======='
        self._wifi_context.client.shill_debug_log(msg)
Пример #17
0
 def test_matches(self):
     result = utils.args_to_dict(['aBc:DeF', 'SyS=DEf', 'XY_Z:',
                                  'F__o0O=', 'B8r:=:=', '_bAZ_=:=:'])
     self.assertEqual(result, {'abc':'DeF', 'sys':'DEf', 'xy_z':'',
                               'f__o0o':'', 'b8r':'=:=', '_baz_':':=:'})
Пример #18
0
 def test_no_args(self):
     result = utils.args_to_dict([])
     self.assertEqual({}, result)
 def test_no_args(self):
     result = utils.args_to_dict([])
     self.assertEqual({}, result)
 def initialize(self, host, cmdline_args):
     dict_args = utils.args_to_dict(cmdline_args)
     self.faft_iterations = int(dict_args.get('faft_iterations', 1))
     super(platform_S0ixCycle, self).initialize(host, cmdline_args)
     self.switcher.setup_mode('normal')