Exemple #1
0
 def _set_option(self, name, value):
     time_mark = logcat.get_device_time_mark()
     cmd = "service call hwc.info 3 s16 '%s' s16 '%s'" % (name, value)
     g_common_obj.adb_cmd_capture_msg(repr(cmd))
     e_msg = logcat.get_device_log(time_mark, 'Parcel:F hwc:W *:S')
     assert len(e_msg) == 0,\
         "[FAILURE] %s \n%s" % (cmd, e_msg)
     i_msg = logcat.get_device_log(time_mark, 'hwc:I *:S')
     catch_log = re.findall('.+Changed option %s.+' % (name), i_msg)
     print '-' * 60 + '\n'
     print catch_log
     print '-' * 60 + '\n'
     assert catch_log,\
         "[FAILURE] verify option failed"
Exemple #2
0
    def play_movie(self):
        '''
        Play Movie and catch logcat.
        '''
        self._device.press.recent()
        time.sleep(2)
        self._device.press.back()
        time.sleep(2)
        self._locator.play_video.click.wait()
        time.sleep(1)
        if not self._device(text="big_buck_bunny_480p.mp4").exists:
            assert False, "[FAILURE] can't find the test video."
        print "[Info] ---Play Movie"
        self._locator.play.click.wait()
        time.sleep(20)
        msg = logcat.get_device_log(self.time_mark, 'Grafika *:S')
        pattern = r"SurfaceTexture ready"
        match = re.search(pattern, msg)
        assert match, \
            "[FAILURE] can't match %s result in % s log" % (pattern, msg)

        pattern = r"starting movie"
        match = re.search(pattern, msg)
        assert match, \
            "[FAILURE] can't match %s result in % s log" % (pattern, msg)

        pattern = r"video=864x480"
        match = re.search(pattern, msg)
        assert match, \
            "[FAILURE] can't match %s result in % s log" % (pattern, msg)
    def play_video(self, secs=None, timeout=None):
        """click play video"""

        print "[Debug] play_video"
        mark_time = logcat.get_device_time_mark()
        pre_dump = self.d.dump()
        pre_focus = SystemUi.get_current_focus()
        print pre_focus

        self._view.play.click.wait()
        if secs:
            time.sleep(secs)
        end_dump = self.d.dump()
        end_focus = SystemUi.get_current_focus()
        print end_focus

        seq_match = difflib.SequenceMatcher(None, pre_dump, end_dump)
        ratio = round(seq_match.ratio(), 2) * 100
        print "ratio:%s" % ratio

        if ratio == 100 and pre_focus == end_focus:
            assert False, "[FAILURE] Play video No any reply"
        if not secs:
            start_time = time.time()
            play_done = False
            while time.time() - start_time < timeout:
                time.sleep(10)
                if self._view.play.exists:
                    play_done = True
                    break
            assert play_done, "[FAILURE] Play video time out"

        errmsg = logcat.get_device_log(mark_time, filters='MediaPlayer:E *:S')
        assert not errmsg, "[FAILURE] Found Errors in Logcat during Play Video\n%s" % (
            errmsg)
 def tearDown(self):
     print "[tearDown]:%s" % self.__class__.__name__
     self.photosImpl.rm_delete_photos()
     self.photosImpl.refresh_sdcard()
     fatal_msg = logcat.get_device_log(self.mark_time, filters='*:F')
     assert len(fatal_msg) == 0, \
         "occurred Fatal error during testing:\n%s" % (fatal_msg)
     super(WallpaperSetGIFImageTest, self).tearDown()
Exemple #5
0
    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        app_pid = g_common_obj.adb_cmd_capture_msg("ps | grep 'com.example.android.apis' |awk '{print $2}'")
        fatal_msg = logcat.get_device_log(self.mark_time, filters='*:F', pid=app_pid)
        assert len(fatal_msg) == 0, "occurred Fatal error during testing:\n%s" % (fatal_msg)

        self.apidemo.clean()
        super(APIDemosGraphicsOpenGLESTest, self).tearDown()
Exemple #6
0
    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__

        app_pid = g_common_obj.adb_cmd_capture_msg("ps | grep '%s' |awk '{print $2}'" % (ImageProcessingImpl.PKG_NAME))
        fatal_msg = logcat.get_device_log(self.mark_time, filters='*:F', pid=app_pid)
        assert len(fatal_msg) == 0, "occurred Fatal error during testing:\n%s" % (fatal_msg)

        self.imageprocessing.clean()
 def verify_log_core_cpu(self, time_mark):
     """verify keywords CPU in log"""
     logs = logcat.get_device_log(time_mark, "RenderScript:V *:S")
     assert len(logs) > 0, \
         "[FAILURE] Failed Catch logs"
     msg = re.findall(r'.* CPU*', logs)
     assert len(msg) > 0, \
         "[FAILURE] Failed verify_log_core_cpu"
     print "[Debug] %s" % (''.join(msg))
Exemple #8
0
 def run_DisplayMetricsTest(self):
     time_mark = logcat.get_device_time_mark()
     cmd = "am instrument -e class %s -w %s"\
         % (self.DisplayMetricsTestDriver_test, self.DisplayMetricsTestDriver_runner)
     msg = g_common_obj.adb_cmd_capture_msg(repr(cmd))
     assert 'OK ' in msg,\
         "[FAILURE] Failed am instrument\n%s\n%s" % (cmd, msg)
     logs = logcat.get_device_log(time_mark, "*:D|grep API")
     assert len(logs) > 0,\
         "[FAILURE] Failed Catch logs"
     return logs
