예제 #1
0
    def test_wifi_cell_irat_stress_http_dl(self):
        """Test for data switch between WiFi and Cell. DUT go in and out WiFi
        coverage for multiple times.

        Steps:
        1. Set WiFi and Cellular signal to good (attenuation value to MIN).
        2. Make sure DUT get Cell data coverage (LTE) and WiFi connected.
        3. Set WiFi RSSI to MAX (WiFi attenuator value to MIN).
        4. Verify DUT report WiFi connected and able to download file
        5. Set WiFi RSSI to MIN (WiFi attenuator value to MAX).
        6. Verify DUT report Cellular Data connected and able to download file
        7. Repeat Step 3~6 for stress number.

        Expected Results:
        4. DUT report WiFi connected and able to download file
        6. DUT report Cellular Data connected and able to download file
        7. Stress test should pass.

        Returns:
        True if Pass. False if fail.
        """
        ad = self.android_devices[0]
        if not self._basic_connectivity_check():
            self.log.error("Basic Connectivity Check Failed")
            return False

        total_iteration = self.stress_test_number
        self.log.info("Stress test. Total iteration = %d.", total_iteration)
        current_iteration = 1
        while (current_iteration <= total_iteration):
            self.log.info(">----Current iteration = %d/%d----<",
                          current_iteration, total_iteration)

            self._atten_setup_wifi_cell()
            if (not wait_for_wifi_data_connection(self.log, ad, True)):
                ad.log.error("Data not on WiFi")
                break
            if not active_file_download_test(self.log, ad):
                ad.log.error("HTTP file download failed on WiFi")
                break

            self._atten_setup_cell_only()
            if (not wait_for_cell_data_connection(self.log, ad, True)):
                ad.log.error("Data not on Cell")
                break
            if not active_file_download_test(self.log, ad):
                ad.log.error("HTTP file download failed on cell")
                break

            self.log.info(">----Iteration : %d/%d succeed.----<",
                          current_iteration, total_iteration)
            current_iteration += 1

        if current_iteration <= total_iteration:
            self.log.info(">----Iteration : %d/%d failed.----<",
                          current_iteration, total_iteration)
            return False
        else:
            return True
예제 #2
0
    def test_lte_only_http_dl(self):
        """Test for 1GB file download on WiFi Only

        Steps:
        1. Set WiFi atten to MIN and Cellular to MAX
        2. Start downloading 1GB file from net
        3. Verify is the download is successfull

        Expected Results:
        1. File should download over WiFi

        Returns:
        True if Pass. False if fail.
        """
        ad = self.android_devices[0]
        if not self._basic_connectivity_check():
            self.log.error("Basic Connectivity Check Failed")
            return False
        self._atten_setup_lte_only()
        if (not wait_for_cell_data_connection(self.log, ad, True)
                or not verify_http_connection(self.log, ad)):
            ad.log.error("Data not on LTE")
            return False
        if not active_file_download_test(self.log, ad, "1GB"):
            ad.log.error("HTTP file download failed on LTE")
            return False
        return True
