Example #1
0
    def run_once(self, suspends=5, integration=None):
        self._host = self.context.client.host

        for router_conf, client_conf in self._configurations:
            self.context.configure(configuration_parameters=router_conf)
            assoc_params = xmlrpc_datatypes.AssociationParameters(
                is_hidden=client_conf.is_hidden,
                security_config=client_conf.security_config,
                ssid=self.context.router.get_ssid())
            self.context.assert_connect_wifi(assoc_params)
            self._timings = list()

            if integration:
                if not self._host.servo:
                    raise error.TestNAError('Servo object returned None. '
                                            'Check if servo is missing or bad')

                # If the DUT is up and cold_reset is set to on, that means the
                # DUT does not support cold_reset. We can't run the test,
                # because it may get in a bad state and we won't be able
                # to recover.
                if self._host.servo.get('cold_reset') == 'on':
                    raise error.TestNAError('This DUT does not support '
                                            'cold reset, exiting')
                self.factory = remote_facade_factory.RemoteFacadeFactory(
                    self._host, no_chrome=True)
                logging.info('Running Wifi Suspend Stress Integration test.')
                browser_facade = self.factory.create_browser_facade()
                browser_facade.start_default_chrome()
                utils.poll_for_condition(condition=self.logged_in,
                                         timeout=_START_TIMEOUT_SECONDS,
                                         sleep_interval=1,
                                         desc='User not logged in.')
                self.check_servo_lid_open_support()
                stressor = stress.CountedStressor(self.stress_wifi_suspend)
            else:
                logging.info('Running Non integration Wifi Stress test.')
                stressor = stress.CountedStressor(
                    self.powerd_non_servo_wifi_suspend)

            stressor.start(suspends)
            stressor.wait()

            perf_dict = {
                'fastest': max(self._timings),
                'slowest': min(self._timings),
                'average': (float(sum(self._timings)) / len(self._timings))
            }
            for key in perf_dict:
                self.output_perf_value(
                    description=key,
                    value=perf_dict[key],
                    units='seconds',
                    higher_is_better=False,
                    graph=router_conf.perf_loggable_description)
Example #2
0
    def run_once(self, suspends=5):
        self._host = self.context.client.host

        if not self._host.servo:
            raise error.TestNAError(
                'Servo object returned None. Check if servo is missing or bad')

        # If the DUT is up and cold_reset is set to on, that means the DUT does
        # not support cold_reset.  We can't run the test, because it may get
        # in a bad state and we won't be able to recover.
        if self._host.servo.get('cold_reset') == 'on':
            raise error.TestNAError('This DUT does not support cold reset, '
                                    'exiting')
        for router_conf, client_conf in self._configurations:
            self.context.configure(configuration_parameters=router_conf)
            assoc_params = xmlrpc_datatypes.AssociationParameters(
                is_hidden=client_conf.is_hidden,
                security_config=client_conf.security_config,
                ssid=self.context.router.get_ssid())
            self.context.assert_connect_wifi(assoc_params)

            self._timings = list()

            autotest_client = autotest.Autotest(self._host)
            stressor = stress.CountedStressor(self.stress_wifi_suspend,
                                              on_exit=self.exit_client)
            stressor.start(suspends,
                           start_condition=self.logged_in,
                           start_timeout_secs=_START_TIMEOUT_SECONDS)
            autotest_client.run_test('desktopui_SimpleLogin')
            stressor.wait()

            perf_dict = {
                'fastest': max(self._timings),
                'slowest': min(self._timings),
                'average': (float(sum(self._timings)) / len(self._timings))
            }
            for key in perf_dict:
                self.output_perf_value(
                    description=key,
                    value=perf_dict[key],
                    units='seconds',
                    higher_is_better=False,
                    graph=router_conf.perf_loggable_description)
Example #3
0
    def run_once(self, suspends=5):
        """Run suspend stress test.

        @param suspends: Number of suspend iterations

        """
        self._host = self.context.client.host

        for router_conf, client_conf in self._configurations:
            self.context.configure(ap_config=router_conf)
            assoc_params = xmlrpc_datatypes.AssociationParameters(
                is_hidden=client_conf.is_hidden,
                security_config=client_conf.security_config,
                ssid=self.context.router.get_ssid())
            self.context.assert_connect_wifi(assoc_params)
            self._timings = list()

            stressor = stress.CountedStressor(self.stress_wifi_suspend)

            stressor.start(suspends)
            stressor.wait()

            perf_dict = {
                'fastest': max(self._timings),
                'slowest': min(self._timings),
                'average': (float(sum(self._timings)) / len(self._timings))
            }
            for key in perf_dict:
                self.output_perf_value(
                    description=key,
                    value=perf_dict[key],
                    units='seconds',
                    higher_is_better=False,
                    graph=router_conf.perf_loggable_description)

            # Explicitly disconnect and clear the shill profile, in case
            # we're running another configuration after this. Especially on
            # Hidden tests, the DUT may still think it can connect to
            # previously-discovered networks, causing extra connection failures
            # and delays along the way.
            self.context.client.shill.disconnect(client_conf.ssid)
            if not self.context.client.shill.init_test_network_state():
                raise error.TestError('Failed to set up shill profile.')
