diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-05-17 02:21:31 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-05-17 02:21:33 +0000 |
commit | f4c662eb893e0ccea26f7f0b9fc36671161d8ac1 (patch) | |
tree | 5f1c682482351b116e1fbc7ea210509cc2eeb641 | |
parent | 2d74ba792d4e979df47beaac3fca2edf1693687c (diff) | |
parent | 8616983f6a01de353fce2f0ddbd84cd4b256e2f9 (diff) | |
download | platform_tools_test_connectivity-n-iot-preview-4.tar.gz platform_tools_test_connectivity-n-iot-preview-4.tar.bz2 platform_tools_test_connectivity-n-iot-preview-4.zip |
Merge "Added Telephony Bootup Time Test"android-n-iot-preview-4n-iot-preview-4
-rwxr-xr-x | acts/framework/acts/controllers/android_device.py | 2 | ||||
-rw-r--r-- | acts/tests/google/tel/live/TelLiveRebootStressTest.py | 126 |
2 files changed, 127 insertions, 1 deletions
diff --git a/acts/framework/acts/controllers/android_device.py b/acts/framework/acts/controllers/android_device.py index 46c22ffa2d..8828ab6d52 100755 --- a/acts/framework/acts/controllers/android_device.py +++ b/acts/framework/acts/controllers/android_device.py @@ -1086,7 +1086,7 @@ class AndroidDevice: "datetime_obj": datetime object}] """ out = self.adb.logcat( - '-d | grep "%s"' % matching_string, ignore_status=True) + '-b all -d | grep "%s"' % matching_string, ignore_status=True) if not out: return [] result = [] logs = re.findall(r'(\S+\s\S+)(.*%s.*)' % re.escape(matching_string), diff --git a/acts/tests/google/tel/live/TelLiveRebootStressTest.py b/acts/tests/google/tel/live/TelLiveRebootStressTest.py index d03911e356..48f4143044 100644 --- a/acts/tests/google/tel/live/TelLiveRebootStressTest.py +++ b/acts/tests/google/tel/live/TelLiveRebootStressTest.py @@ -121,6 +121,13 @@ class TelLiveRebootStressTest(TelephonyBaseTest): return False return True + def _get_list_average(self, input_list): + total_sum = float(sum(input_list)) + total_count = float(len(input_list)) + if input_list == []: + return False + return float(total_sum/total_count) + def _check_lte_data(self): self.log.info("Check LTE data.") if not phone_setup_csfb(self.log, self.dut): @@ -302,6 +309,96 @@ class TelLiveRebootStressTest(TelephonyBaseTest): test_result = False return test_result + def _telephony_bootup_time_test(self, **kwargs): + """Telephony Bootup Perf Test + + Arguments: + check_lte_data: whether to check the LTE data. + check_volte: whether to check Voice over LTE. + check_wfc: whether to check Wifi Calling. + + Expected Results: + Time + + Returns: + True is pass, False if fail. + """ + ad = self.dut + toggle_airplane_mode(self.log, ad, False) + if not phone_setup_volte(self.log, ad): + ad.log.error("Failed to setup VoLTE.") + return False + fail_count = collections.defaultdict(int) + test_result = True + keyword_time_dict = {} + + for i in range(1, self.stress_test_number + 1): + ad.log.info("Telephony Bootup Time Test %s Iteration: %d / %d", + self.test_name, i, self.stress_test_number) + ad.log.info("reboot!") + ad.reboot() + iteration_result = "pass" + + time.sleep(30) + text_search_mapping = { + 'boot_complete' : "processing action (sys.boot_completed=1)", + 'Voice_Reg' : "< VOICE_REGISTRATION_STATE {.regState = REG_HOME", + 'Data_Reg' : "< DATA_REGISTRATION_STATE {.regState = REG_HOME", + 'Data_Call_Up' : "onSetupConnectionCompleted result=SUCCESS", + 'VoLTE_Enabled' : "isVolteEnabled=true", + } + + text_obj_mapping = {"boot_complete" : None, + "Voice_Reg" : None, + "Data_Reg" : None, + "Data_Call_Up" : None, + "VoLTE_Enabled" : None,} + blocked_for_calculate = ["boot_complete"] + + for tel_state in text_search_mapping: + dict_match = ad.search_logcat(text_search_mapping[tel_state]) + if len(dict_match) != 0: + text_obj_mapping[tel_state] = dict_match[0]['datetime_obj'] + else: + ad.log.error("Cannot Find Text %s in logcat", + text_search_mapping[tel_state]) + blocked_for_calculate.append(tel_state) + fail_count[tel_state] += 1 + + for tel_state in text_search_mapping: + if tel_state not in blocked_for_calculate: + time_diff = text_obj_mapping[tel_state] - \ + text_obj_mapping['boot_complete'] + if time_diff.seconds > 100: + continue + if tel_state in keyword_time_dict: + keyword_time_dict[tel_state].append(time_diff.seconds) + else: + keyword_time_dict[tel_state] = [time_diff.seconds,] + + ad.log.info("Telephony Bootup Time Test %s Iteration: %d / %d %s", + self.test_name, i, self.stress_test_number, iteration_result) + + for tel_state in text_search_mapping: + if tel_state not in blocked_for_calculate: + avg_time = self._get_list_average(keyword_time_dict[tel_state]) + if avg_time < 12.0: + ad.log.info("Average %s for %d iterations = %.2f seconds", + tel_state, self.stress_test_number, avg_time) + else: + ad.log.error("Average %s for %d iterations = %.2f seconds", + tel_state, self.stress_test_number, avg_time) + fail_count[tel_state] += 1 + + ad.log.info("Bootup Time Dict {}".format(keyword_time_dict)) + for failure, count in fail_count.items(): + if count: + ad.log.error("%d %d failures in %d iterations", + count, failure, self.stress_test_number) + test_result = False + return test_result + + """ Tests Begin """ @test_tracker_info(uuid="4d9b425b-f804-45f4-8f47-0ba3f01a426b") @@ -422,5 +519,34 @@ class TelLiveRebootStressTest(TelephonyBaseTest): """ return self._reboot_stress_test(check_data_roaming=True) + @TelephonyBaseTest.tel_test_wrap + def test_bootup_optimized_stress(self): + """Bootup Optimized Reliability Test + + Steps: + 1. Reboot DUT. + 2. Check Provisioning bit (if support provisioning) + 3. Wait for DUT to camp on LTE, Verify Data. + 4. Enable VoLTE, check IMS registration. Wait for DUT report VoLTE + enabled, make VoLTE call. And verify VoLTE SMS. + (if support VoLTE) + 5. Connect WiFi, enable WiFi Calling, wait for DUT report WiFi + Calling enabled and make a WFC call and verify SMS. + Disconnect WiFi. (if support WFC) + 6. Wait for DUT to camp on 3G, Verify Data. + 7. Make CS call and verify SMS. + 8. Verify Tethering Entitlement Check and Verify WiFi Tethering. + 9. Check crashes. + 10. Repeat Step 1~9 for N times. (before reboot, clear Provisioning + bit if provisioning is supported) + + Expected Results: + No crash happens in stress test. + + Returns: + True is pass, False if fail. + """ + return self._telephony_bootup_time_test() + """ Tests End """ |