示例#1
0
    def test_smoke_wfc_call_sms(self):
        ads = self.android_devices
        sms_idle_result = False
        sms_incall_result = False
        call_result = False

        self.log.info("--------start test_smoke_wfc_call_sms--------")
        for ad in [ads[0], ads[1]]:
            if not ad.droid.imsIsWfcEnabledByPlatform():
                self.log.info("WFC not supported by platform.")
                return True
        try:
            ensure_phones_default_state(self.log, ads)
            tasks = [(phone_setup_iwlan,
                      (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED,
                       self.wifi_network_ssid, self.wifi_network_pass)),
                     (phone_setup_iwlan,
                      (self.log, ads[1], True, WFC_MODE_WIFI_PREFERRED,
                       self.wifi_network_ssid, self.wifi_network_pass))]
            if not multithread_func(self.log, tasks):
                self.log.error("Phone Failed to Set Up WiFI Calling.")
                return False

            self.log.info("1. Verify SMS in idle.")
            if sms_send_receive_verify(self.log, ads[0], ads[1],
                                       [rand_ascii_str(50)]):
                sms_idle_result = True

            self.log.info("2. Setup WiFi Call.")
            if not call_setup_teardown(
                    self.log,
                    ads[0],
                    ads[1],
                    ad_hangup=None,
                    verify_caller_func=is_phone_in_call_iwlan,
                    verify_callee_func=is_phone_in_call_iwlan):
                self.log.error("Setup WiFi Call Failed.")
                self.log.info("sms_idle_result:{}".format(sms_idle_result))
                return False

            self.log.info("3. Verify SMS in call.")
            if sms_send_receive_verify(self.log, ads[0], ads[1],
                                       [rand_ascii_str(51)]):
                sms_incall_result = True

            self.log.info("4. Verify Call not drop and hangup.")
            if (is_phone_in_call_iwlan(self.log, ads[0])
                    and is_phone_in_call_iwlan(self.log, ads[1])
                    and hangup_call(self.log, ads[0])):
                call_result = True

            return (call_result and sms_idle_result and sms_incall_result)
        finally:
            self.log.info(
                "Summary for test run. Testbed:<{}>. <WFC> SMS idle: {}, "
                "SMS in call: {}, Voice Call: {}".format(
                    getattr(self, Config.ikey_testbed_name.value),
                    sms_idle_result, sms_incall_result, call_result))
示例#2
0
    def stress_test(self, setup_func=None, network_check_func=None, test_sms=False):
        if setup_func and not setup_func():
            self.log.error("Test setup %s failed", setup_func.__name__)
            return False
        fail_count = collections.defaultdict(int)
        for i in range(1, self.phone_call_iteration + 1):
            msg = "Stress Call Test %s Iteration: <%s> / <%s>" % (
                self.test_name, i, self.phone_call_iteration)
            self.log.info(msg)
            iteration_result = True
            ensure_phones_idle(self.log, self.android_devices)
            if not self._setup_phone_call():
                fail_count["dialing"] += 1
                iteration_result = False
                self.log.error("%s call dialing failure.", msg)

            if network_check_func and not network_check_func(self.log,
                                                             self.caller):
                fail_count["caller_network_check"] += 1
                iteration_result = False
                self.log.error("%s network check %s failure.", msg,
                               network_check_func.__name__)

            if network_check_func and not network_check_func(self.log,
                                                             self.callee):
                fail_count["callee_network_check"] += 1
                iteration_result = False
                self.log.error("%s network check failure.", msg)

            time.sleep(self.phone_call_duration)

            if not verify_incall_state(self.log, [self.caller, self.callee],
                                       True):
                self.log.error("%s call dropped.", msg)
                iteration_result = False
                fail_count["drop"] += 1

            self._hangup_call()

            if test_sms and not sms_send_receive_verify(
                    self.log, self.caller, self.callee, [rand_ascii_str(180)]):
                fail_count["sms"] += 1

            self.log.info("%s %s" % (msg, str(iteration_result)))
            if not iteration_result:
                self._take_bug_report("%s_%s" % (self.test_name, i), self.begin_time)

            if self.sleep_time_between_test_iterations:
                self.caller.droid.goToSleepNow()
                self.callee.droid.goToSleepNow()
                time.sleep(self.sleep_time_between_test_iterations)


        test_result = True
        for failure, count in fail_count.items():
            if count:
                self.log.error("%s: %s %s failures in %s iterations".format(
                    self.test_name, count, failure, self.phone_call_iteration))
                test_result = False
        return test_result