Example #4
0
    def run_once(self, host, port=8888):
        """Run the test.

        @param host: the host object
        @param port: integer value for the port the client to listen on

        """

        # Strict ordering matters here.  If an invalid order is given
        # below an exception will be thrown in the client test.
        self.tests = [  # Login, fail to connect
            {
                'server_error': 'The client test did not login',
                'server_fail': 'Server was able to connect (login).',
                'server_connected': True,
                'client_command': 'login',
                'client_error': 'Did not receive command to login (login)'
            },
            # Launch App, fail to connect
            {
                'server_error': 'The client test did not launch the app',
                'server_fail': 'Server was able to connect (setup).',
                'server_connected': True,
                'client_command': 'launch app',
                'client_error': 'Did not receive command to launch app (setup)'
            },
            # Start server, connect
            {
                'server_error': 'The client test did not open the port. (1)',
                'server_fail': 'Server was unable to connect (1).',
                'server_connected': False,
                'client_command': 'start server',
                'client_error': 'Did not receive command to start server (1)'
            },
            # Stop server, fail to connect
            {
                'server_error':
                'The client test did not close the port',
                'server_fail':
                str('Server was able to connect to the port. (1) '
                    '(It should not have been able to do so.)'),
                'server_connected':
                True,
                'client_command':
                'stop server',
                'client_error':
                'Did not receive command to stop server'
            },
            # Start server, connect
            {
                'server_error': 'The client test did not open the port. (2)',
                'server_fail': 'Server was unable to connect (2).',
                'server_connected': False,
                'client_command': 'start server',
                'client_error': 'Did not receive command to start server (2)'
            },
            # Quit app, fail to connect
            {
                'server_error':
                'The client test did not close the app.',
                'server_fail':
                str('Server was able to connect to the port (2). '
                    '(It should not have been able to do so.)'),
                'server_connected':
                True,
                'client_command':
                'exit app',
                'client_error':
                'Did not receive command to close app.'
            },
            # Telemetry cannot relaunch a closed extension; logout and back in.
            # Logout, fail to connect
            {
                'server_error':
                'The client test did not quit',
                'server_fail':
                str('Server was able to connect to the port (3). '
                    '(It should not have been able to do so.)'),
                'server_connected':
                True,
                'client_command':
                'logout',
                'client_error':
                'Did not receive command to exit.'
            },
            # Login, fail to connect
            {
                'server_error': 'The client test did not login',
                'server_fail': 'Server was able to connect (login).',
                'server_connected': True,
                'client_command': 'login',
                'client_error': 'Did not receive command to login (login)'
            },
            # Launch app, fail to connect
            {
                'server_error': 'The client test did not launch the app',
                'server_fail': 'Server was able to connect (setup2).',
                'server_connected': True,
                'client_command': 'launch app',
                'client_error':
                'Did not receive command to launch app (setup2)'
            },
            # Start server, connect
            {
                'server_error': 'The client test did not open the port. (1)',
                'server_fail': 'Server was unable to connect (1).',
                'server_connected': False,
                'client_command': 'start server',
                'client_error': 'Did not receive command to start server (1)'
            },
            # Logout, fail to connect
            {
                'server_error':
                'The client test did not quit',
                'server_fail':
                str('Server was able to connect to the port (3). '
                    '(It should not have been able to do so.)'),
                'server_connected':
                True,
                'client_command':
                'logout',
                'client_error':
                'Did not receive command to exit.'
            }
        ]

        self.client = host
        self.hostname = self.client.hostname
        self.port = port
        client_at = autotest.Autotest(self.client)

        self.client.run('rm %s' % _CLIENT_COMPLETE_FLAG, ignore_status=True)

        stressor = stress.CountedStressor(self.perform_tests)
        stressor.start(1)
        client_at.run_test('network_FirewallHolePunch',
                           test_sequence=self.tests,
                           port=self.port)