Exemple #9
0
 def parse_skia_bench_log(self, time_mark):
     logs = logcat.get_device_log(time_mark, "skia:D *:S")
     assert len(logs), "[FAILURE] No log caught!"
     tested_cases = re.findall(r'running.+', logs, re.IGNORECASE)
     print "[Debug] skia bench tested count:%s" % (len(tested_cases))
     assert len(tested_cases) > 0,\
         "[FAILURE] not found! skia bench test log"
     errors = re.findall(r'.*Can\'t get.+|.*fail.*', logs, re.IGNORECASE)
     assert len(errors) == 0,\
         "[FAILURE] skia bench test results:\nTested %s Failed %s \n%s"\
         % (len(tested_cases), len(errors), ''.join(errors))
Exemple #10
0
    def test_HDMI_Connect_Disconnect_20times(self):
        """
        test_HDMI_Connect_Disconnect_20times

        Steps:
        1. hdmi cable connected and disconnected check hdmi display and hdmi status
            Display is OK,no error and crash.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. hdmi cable connected and disconnected check hdmi display and hdmi status
                            Display is OK,no error and crash."""
        for count in range(1, 21):
            print "count %s" % count
            self.d.screen.on()
            mark_time = logcat.get_device_time_mark()
            self.display_cable_switch.switch_on()
            dut_log = logcat.get_device_log(mark_time)
            catch_log = re.findall(
                '.+WiredAccessoryManager.+device hdmi connected.+', dut_log)
            print '-' * 60 + '\n'
            print catch_log
            print '-' * 60 + '\n'
            assert catch_log,\
                "[FAILURE] Connect failed"

            mark_time = logcat.get_device_time_mark()
            self.display_cable_switch.switch_off()
            dut_log = logcat.get_device_log(mark_time)
            catch_log = re.findall(
                '.+WiredAccessoryManager.+device hdmi disconnected.+', dut_log)
            print '-' * 60 + '\n'
            print catch_log
            print '-' * 60 + '\n'
            assert catch_log,\
                "[FAILURE] Disconnect failed"
Exemple #11
0
    def parse_skia_test_log(self, time_mark):
        logs = logcat.get_device_log(time_mark, "skia:D *:S")
        # Finished XX tests, XX failures, XX skipped.
        pattern = r"Finished (?P<RET_TOTAL>\d+) tests, "\
            r"(?P<RET_FAIL>\d+) failures, (?P<RET_SKIP>\d+) skipped."
        match = re.search(pattern, logs)
        assert match,\
            "[FAILURE] can't match result summary log"
        failed_results = re.findall(".+FAILED.*", logs, re.IGNORECASE)

        total_cnt = match.group('RET_TOTAL')
        fail_cnt = match.group('RET_FAIL')
        skip_cnt = match.group('RET_SKIP')
        summary = "Finished %s tests, %s failures, %s skipped."\
            % (total_cnt, fail_cnt, skip_cnt)
        print "[Debug] %s" % (summary)
        assert total_cnt and fail_cnt == '0' and skip_cnt == '0',\
            "[FAILURE] %s\n%s" % (summary, ''.join(failed_results))
Exemple #12
0
    def test_Display_AllAppsOnHomeScreen(self):
        """
        test_Display_AllAppsOnHomeScreen
        """
        # self.meitu_impl.launch_app_am()
        PhotoGridEdit().launch_app_am()
        app_pid = g_common_obj.adb_cmd_capture_msg(
            "ps | grep '%s' |awk '{print $2}'" % (PhotoGridEdit().pkg_name))

        for i in range(6):
            time.sleep(5)
            _, activity = self.systemui.get_current_focus()
            if not activity == '':
                break
        assert activity == PhotoGridEdit(
        ).activity_name, "Check MeituPicEdit launch fail"

        fatal_msg = logcat.get_device_log(self.mark_time,
                                          filters='*:F',
                                          pid=app_pid)
        assert len(
            fatal_msg) == 0, "occurred Fatal error during testing:\n%s" % (
                fatal_msg)

        PhotoGridEdit().stop_app_am()
        time.sleep(2)

        PicsArtStudio().launch_app_am()
        _, activity = self.systemui.get_current_focus()
        assert activity == PicsArtStudio(
        ).activity_name, "Check PicsArtStudio launch fail"
        #         fatal_msg = logcat.get_device_log(self.mark_time, filters='*:F')
        #         assert len(fatal_msg) == 0, \
        #             "occurred Fatal error during testing:\n%s" % (fatal_msg)
        PicsArtStudio().stop_app_am()
        time.sleep(2)

        PicSay().launch_app_am()
        _, activity = self.systemui.get_current_focus()
        assert activity == PicSay().activity_name, "Check PicSay launch fail"

        fatal_msg = logcat.get_device_log(self.mark_time,
                                          filters='*:F',
                                          pid=app_pid)
        assert len(
            fatal_msg) == 0, "occurred Fatal error during testing:\n%s" % (
                fatal_msg)

        PicSay().stop_app_am()
        time.sleep(2)

        SketchBookX().launch_app_am()
        _, activity = self.systemui.get_current_focus()
        assert activity == SketchBookX(
        ).activity_name, "Check SketchBookX launch fail"
        #         fatal_msg = logcat.get_device_log(self.mark_time, filters='*:F')
        #         assert len(fatal_msg) == 0, \
        #             "occurred Fatal error during testing:\n%s" % (fatal_msg)
        SketchBookX().stop_app_am()
        time.sleep(2)

        Skitch().launch_app_am()
        _, activity = self.systemui.get_current_focus()
        assert activity == Skitch().activity_name, "Check Skitch launch fail"
        #         fatal_msg = logcat.get_device_log(self.mark_time, filters='*:F')
        #         assert len(fatal_msg) == 0, \
        #             "occurred Fatal error during testing:\n%s" % (fatal_msg)
        Skitch().stop_app_am()
        time.sleep(2)