示例#3
0
 def _check_sms_mt(self):
     if not sms_send_receive_verify(self.log, self.ad_reference, self.dut,
                                    [rand_ascii_str(180)]):
         self.log.error("SMS receive test failed")
         return False
     else:
         self.log.info("SMS receive test passed")
         return True
 def sms_send_outgoing_texts(self, pri_dut, sec_dut):
     self.log.info("Test send sms of different sizes.")
     input("Press enter to execute this testcase...")
     msg = [rand_ascii_str(50), rand_ascii_str(1), rand_ascii_str(500)]
     if not sms_send_receive_verify(self.log, pri_dut, sec_dut, msg):
         return False
     else:
         self.log.info("Successfully sent sms. Please verify on carkit.")
     return True
 def sms_receive_multiple(self, pri_dut, sec_dut):
     text_count = 10
     self.log.info(
         "Test sending {} sms messages to phone.".format(text_count))
     input("Press enter to execute this testcase...")
     for _ in range(text_count):
         msg = [rand_ascii_str(50)]
         if not sms_send_receive_verify(self.log, sec_dut, pri_dut, msg):
             return False
         else:
             self.log.info(
                 "Successfully sent sms. Please verify on carkit.")
     return True
    def _sms_test_dsds(self, ads):
        """Test SMS between two phones on multiple sub_id

        Returns:
            True if success.
            False if failed.
        """
        for slot in range(self.sim_config["number_of_sims"]):
            set_subid_for_message(
                ads[0], get_subid_from_slot_index(self.log, ads[0], slot))
            set_subid_for_message(
                ads[1], get_subid_from_slot_index(self.log, ads[1], slot))
            for length in self.message_lengths:
                message_array = [rand_ascii_str(length)]
                ads[0].log.info("SMS Test - length %s from slot %s to slot %s",
                                length, slot, slot)
                if not sms_send_receive_verify(
                        self.log, ads[0], ads[1], message_array,
                        slot_id_rx=slot):
                    ads[0].log.warning(
                        "SMS of length %s test failed from slot %s to slot %s",
                        length, slot, slot)
                    return False
                ads[0].log.info("SMS Test - length %s from slot %s to slot %s",
                                length, slot, 1 - slot)
                if not sms_send_receive_verify(self.log,
                                               ads[0],
                                               ads[1],
                                               message_array,
                                               slot_id_rx=1 - slot):
                    ads[0].log.warning(
                        "SMS of length %s test failed from slot %s to slot %s",
                        length, slot, 1 - slot)
                    return False
                else:
                    ads[0].log.info("SMS of length %s test succeeded", length)
            self.log.info("SMS test of length %s characters succeeded.",
                          self.message_lengths)
        return True
 def _check_volte(self, ad, ad_reference):
     if (CAPABILITY_VOLTE in device_capabilities[self.dut_model] and
             CAPABILITY_VOLTE in operator_capabilities[self.dut_operator]):
         self.log.info("Check VoLTE")
         if not phone_setup_volte(self.log, ad):
             self.log.error("Failed to setup VoLTE.")
             return False
         if not call_setup_teardown(self.log, ad, ad_reference, ad,
                                    is_phone_in_call_volte):
             self.log.error("VoLTE Call Failed.")
             return False
         if not sms_send_receive_verify(self.log, ad, ad_reference,
                                        [rand_ascii_str(50)]):
             self.log.error("SMS failed")
             return False
     return True
 def _check_3g(self):
     self.log.info("Check 3G data and CS call")
     if not phone_setup_voice_3g(self.log, self.dut):
         self.log.error("Failed to setup 3G")
         return False
     if not verify_http_connection(self.log, self.dut):
         self.log.error("Data not available on cell.")
         return False
     if not call_setup_teardown(self.log, self.dut, self.ad_reference,
                                self.dut, is_phone_in_call_3g):
         self.log.error("WFC Call Failed.")
         return False
     if not sms_send_receive_verify(self.log, self.dut, self.ad_reference,
                                    [rand_ascii_str(50)]):
         self.log.error("SMS failed")
         return False
     return True
 def _check_wfc(self, ad, ad_reference):
     if (CAPABILITY_WFC in device_capabilities[self.dut_model] and
             CAPABILITY_WFC in operator_capabilities[self.dut_operator]):
         self.log.info("Check WFC")
         if not phone_setup_iwlan(self.log, ad, True, WFC_MODE_WIFI_PREFERRED,
             self.wifi_network_ssid, self.wifi_network_pass):
             self.log.error("Failed to setup WFC.")
             return False
         if not call_setup_teardown(self.log, ad, ad_reference, ad,
                                    is_phone_in_call_iwlan):
             self.log.error("WFC Call Failed.")
             return False
         if not sms_send_receive_verify(self.log, ad, ad_reference,
                                        [rand_ascii_str(50)]):
             self.log.error("SMS failed")
             return False
     return True
