def run_once(self, host): """Test body.""" start_time = time.time() # Setup Bluetooth widgets and their binder, but do not yet connect. audio_test.audio_test_requirement() factory = audio_test.create_remote_facade_factory( host, self.resultsdir) chameleon_board = host.chameleon chameleon_board.reset() widget_factory = chameleon_audio_helper.AudioWidgetFactory( factory, host) source = widget_factory.create_widget( chameleon_audio_ids.CrosIds.BLUETOOTH_HEADPHONE) bluetooth_widget = widget_factory.create_widget( chameleon_audio_ids.PeripheralIds.BLUETOOTH_DATA_RX) binder = widget_factory.create_binder(source, bluetooth_widget) audio_test_file = 'http://commondatastorage.googleapis.com/' \ 'chromiumos-test-assets-public/audio_test/' \ 'chameleon/Headphone/test_256_16.mp3' for ap_config in self._ap_configs: # Set up the router and associate the client with it. self.context.configure(ap_config) if ap_config.is_11ac and not self.context.client.is_vht_supported( ): raise error.TestNAError('Client does not have AC support') assoc_params = xmlrpc_datatypes.AssociationParameters( ssid=self.context.router.get_ssid(), security_config=ap_config.security_config) self.context.assert_connect_wifi(assoc_params) session = netperf_session.NetperfSession(self.context.client, self.context.router) session.MEASUREMENT_MAX_SAMPLES = 6. # Warmup the wifi path and measure signal. session.warmup_stations() ap_config_tag = ap_config.perf_loggable_description for config in self.NETPERF_CONFIGS: self.test_one(session, config, ap_config_tag, 'BT_disconnected') with chameleon_audio_helper.bind_widgets(binder): self.test_one(session, config, ap_config_tag, 'BT_connected_but_not_streaming') logging.info('Playing an audio test file') browser_facade = factory.create_browser_facade() browser_facade.new_tab(audio_test_file) self.test_one(session, config, ap_config_tag, 'BT_streaming_audiofile') self.test_one(session, config, ap_config_tag, 'BT_disconnected_again') # Clean up router and client state for the next run. self.context.client.shill.disconnect( self.context.router.get_ssid()) self.context.router.deconfig() end_time = time.time() logging.info('Running time %0.1f seconds.', end_time - start_time)
def run_once(self): """Test body.""" start_time = time.time() for ap_config in self._ap_configs: # Set up the router and associate the client with it. self.context.configure(ap_config) # self.context.configure has a similar check - but that one only # errors out if the AP *requires* VHT i.e. AP is requesting # MODE_11AC_PURE and the client does not support it. # For wifi_perf, we don't want to run MODE_11AC_MIXED on the AP if # the client does not support VHT, as we are guaranteed to get the # same results at 802.11n/HT40 in that case. if ap_config.is_11ac and not self.context.client.is_vht_supported( ): raise error.TestNAError('Client does not have AC support') assoc_params = xmlrpc_datatypes.AssociationParameters( ssid=self.context.router.get_ssid(), security_config=ap_config.security_config) self.context.assert_connect_wifi(assoc_params) session = netperf_session.NetperfSession(self.context.client, self.context.router) # Flag a test error if we disconnect for any reason. with self.context.client.assert_no_disconnects(): # Conduct the performance tests while toggling powersave mode. for power_save in (True, False): for governor in sorted(set([None, self._governor])): self.do_run(ap_config, session, power_save, governor) # Clean up router and client state for the next run. self.context.client.shill.disconnect( self.context.router.get_ssid()) self.context.router.deconfig() end_time = time.time() logging.info('Running time %0.1f seconds.', end_time - start_time)
def run_once(self): """Test body.""" start_time = time.time() for ap_config in self._ap_configs: # Set up the router and associate the client with it. self.context.configure(ap_config) if ap_config.is_11ac and not self.context.client.is_vht_supported( ): raise error.TestNAError('Client does not have AC support') assoc_params = xmlrpc_datatypes.AssociationParameters( ssid=self.context.router.get_ssid(), security_config=ap_config.security_config) self.context.assert_connect_wifi(assoc_params) session = netperf_session.NetperfSession(self.context.client, self.context.router) # Flag a test error if we disconnect for any reason. with self.context.client.assert_no_disconnects(): # Conduct the performance tests while toggling powersave mode. for power_save in (True, False): self.do_run(ap_config, session, power_save) # Clean up router and client state for the next run. self.context.client.shill.disconnect( self.context.router.get_ssid()) self.context.router.deconfig() end_time = time.time() logging.info('Running time %0.1f seconds.', end_time - start_time)
def run_once(self): """Test body.""" start_time = time.time() for ap_config in self._ap_configs: # Set up the router and associate the client with it. self.context.configure(ap_config) if ap_config.is_11ac and not self.context.client.is_vht_supported( ): raise error.TestNAError('Client does not have AC support') assoc_params = xmlrpc_datatypes.AssociationParameters( ssid=self.context.router.get_ssid(), security_config=ap_config.security_config) self.context.assert_connect_wifi(assoc_params) session = netperf_session.NetperfSession(self.context.client, self.context.router) # Conduct the performance tests while toggling powersave mode. for power_save in (True, False): self.context.client.powersave_switch(power_save) session.warmup_stations() ps_tag = 'PS%s' % ('on' if power_save else 'off') ap_config_tag = '_'.join( [ap_config.perf_loggable_description, ps_tag]) signal_level = self.context.client.wifi_signal_level signal_description = '_'.join([ap_config_tag, 'signal']) self.write_perf_keyval({signal_description: signal_level}) for config in self.NETPERF_CONFIGS: results = session.run(config) if not results: logging.error('Failed to take measurement for %s', config.tag) continue values = [result.throughput for result in results] self.output_perf_value(config.tag, values, units='Mbps', higher_is_better=True, graph=ap_config_tag) result = netperf_runner.NetperfResult.from_samples(results) self.write_perf_keyval( result.get_keyval( prefix='_'.join([ap_config_tag, config.tag]))) # Clean up router and client state for the next run. self.context.client.shill.disconnect( self.context.router.get_ssid()) self.context.router.deconfig() end_time = time.time() logging.info('Running time %0.1f seconds.', end_time - start_time)
def run_once(self, host): """Test body.""" start_time = time.time() # Prepare Bluetooth to scan, but do not start yet. bt_device = bluetooth_device.BluetoothDevice(host) if not bt_device.reset_on(): raise error.TestFail('DUT could not be reset to initial state') for ap_config in self._ap_configs: # Set up the router and associate the client with it. self.context.configure(ap_config) if ap_config.is_11ac and not self.context.client.is_vht_supported( ): raise error.TestNAError('Client does not have AC support') assoc_params = xmlrpc_datatypes.AssociationParameters( ssid=self.context.router.get_ssid(), security_config=ap_config.security_config) self.context.assert_connect_wifi(assoc_params) session = netperf_session.NetperfSession(self.context.client, self.context.router) # Warmup the wifi path and measure signal. session.warmup_stations() ap_config_tag = ap_config.perf_loggable_description for config in self.NETPERF_CONFIGS: self.test_one(session, config, ap_config_tag, 'BT_quiet') if not bt_device.start_discovery(): raise error.TestFail('Could not start discovery on DUT') try: self.test_one(session, config, ap_config_tag, 'BT_scanning') finally: if not bt_device.stop_discovery(): logging.warning('Failed to stop discovery on DUT') self.test_one(session, config, ap_config_tag, 'BT_quiet_again') # Clean up router and client state for the next run. self.context.client.shill.disconnect( self.context.router.get_ssid()) self.context.router.deconfig() end_time = time.time() logging.info('Running time %0.1f seconds.', end_time - start_time)
def run_once(self): """Run test.""" start_time = time.time() throughput_data = [] max_atten = None self.context.client.host.get_file('/etc/lsb-release', self.resultsdir) # Set up the router and associate the client with it. self.context.configure(self._ap_config) assoc_params = xmlrpc_datatypes.AssociationParameters( ssid=self.context.router.get_ssid(), security_config=self._ap_config.security_config) self.context.assert_connect_wifi(assoc_params) # Conduct the performance tests. Ignore failures, since # at high attenuations, sometimes the control connection # is unable to terminate the test properly. session = netperf_session.NetperfSession(self.context.client, self.context.router, ignore_failures=True) session.warmup_stations() start_atten = self.context.attenuator.get_minimal_total_attenuation() for atten in range(start_atten, self.FINAL_ATTENUATION, self.ATTENUATION_STEP): atten_tag = 'atten%03d' % atten self.context.attenuator.set_total_attenuation( atten, self._ap_config.frequency) logging.info('RvR test: current attenuation = %d dB', atten) # Give this attenuation level a quick sanity test. If we can't stay # associated and handle a few pings, we probably won't get # meaningful results out of netperf. try: self.context.wait_for_connection( self.context.router.get_ssid()) except error.TestFail as e: logging.warning('Could not establish connection at %d dB (%s)', atten, str(e)) break for config in self.NETPERF_CONFIGS: results = session.run(config) if not results: logging.warning( 'Unable to take measurement for %s; ' 'aborting', config.human_readable_tag) break graph_name = '.'.join( [self._ap_config.perf_loggable_description, config.tag]) values = [result.throughput for result in results] # If no signal is detected with client.wifi_signal_level, set # signal_level to -100 to indicate weak signal. signal_level = (self.context.client.wifi_signal_level if self.context.client.wifi_signal_level else -100) self.output_perf_value(atten_tag, values, units='Mbps', higher_is_better=True, graph=graph_name) self.output_perf_value('_'.join([atten_tag, 'signal']), signal_level, units='dBm', higher_is_better=True, graph=graph_name) result = netperf_runner.NetperfResult.from_samples(results) throughput_data.append( self.DataPoint(atten, result.throughput, result.throughput_dev, signal_level, config.tag)) keyval_prefix = '_'.join([ self._ap_config.perf_loggable_description, config.tag, atten_tag ]) self.write_perf_keyval(result.get_keyval(prefix=keyval_prefix)) # Reported at least one successful result at this attenuation. max_atten = (atten, signal_level) signal_level = self.context.client.wifi_signal_level self.write_perf_keyval( {'_'.join([atten_tag, 'signal']): signal_level}) if not results: logging.warning('No results for atten %d dB; terminating', atten) # Clean up router and client state. self.context.client.shill.disconnect(assoc_params.ssid) self.context.router.deconfig() end_time = time.time() logging.info('Running time %0.1f seconds.', end_time - start_time) if max_atten is None: raise error.TestFail('Did not succeed at any atten level') logging.info('Reached attenuation of: %d dB (signal %d)' % max_atten) self.write_perf_keyval( {'ch%03d_max_atten' % self._ap_config.channel: max_atten[0]}) self.write_perf_keyval( {'ch%03d_min_signal' % self._ap_config.channel: max_atten[1]}) self.write_throughput_tsv_files(throughput_data)
def run_once(self): start_time = time.time() throughput_data = [] self.context.client.host.get_file('/etc/lsb-release', self.resultsdir) # Set up the router and associate the client with it. self.context.configure(self._ap_config) assoc_params = xmlrpc_datatypes.AssociationParameters( ssid=self.context.router.get_ssid(), security_config=self._ap_config.security_config) self.context.assert_connect_wifi(assoc_params) # Conduct the performance tests. Ignore failures, since # at high attenuations, sometimes the control connection # is unable to terminate the test properly. session = netperf_session.NetperfSession(self.context.client, self.context.router, ignore_failures=True) session.warmup_stations() start_atten = self.context.attenuator.get_minimal_total_attenuation() for atten in range(start_atten, min(start_atten + 20, self.FINAL_ATTENUATION), self.ATTENUATION_STEP): atten_tag = 'atten%03d' % atten self.context.attenuator.set_total_attenuation( atten, self._ap_config.frequency) logging.info('RvR test: current attenuation = %d dB', atten) for config in self.NETPERF_CONFIGS: results = session.run(config) if not results: logging.warning('Unable to take measurement for %s', config.human_readable_tag) continue graph_name = '.'.join( [self._ap_config.perf_loggable_description, config.tag]) values = [result.throughput for result in results] self.output_perf_value(atten_tag, values, units='Mbps', higher_is_better=True, graph=graph_name) self.output_perf_value('_'.join([atten_tag, 'signal']), self.context.client.wifi_signal_level, units='dBm', higher_is_better=True, graph=graph_name) result = netperf_runner.NetperfResult.from_samples(results) throughput_data.append( self.DataPoint(atten, result.throughput, result.throughput_dev, self.context.client.wifi_signal_level, config.tag)) keyval_prefix = '_'.join([ self._ap_config.perf_loggable_description, config.tag, atten_tag ]) self.write_perf_keyval(result.get_keyval(prefix=keyval_prefix)) signal_level = self.context.client.wifi_signal_level self.write_perf_keyval( {'_'.join([atten_tag, 'signal']): signal_level}) # Clean up router and client state. self.context.client.shill.disconnect(assoc_params.ssid) self.context.router.deconfig() end_time = time.time() logging.info('Running time %0.1f seconds.', end_time - start_time) self.write_throughput_tsv_files(throughput_data)