1#!/usr/bin/env python3 2#-*- coding: utf-8 -*- 3 4# Copyright (c) 2024 Huawei Device Co., Ltd. 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17from devicetest.core.test_case import TestCase, CheckPoint 18from hypium import UiDriver 19from tools.get_source_path import get_source_path 20from tools.push_remove_source import remove_source 21 22 23class case23_process002(TestCase): 24 25 def __init__(self, configs): 26 self.TAG = self.__class__.__name__ 27 TestCase.__init__(self, self.TAG, configs) 28 self.tests = [ 29 "test_step" 30 ] 31 self.driver = UiDriver(self.device1) 32 self.sn = self.device1.device_sn 33 34 def setup(self): 35 self.log.info("case23_process002 start") 36 37 def test_step(self): 38 driver = self.driver 39 CheckPoint("Print death callback information") 40 result = driver.System.execute_command("ondemand proc initp") 41 assert "OnSystemProcessStopped, processName: media_service" in result 42 assert "OnSystemProcessStarted, processName: media_service" in result 43 target_str = 'OnSystemProcessStopped, processName: media_service' 44 count = result.count(target_str) 45 assert count == 1 46 target_str = 'OnSystemProcessStarted, processName: media_service' 47 count = result.count(target_str) 48 assert count == 1 49 50 def teardown(self): 51 need_source = {"cfg": False, "fwk": False, "listen_test": False, "audio_ability": False, "ondemand": True, 52 "proxy": False, "para": False} 53 source_path = get_source_path(need_source=need_source, casename="level0/case22_process001") 54 remove_source(source_path=source_path, driver=self.driver, sn=self.sn) 55 self.log.info("case23_process002 down") 56