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, Step 18from sysCapUtils import sysCapUtils 19import time 20 21# @tc.number: C-STD-SOFTWARE-0400 22# @tc.name: testPowerShell 23# @tc.desc: 【C-STD-SOFTWARE-0400】必须提供系统休眠,唤醒和低功耗管理能力。 24 25class testPowerShell(TestCase): 26 27 def __init__(self, controllers): 28 self.TAG = self.__class__.__name__ 29 super().__init__(self.TAG, controllers) 30 31 def setup(self): 32 Step("Setup") 33 34 def process(self): 35 Step("Process") 36 state = "" 37 suspendStr = self.device1.execute_shell_command("power-shell suspend") 38 self.log.info('testPowerShell power-shell suspend suspendStr is:' + suspendStr) 39 assert 'SuspendDevice is called' in suspendStr 40 wakeUpStr = self.device1.execute_shell_command("power-shell wakeup") 41 self.log.info('testPowerShell power-shell wakeup wakeUpStr is:' + wakeUpStr) 42 time.sleep(1) 43 assert 'WakeupDevice is called' in wakeUpStr 44 time.sleep(1) 45 setModeStr = self.device1.execute_shell_command("power-shell setmode 603") 46 self.log.info('testPowerShell setmode 603 setModeStr is:' + setModeStr) 47 time.sleep(1) 48 assert 'Set Mode: 603' in setModeStr 49 def teardown(self): 50 Step("Teardown")