示例#10
0
    def _sms_test(self, ads):
        """Test SMS between two phones.

        Returns:
            True if success.
            False if failed.
        """

        sms_params = [(ads[0], ads[1])]
        message_arrays = [[rand_ascii_str(50)], [rand_ascii_str(160)],
                          [rand_ascii_str(180)]]

        for outer_param in sms_params:
            outer_param = (self.log, ) + outer_param
            for message_array in message_arrays:
                inner_param = outer_param + (message_array, )
                if not sms_send_receive_verify(*inner_param):
                    return False

        return True
 def sms_during_incomming_call(self, pri_dut, sec_dut):
     self.log.info(
         "Test incomming call scenario to phone from unknown contact")
     input("Press enter to execute this testcase...")
     outgoing_num = get_phone_number(self.log, pri_dut)
     if not initiate_call(self.log, sec_dut, outgoing_num):
         self.log.error("Failed to initiate call")
         return False
     if not wait_and_answer_call(self.log, pri_dut):
         self.log.error("Failed to answer call.")
         return False
     time.sleep(self.short_timeout)
     msg = [rand_ascii_str(10)]
     if not sms_send_receive_verify(self.log, sec_dut, pri_dut, msg):
         return False
     else:
         self.log.info("Successfully sent sms. Please verify on carkit.")
     input("Press enter to hangup call...")
     if not hangup_call(self.log, sec_dut):
         self.log.error("Failed to hangup call")
         return False
     return True
示例#12
0
    def test_smoke_volte_call_data_sms(self):
        try:
            ads = self.android_devices
            sms_idle_result = False
            sms_incall_result = False
            data_idle_result = False
            data_incall_result = False
            call_result = False

            self.log.info(
                "--------start test_smoke_volte_call_data_sms--------")
            ensure_phones_default_state(self.log, ads)
            tasks = [(phone_setup_volte, (self.log, ads[0])),
                     (phone_setup_volte, (self.log, ads[1]))]
            if not multithread_func(self.log, tasks):
                self.log.error("Phone Failed to Set Up VoLTE.")
                return False

            # This is to reduce call fail in VoLTE mode.
            # TODO: b/26338170 remove sleep, use proper API to check DUT status.
            time.sleep(10)

            self.log.info("1. SMS in LTE idle.")
            sms_idle_result = sms_send_receive_verify(self.log, ads[0], ads[1],
                                                      [rand_ascii_str(50)])

            self.log.info("2. Data in LTE idle.")
            if (wait_for_cell_data_connection(self.log, ads[0], True)
                    and verify_http_connection(self.log, ads[0])):
                data_idle_result = True

            self.log.info("3. Setup VoLTE Call.")
            if not call_setup_teardown(
                    self.log,
                    ads[0],
                    ads[1],
                    ad_hangup=None,
                    verify_caller_func=is_phone_in_call_volte,
                    verify_callee_func=is_phone_in_call_volte,
                    wait_time_in_call=WAIT_TIME_IN_CALL_FOR_IMS):
                self.log.error("Setup VoLTE Call Failed.")
                return False

            self.log.info("4. Verify SMS in call.")
            sms_incall_result = sms_send_receive_verify(
                self.log, ads[0], ads[1], [rand_ascii_str(51)])

            self.log.info("5. Verify Data in call.")
            if (wait_for_cell_data_connection(self.log, ads[0], True)
                    and verify_http_connection(self.log, ads[0])):
                data_incall_result = True

            self.log.info("6. Verify Call not drop and hangup.")
            if (is_phone_in_call_volte(self.log, ads[0])
                    and is_phone_in_call_volte(self.log, ads[1])
                    and hangup_call(self.log, ads[0])):
                call_result = True

            return (sms_idle_result and data_idle_result and call_result
                    and sms_incall_result and data_incall_result)
        finally:
            self.log.info(
                "Summary for test run. Testbed:<{}>. <VoLTE> SMS idle: {}, "
                "Data idle: {}, SMS in call: {}, Data in call: {}, "
                "Voice Call: {}".format(
                    getattr(self, Config.ikey_testbed_name.value),
                    sms_idle_result, data_idle_result, sms_incall_result,
                    data_incall_result, call_result))
