def run_test(self): """ Execute the CTS test Compute result based on CTS xml result output :rtype: tuple :return: ACS verdict and msg output """ LiveWifiBase.run_test(self) cts_results = {} result = Global.SUCCESS for test_cmd_line in self._test_cmd_lines.split(";"): test_cmd_line = "%s %s" % (self._cts_exec_path, test_cmd_line.strip()) result, output = internal_shell_exec(test_cmd_line, self._test_timeout) # pylint: disable=W0212 if result != Global.SUCCESS: return Global.FAILURE, output else: self._logger.debug("CTS - run_test completed") for root, _, filenames in os.walk(self._cts_path): for file_ in filenames: if CTS_RESULT_FILENAME in file_: cts_results = self._extract_cts_results_from_cts_report(os.path.join(root, file_), cts_results, publishInExternalReport=True) acs_cts_results = os.path.join(self._device.get_report_tree().get_report_path(), "cts_results") if not os.path.exists(acs_cts_results): os.makedirs(acs_cts_results) self._logger.info("Move CTS results into ACS result dir") shutil.move(root, acs_cts_results) result, output = self._compute_cts_results(cts_results) return result, output
def run_test(self): """ Execute the test """ LiveWifiBase.run_test(self) seq_string = "" #Take a screenshot and pull on host self._screenshot_path = self._image_api.take_screenshot_and_pull_on_host( self._image_filename, os.getcwd()) self._screenshot_state = True #Launch record on host self._audio_recorder_api.pc_audio_record_start( self._host_record_file, self._host_record_device) self._flag_record = True #Tap on play button self._logger.info("Play the video...") self._image_api.touch_template_on_screen( self._screenshot_path, self._dic_image[self._play_picture]) self._logger.info("Waiting for the audio to complete...") time.sleep(self._length + self._wait_btwn_cmd) #Stop record self._audio_recorder_api.pc_audio_record_stop() self._logger.info("Audio record saved at " + self._host_record_file) self._flag_record = False self._logger.info("Apply FFT on WAV file for extract frequency.") freq = AudioCheck.fft_on_wav_file(self._host_record_file) self._logger.info( "Replace remarkable frequency by note and extract sequence.") seq = AudioCheck.extract_sequence(freq) #Create str with sequence for i in seq: seq_string = seq_string + i + " " if self._sequence in seq_string: verdict = Global.SUCCESS msg = "No errors" else: verdict = Global.FAILURE msg = "Play and record sound are not identical." return verdict, msg
def run_test(self): """ Execute the test """ # Call LIVE_WIFI_BASE Run function LiveWifiBase.run_test(self) time.sleep(self._wait_btwn_cmd) # Run Iperf command throughput = self._networking_api.iperf(self._iperf_settings) # Compute verdict depending on throughputs return compute_iperf_verdict(throughput, self._throughput_targets, self._direction)
def run_test(self): """ Execute the test """ LiveWifiBase.run_test(self) # monitor wifi connection time if requested mean = -1 if self._monitor_connection_time and self.get_b2b_iteration() == self._current_iteration_num: # This is the last iteration of back to back test # compute standard deviation, mean and verdict mean = float(numpy.mean(self._connection_time_list)) std_deviation = float(numpy.std(self._connection_time_list)) compute_verdict(self._expected_connection_time, self._tolerance, mean, std_deviation, self._logger) # init values self._error.Code = Global.FAILURE self._error.Msg = "ping failed" if self._wrong_passphrase is not None: self._error.Code = Global.SUCCESS self._error.Msg = "OK - Connection failed with wrong password, ping not needed!" else: time.sleep(self._wait_btwn_cmd) self._logger.info("Ping address " + str(self._server_ip_address) + " with " + str(self._count) + " packets of " + str(self._packetsize) + " bytes...") source_address = self._networking_api.get_wifi_ip_address() packet_loss = self._networking_api.\ ping(self._server_ip_address, self._packetsize, self._count, source_address=source_address) # Compute verdict depending on % of packet loss if packet_loss.value > self._target_ping_packet_loss_rate: self._error.Code = Global.FAILURE else: self._error.Code = Global.SUCCESS self._error.Msg = "Measured Packet Loss: %.0f%s (Target: %.0f%s)."\ % (packet_loss.value, packet_loss.units, self._target_ping_packet_loss_rate, packet_loss.units) if mean > 0: self._error.Msg += " Mean connection time is %2.2f sec" % mean return self._error.Code, self._error.Msg
def run_test(self): """ Execute the test """ LiveWifiBase.run_test(self) # Open the browser and load the url before timeout (self._error.Code, self._error.Msg) = \ self._networking_api.open_web_browser(self._website_url, self._browser_type, self._webpage_loading_timeout) # Close the browser time.sleep(self._webpage_loading_timeout) self._networking_api.close_web_browser(self._browser_type) return self._error.Code, self._error.Msg
def run_test(self): """ Execute the test """ LiveWifiBase.run_test(self) time.sleep(self._wait_btwn_cmd) if self._direction == "DL": self._logger.info("FTP transfer " + str(self._direction) + " for " + str(self._dlfilename) + "...") result = self._networking_api.\ ftp_xfer(self._uecmd_types.XFER_DIRECTIONS.DL, # pylint: disable=E1101 self._server_ip_address, self._username, self._password, self._dlfilename, self._xfer_timeout, self._device.get_ftpdir_path()) elif self._direction == "UL": self._logger.info("FTP transfer " + str(self._direction) + " for " + str(self._ulfilename) + "...") result = self._networking_api.\ ftp_xfer(self._uecmd_types.XFER_DIRECTIONS.UL, # pylint: disable=E1101 self._server_ip_address, self._username, self._password, self._ulfilename, self._xfer_timeout, self._device.get_ftpdir_path()) else: self._error.Msg = "%s is not a known xfer direction" % self._direction raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, self._error.Msg) return result
def run_test(self): """ Execute the test """ LiveWifiBase.run_test(self) # Start USB Tethering self._networking_api.start_usb_tethering(unplug=True) # Control that USB Tethering starts well self._networking_api.check_usb_tethering_state(True) if self._test_usb_disconnect: # Disconnect ADB self._device.disconnect_board() self._disconnected = True # Unplug USB self._io_card.usb_host_pc_connector(False) self._unplugged = True # Wait some time USB cable unplugged time.sleep(5) # plug USB self._io_card.usb_host_pc_connector(True) self._unplugged = False # Reconnect ADB self._device.connect_board() self._disconnected = False else: # Disable USB Tethering self._networking_api.stop_usb_tethering(unplug=True) # Control that USB Tethering stops well self._networking_api.check_usb_tethering_state(False) return Global.SUCCESS, "No error"