Example #1
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)
Example #2
0
    def run_once(self):
        """Configures a DUT to behave as if it was manufactured for a
        particular region. Then verifies that the DUT connects, or
        fails to connect, per expectations.

        """
        num_failures = 0
        try:
            self.fake_up_region(self.region_name)
            self.assert_equal(
                'country code',
                iw_runner.IwRunner(self.host).get_regulatory_domain(),
                self.expected_country_code)
            num_mismatches = self.count_mismatched_phy_configs(
                self.host, self.channel_infos)
            if num_mismatches:
                raise error.TestFail(
                    '%d phy configs were not as expected (see below)' %
                    num_mismatches)
            wifi_context = wifi_test_context_manager.WiFiTestContextManager(
                self.__class__.__name__, self.host, self.cmdline_args,
                self.debugdir)
            with wifi_context:
                wifi_context.router.reboot(timeout=self.REBOOT_TIMEOUT_SECS)
                for channel_config in self.channel_infos:
                    try:
                        self.test_channel(wifi_context, channel_config)
                    except error.TestFail as e:
                        # Log the error, but keep going. This way, we
                        # get a full report of channels where behavior
                        # differs from expectations.
                        logging.error('Verification failed for |%s|: %s',
                                      self.region_name, channel_config)
                        logging.error(e)
                        num_failures += 1
        finally:
            if num_failures:
                raise error.TestFail(
                    'Verification failed for %d channel configs (see below)' %
                    num_failures)
            self.host.run(self.VPD_CLEAN_COMMAND)
            self.host.reboot(timeout=self.REBOOT_TIMEOUT_SECS, wait=True)
    def warmup(self, host, raw_cmdline_args):
        """Stashes away parameters for use by run_once().

        @param host Host object representing the client DUT.
        @param raw_cmdline_args Raw input from autotest.
        @param additional_params One item from CONFIGS in control file.

        """
        # pylint: disable=attribute-defined-outside-init
        self.host = host
        self.cmdline_args = utils.args_to_dict(raw_cmdline_args)

        # Initialize BT.
        self.ble_adapter = \
                bluetooth_le_facade_adapter.BluetoothLEFacadeRemoteAdapter
        self.bluetooth_facade = self.ble_adapter(self.host)

        # Initialize wifi
        self.wifi_context = wifi_test_context_manager.WiFiTestContextManager(
            self.__class__.__name__, self.host, self.cmdline_args,
            self.debugdir)
        self.wifi_context.setup()