示例#13
0
    def test_smoke_3g_call_data_sms(self):
        try:
            ads = self.android_devices
            sms_idle_result = False
            sms_incall_result = False
            data_idle_result = False
            data_incall_result = False
            call_result = False

            self.log.info("--------start test_smoke_3g_call_data_sms--------")
            ensure_phones_default_state(self.log, ads)
            tasks = [(phone_setup_voice_3g, (self.log, ads[0])),
                     (phone_setup_voice_3g, (self.log, ads[1]))]
            if not multithread_func(self.log, tasks):
                self.log.error("Phone Failed to Set Up 3G.")
                return False
            self.log.info("1. SMS in 3G idle.")
            sms_idle_result = sms_send_receive_verify(self.log, ads[0], ads[1],
                                                      [rand_ascii_str(50)])

            self.log.info("2. Data in 3G idle.")
            if (wait_for_cell_data_connection(self.log, ads[0], True)
                    and verify_http_connection(self.log, ads[0])):
                data_idle_result = True

            self.log.info("3. Setup 3G Call.")
            if not call_setup_teardown(self.log,
                                       ads[0],
                                       ads[1],
                                       ad_hangup=None,
                                       verify_caller_func=is_phone_in_call_3g,
                                       verify_callee_func=is_phone_in_call_3g):
                self.log.error("Setup 3G Call Failed.")
                return False

            self.log.info("4. Verify SMS in call.")
            sms_incall_result = sms_send_receive_verify(
                self.log, ads[0], ads[1], [rand_ascii_str(51)])

            self.log.info("5. Verify Data in call.")
            if is_rat_svd_capable(
                    get_network_rat(self.log, ads[0], NETWORK_SERVICE_VOICE)):
                if (wait_for_cell_data_connection(self.log, ads[0], True)
                        and verify_http_connection(self.log, ads[0])):
                    data_incall_result = True
            else:
                self.log.info("Data in call not supported on current RAT."
                              "Skip Data verification.")
                data_incall_result = SKIP

            self.log.info("6. Verify Call not drop and hangup.")
            if (is_phone_in_call_3g(self.log, ads[0])
                    and is_phone_in_call_3g(self.log, ads[1])
                    and hangup_call(self.log, ads[0])):
                call_result = True

            return (sms_idle_result and data_idle_result and call_result
                    and sms_incall_result and ((data_incall_result is True) or
                                               (data_incall_result == SKIP)))
        finally:
            self.log.info(
                "Summary for test run. Testbed:<{}>. <3G> SMS idle: {}, "
                "Data idle: {}, SMS in call: {}, Data in call: {}, "
                "Voice Call: {}".format(
                    getattr(self, Config.ikey_testbed_name.value),
                    sms_idle_result, data_idle_result, sms_incall_result,
                    data_incall_result, call_result))
    def stress_test(self,
                    setup_func=None,
                    network_check_func=None,
                    test_sms=False,
                    test_video=False):
        for ad in self.android_devices:
            #check for sim and service
            ensure_phone_subscription(self.log, ad)

        if setup_func and not setup_func():
            self.log.error("Test setup %s failed", setup_func.__name__)
            return False
        fail_count = collections.defaultdict(int)
        for i in range(1, self.phone_call_iteration + 1):
            msg = "Stress Call Test %s Iteration: <%s> / <%s>" % (
                self.test_name, i, self.phone_call_iteration)
            begin_time = get_current_epoch_time()
            self.log.info(msg)
            iteration_result = True
            ensure_phones_idle(self.log, self.android_devices)

            if not self._setup_phone_call(test_video, phone_call_duration=self.phone_call_duration):
                fail_count["dialing"] += 1
                iteration_result = False
                self.log.error("%s call dialing failure.", msg)
            else:
                if network_check_func and not network_check_func(
                        self.log, self.caller):
                    fail_count["caller_network_check"] += 1
                    last_call_drop_reason(self.caller, begin_time)
                    iteration_result = False
                    self.log.error("%s network check %s failure.", msg,
                                   network_check_func.__name__)

                if network_check_func and not network_check_func(
                        self.log, self.callee):
                    fail_count["callee_network_check"] += 1
                    last_call_drop_reason(self.callee, begin_time)
                    iteration_result = False
                    self.log.error("%s network check failure.", msg)

                if not verify_incall_state(self.log,
                                           [self.caller, self.callee], True):
                    self.log.error("%s call dropped.", msg)
                    iteration_result = False
                    fail_count["drop"] += 1

                self._hangup_call()

            if test_sms and not sms_send_receive_verify(
                    self.log, self.caller, self.callee, [rand_ascii_str(180)]):
                fail_count["sms"] += 1

            self.log.info("%s %s", msg, iteration_result)
            if not iteration_result:
                self._take_bug_report("%s_CallNo_%s" % (self.test_name, i),
                                      begin_time)
                start_qxdm_loggers(self.log, self.android_devices)

            if self.sleep_time_between_test_iterations:
                self.caller.droid.goToSleepNow()
                self.callee.droid.goToSleepNow()
                time.sleep(self.sleep_time_between_test_iterations)

        test_result = True
        for failure, count in fail_count.items():
            if count:
                self.log.error("%s: %s %s failures in %s iterations",
                               self.test_name, count, failure,
                               self.phone_call_iteration)
                test_result = False
        return test_result