コード例 #1
0
    def set_up(self):
        """
        Initialize the test
        """
        LiveWifiBase.set_up(self)

        if str(self._expected_connection_time).upper() in ["NONE", "", "0", "NO"]:
            self._monitor_connection_time = False
        elif str(self._expected_connection_time).isdigit() and int(self._expected_connection_time) > 0:
            self._monitor_connection_time = True
            self._expected_connection_time = int(self._expected_connection_time)
        else:
            msg = "Wrong parameter for REF_CONNECTION_TIME: read value %s" % str(self._expected_connection_time)
            self._logger.error(msg)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg)

        # Update back to back iteration and the wifi connection time list
        if self._monitor_connection_time:
            msg = "DUT connected in %d seconds" % self._connection_time
            self._logger.info(msg)
            self._current_iteration_num += 1

            if self._connection_time != -1:
                self._connection_time_list.append(self._connection_time)
            else:
                self._logger.warning("unable to measure connection time")
        return Global.SUCCESS, "No errors"
    def set_up(self):
        """
        Initialize the test
        """
        LiveBTBase.set_up(self)
        LiveWifiBase.set_up(self)

        # Connect BT to Headset
        a2dp_pair_connect_to_headset(self._bt_api, self._bt_headset)

        return Global.SUCCESS, "No errors"
コード例 #3
0
    def set_up(self):
        """
        Initialize the test
        """
        LiveWifiBase.set_up(self)

        if self._test_usb_disconnect is None:
            msg = "invalid TC parameter [TEST_USB_DISCONNECT: %s]. Please use true/false value." \
                    % self._tc_parameters.get_param_value("TEST_USB_DISCONNECT")
            self._logger.error(msg)
            raise DeviceException(DeviceException.INVALID_PARAMETER, msg)

        # Initialize USB tethering status to "disable"
        self._networking_api.stop_usb_tethering(unplug=True)

        # Checks that USB Tethering is disabled
        self._networking_api.check_usb_tethering_state(False)

        return Global.SUCCESS, "No error"
    def set_up(self):
        """
        Initialize the test
        """
        LiveDualPhoneBTBase.set_up(self)

        self._bt_headset = self._em.get_bluetooth_headset("BT_HEADSET")
        self._bt_headset_addr = self._bt_headset.get_bdaddress()

        if self._wifi_activity == "WIFI_FTP_DOWNLOAD":
            LiveWifiBase.set_up(self)
        else:
            self._networking_api.set_wifi_power(0)

        if not str(self._duration).isdigit():
            msg = "Bad value on duration parameter : %s" % self._duration
            self._logger.error(msg)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg)
        self._duration = int(self._duration)

        if self._dut_state not in ["DUT_CLIENT", "DUT_SERVER"]:
            msg = "DUT state configuration unknown - DUT should be client or server"
            self._logger.error(msg)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg)

        if self._wifi_activity not in ["WIFI_FTP_DOWNLOAD", "WIFI_SWITCH_SCAN_CONNECT"]:
            msg = "Unknown WiFi activity : %s" % self._wifi_activity
            self._logger.error(msg)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg)

        # Configure OPP transfer
        opp_init_configure(self._device, self._phone2)

        # Connect to BT Headset
        a2dp_pair_connect_to_headset(self._bt_api, self._bt_headset)

        # Launch audio
        a2dp_switch_music_state(self._bt_api, self._bt_headset, BtAudioCmd.PLAY)

        return Global.SUCCESS, "No errors"
コード例 #5
0
    def set_up(self):
        """
        Initialize the test
        """
        LiveBTBase.set_up(self)
        LiveWifiBase.set_up(self)

        self._bt_headset_addr = self._bt_headset.get_bdaddress()

        if not str(self._duration).isdigit():
            msg = "Bad value on duration parameter : %s" % self._duration
            self._logger.error(msg)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg)
        self._duration = int(self._duration)

        # Connect to BT Headset
        a2dp_pair_connect_to_headset(self._bt_api, self._bt_headset)

        # Launch audio
        a2dp_switch_music_state(self._bt_api, self._bt_headset, BtAudioCmd.PLAY)

        return Global.SUCCESS, "No errors"
コード例 #6
0
    def set_up(self):
        """
        Initialize the test
        """
        LiveWifiBase.set_up(self)

        # Recall current screen timeout
        self._current_screen_timeout = self._phonesystem_api.get_screen_timeout(
        )

        # Set the screen timeout to be sure that the screen will on
        # *15 because the minimum timeout is 1: 1*15 = 15s which is the minimum screen timeout
        time.sleep(self._wait_btwn_cmd)
        if self._webpage_loading_timeout > 0:
            self._phonesystem_api.set_screen_timeout(
                self._webpage_loading_timeout * 15)

        # Wakes up the phone
        time.sleep(self._wait_btwn_cmd)
        self._phonesystem_api.wake_screen()

        return Global.SUCCESS, "No errors"