예제 #3
0
    def _data_download(self, file_names=["5MB", "10MB", "20MB", "50MB"]):
        begin_time = get_current_epoch_time()
        start_qxdm_loggers(self.log, self.android_devices)
        self.dut.log.info(dict(self.result_info))
        selection = random.randrange(0, len(file_names))
        file_name = file_names[selection]
        self.result_info["Internet Connection Check Total"] += 1
        if not self.internet_connection_check_method(self.log, self.dut):
            rat = self.dut.adb.getprop("gsm.network.type")
            self.dut.log.info("Network in RAT %s", rat)
            if self.dut_incall and not is_rat_svd_capable(rat.upper()):
                self.result_info[
                    "Expected Incall Internet Connection Check Failure"] += 1
                return True
            else:
                self.result_info["Internet Connection Check Failure"] += 1
                test_name = "%s_internet_connection_No_%s_failure" % (
                    self.test_name,
                    self.result_info["Internet Connection Check Failure"])
                try:
                    self._ad_take_extra_logs(self.dut, test_name, begin_time)
                    self._ad_take_bugreport(self.dut, test_name, begin_time)
                except Exception as e:
                    self.log.exception(e)
                return False
        else:
            self.result_info["Internet Connection Check Success"] += 1

        self.result_info["File Download Total"] += 1
        if not active_file_download_test(
                self.log, self.dut, file_name,
                method=self.file_download_method):
            self.result_info["File Download Failure"] += 1
            if self.result_info["File Download Failure"] == 1:
                try:
                    self._ad_take_extra_logs(
                        self.dut, "%s_file_download_failure" % self.test_name,
                        begin_time)
                    self._ad_take_bugreport(
                        self.dut, "%s_file_download_failure" % self.test_name,
                        begin_time)
                except Exception as e:
                    self.log.exception(e)
            return False
        else:
            self.result_info["File Download Success"] += 1
            return True
 def data_test(self):
     failure = 0
     total_count = 0
     tcpdump_pid = None
     #file_names = ["5MB", "10MB", "20MB", "50MB", "200MB", "512MB", "1GB"]
     file_names = ["5MB", "10MB", "20MB", "50MB", "200MB", "512MB"]
     while time.time() < self.finishing_time:
         total_count += 1
         pull_tcpdump = False
         try:
             self.dut.log.info(dict(self.result_info))
             self.result_info["Total file download"] += 1
             selection = random.randrange(0, len(file_names))
             file_name = file_names[selection]
             (tcpdump_pid, tcpdump_file) = \
                      start_adb_tcpdump(self.dut, self.test_name, mask="all")
             if not active_file_download_test(self.log, self.dut,
                                              file_name):
                 self.result_info["%s file download failure" %
                                  file_name] += 1
                 failure += 1
                 pull_tcpdump = True
                 self._take_bug_report("%s_download_failure" %
                                       self.test_name,
                                       time.strftime("%m-%d-%Y-%H-%M-%S"))
                 self.dut.droid.goToSleepNow()
                 time.sleep(random.randrange(0, self.max_sleep_time))
         except IGNORE_EXCEPTIONS as e:
             self.log.error("Exception error %s", str(e))
             self.result_info["Exception Errors"] += 1
             if self.result_info["Exception Errors"] > EXCEPTION_TOLERANCE:
                 self.finishing_time = time.time()
                 raise
         except Exception as e:
             self.finishing_time = time.time()
             raise
         finally:
             if tcpdump_pid is not None:
                 stop_adb_tcpdump(self.dut, tcpdump_pid, tcpdump_file,
                                  pull_tcpdump)
         self.dut.log.info("File download test failure: %s/%s", failure,
                           total_count)
     if failure / total_count > 0.1:
         return "File download test failure: %s/%s" % (failure, total_count)
     else:
         return ""
 def data_test(self):
     failure = 0
     total_count = 0
     #file_names = ["5MB", "10MB", "20MB", "50MB", "200MB", "512MB", "1GB"]
     #wifi download is very slow in lab, limit the file size upto 200MB
     file_names = ["5MB", "10MB", "20MB", "50MB", "200MB"]
     while time.time() < self.finishing_time:
         total_count += 1
         begin_time = get_current_epoch_time()
         start_qxdm_loggers(self.log, self.android_devices)
         try:
             self.dut.log.info(dict(self.result_info))
             self.result_info["Total file download"] += 1
             selection = random.randrange(0, len(file_names))
             file_name = file_names[selection]
             if not active_file_download_test(self.log, self.dut,
                                              file_name):
                 self.result_info["File download failure"] += 1
                 failure += 1
                 if self.result_info["File download failure"] == 1:
                     self._take_bug_report(
                         "%s_file_download_failure" % self.test_name,
                         begin_time)
             self.dut.droid.goToSleepNow()
             time.sleep(random.randrange(0, self.max_sleep_time))
         except IGNORE_EXCEPTIONS as e:
             self.log.error("Exception error %s", str(e))
             self.result_info["Exception Errors"] += 1
             if self.result_info["Exception Errors"] > EXCEPTION_TOLERANCE:
                 self.log.error("Too many exception error %s",
                                IGNORE_EXCEPTIONS)
                 return False
         except Exception as e:
             self.log.error(e)
             return False
         self.dut.log.info("File download test failure: %s/%s", failure,
                           total_count)
     if failure / total_count > 0.1:
         return False
     else:
         return True
예제 #6
0
 def data_test(self):
     failure = 0
     total_count = 0
     #file_names = ["5MB", "10MB", "20MB", "50MB", "200MB", "512MB", "1GB"]
     file_names = ["5MB", "10MB", "20MB", "50MB", "200MB", "512MB"]
     while time.time() < self.finishing_time:
         try:
             self.dut.log.info(dict(self.result_info))
             self.result_info["Total file download"] += 1
             selection = random.randrange(0, len(file_names))
             file_name = file_names[selection]
             total_count += 1
             if not active_file_download_test(self.log, self.dut,
                                              file_name):
                 self.result_info["%s file download failure" %
                                  file_name] += 1
                 failure += 1
                 #self._take_bug_report("%s_download_failure" % self.test_name,
                 #                      time.strftime("%m-%d-%Y-%H-%M-%S"))
                 self.dut.droid.goToSleepNow()
                 time.sleep(random.randrange(0, self.max_sleep_time))
         except IGNORE_EXCEPTIONS as e:
             self.log.error("Exception error %s", str(e))
             self.result_info["Exception Errors"] += 1
             if self.result_info["Exception Errors"] > EXCEPTION_TOLERANCE:
                 self.finishing_time = time.time()
                 raise "Too many %s errors" % IGNORE_EXCEPTIONS
         except Exception as e:
             self.log.error(e)
             self.finishing_time = time.time()
             raise
         self.dut.log.info("File download test failure: %s/%s", failure,
                           total_count)
     if failure / total_count > 0.1:
         return "File download test failure: %s/%s" % (failure, total_count)
     else:
         return ""