コード例 #7
0
ファイル: AndroidCTS.py プロジェクト: zenghui0-0/tempfile
    def set_up(self):
        """
        Initialize the test

        :rtype: tuple
        :return: ACS verdict and msg output
        """
        verdict = Global.SUCCESS
        msg = ""

        LiveWifiBase.set_up(self)

        if self._test_timeout is None:
            return (Global.FAILURE, "You need to specify a "
                                    "TESTS_TIMEOUT value.")

        if self._cts_path is None:
            return (Global.FAILURE, "You need to specify a "
                                    "CTS_PATH value.")

        if self._test_cmd_lines is None:
            return (Global.FAILURE, "You need to specify a "
                                    "TEST_PACKAGES_NAMES value.")

        if self._cts_media_path is None:
            self._logger.info("No media specified for CTS tests")

        if self._cts_result_comparison is None:
            self._logger.info("No comparison will be done with previous CTS run")

        full_path = ""
        if HttpDownloaderUtil.is_http_uri(self._cts_path):
            # Test is available thru URL => download it localy
            result, full_path = self._download_file(self._cts_path)
        else:
            result, full_path = self._get_file_path(self._cts_path)

        if result != Global.SUCCESS:
            verdict = result
            msg = "Cannot get the cts version from %s" % self._cts_path
        else:
            self._cts_path = full_path

            # Set cts directory path
            # can be a path to a dir or a zip file
            # in both case, resulting filename will be a directory
            cts_exec_found = False
            fileName, fileExtension = os.path.splitext(self._cts_path)
            if fileExtension.lower() == ".zip":
                zip_file = zipfile.ZipFile(self._cts_path, "r")
                zip_file.extractall(fileName)
                zip_file.close()
            else:
                fileName = self._cts_path

            # cts path should be a dir
            if os.path.isdir(fileName):
                self._cts_path = fileName
                for root, _, file_names in os.walk(self._cts_path):
                    for file_ in file_names:
                        if file_ == CTS_EXEC_FILENAME:
                            self._cts_exec_path = os.path.join(root, file_)
                            os.chmod(self._cts_exec_path, stat.S_IRWXU)
                            cts_exec_found = True

            if not cts_exec_found:
                verdict, msg = Global.FAILURE, "Cannot find the CTS executable binary"
            else:
                # clean up old previous results
                for root, _, file_names in os.walk(self._cts_path):
                    for file_ in file_names:
                        if CTS_RESULT_FILENAME in file_:
                            shutil.rmtree(root)

                # Initialize UI api
                self._ui_api.init()

                # setup the board if it has not been done previously
                verdict, msg = self._setup_device_for_cts()

        return verdict, msg
コード例 #8
0
    def set_up(self):
        """
        Initialize the test
        """
        # Call LIVE_WIFI_BASE set_up function
        LiveWifiBase.set_up(self)

        if '-u' in self._iperf_options:
            protocole = "UDP"
        else:
            protocole = "TCP"

        # Read the throughput targets
        self._throughput_targets = ConfigsParser("Wifi_Throughput_Targets").\
            parse_wifi_targets(self._device.get_phone_model(),
                               self._standard, self._security, protocole, self._bandwidth)

        # Overwrite target values with those read in TC parameter
        if self._target_ul is not None and self._target_ul != "":
            self._throughput_targets.ul_target.set(float(self._target_ul),
                                                   ThroughputMeasure.KBPS_UNIT)
        if self._failure_ul is not None and self._failure_ul != "":
            self._throughput_targets.ul_failure.set(
                float(self._failure_ul), ThroughputMeasure.KBPS_UNIT)
        if self._target_dl is not None and self._target_dl != "":
            self._throughput_targets.dl_target.set(float(self._target_dl),
                                                   ThroughputMeasure.KBPS_UNIT)
        if self._failure_dl is not None and self._failure_dl != "":
            self._throughput_targets.dl_failure.set(
                float(self._failure_dl), ThroughputMeasure.KBPS_UNIT)

        if self._direction not in ("both", "up", "down"):
            msg = "%s is not a valid DIRECTION."
            self._logger.error(msg)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg)

        self._iperf_settings.update({"direction": self._direction})

        if self._computer is not None:
            self._iperf_settings.update({"computer": self._computer})

        if self._direction == 'down':
            # Downlink: connect from host to DUT, get DUT IP address.
            ip = self._networking_api.get_wifi_ip_address()
            self._iperf_settings.update({"server_ip_address": ip})
        elif self._computer is not None:
            # Uplink/both: connect from DUT to host, get computer IP address.
            # if computer is None or localhost, use WIFI_SERVER from Bench_Config
            ip = self._computer.get_host_on_test_network()
            if ip not in ("localhost", "127.0.0.1"):
                self._iperf_settings.update({"server_ip_address": ip})

        if self._tune_options == 1:
            # Set Iperf settings depending on the expected throughput
            self._iperf_settings.update(
                get_iperf_configuration(self._throughput_targets))

        # Overwrite Iperf settings with iperf options read in TC parameter
        self._iperf_settings.update(parse_iperf_options(self._iperf_options))

        return Global.SUCCESS, "No errors"