diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_021.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_021.json index 67b186e59bd9a2fe8ea209d01ba73906efe43128..565d75c5a124fe59b98133de13ec3c5ea6c23c39 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_021.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_021.json @@ -1,3 +1,16 @@ { - "description": "hypium自测试用例" -} \ No newline at end of file + "description": "hypium自测试用例", + "environment": [ + { + "type": "device", + "label": "phone" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "testcases/level1/lifecycle/lifecycle_state_021.py" + ] + }, + "kits":[] + } \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_021.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_021.py index df1907304fa6a39aa31e34838c86bfb0c4e9e3b8..9b8cd3cb5f625a2c5c18d4d8ea4ed4e0cbd385d1 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_021.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_021.py @@ -15,7 +15,97 @@ # limitations under the License. import os +import time +from devicetest.core.test_case import TestCase, get_report_dir +from hypium import UiExplore +from hypium.action.host import host +from hypium.action.os_hypium.checker import Assert +from hypium.action.os_hypium.device_logger import DeviceLogger, AsyncCommand +from devicetest.utils.file.file_util import get_resource_path +sa_lib_test_path = get_resource_path( + "resource/SO_RESOURCE/liblisten_test.z.so", + isdir=None) + +sa_lib_ability_c_path = get_resource_path( + "resource/SO_RESOURCE/libtest_audio_ability.z.so", + isdir=None) + +sa_proxy_path = get_resource_path( + "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", + isdir=None) + +sa_listen_cfg_path = get_resource_path( + "resource/level/lifecycle_state_021/listen_test.cfg", + isdir=None) + +sa_listen_json_path = get_resource_path( + "resource/level/lifecycle_state_021/listen_test.json", + isdir=None) + +sa_ondemand_path = get_resource_path( + "resource/SO_RESOURCE/ondemand", + isdir=None) + +sa_tool_path = get_resource_path( + "resource/SO_RESOURCE/TestTool", + isdir=None) + + +class LifeCycle_State_021(TestCase): + + def __init__(self, controllers): + sele.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.tests = [ + "test_step" + ] + self.driver = UiExplore(self.driver1) + self.sn = self.driver1.device_sn + + def setup(self): + driver = self.driver + host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) + # host.shell("hdc -t {} target mount".format(self.sn)) + # driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") + # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") + # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") + # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") + # host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") + # host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") + # host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") + # host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) + # driver.System.reboot() + + def test_step(self): + # 步骤 "ondemand test 21"命令,执行测试程序 + # 预期结果 + # 控制台打印: GetSystemAbility systemAbilityId:1494 faild + driver = self.driver + result = driver.System.execute_command("ondemand test 21") + assert "GetSystemAbility systemAbilityId:1494 faild" in result + + def teardown(self): + self.driver.System.execute_command("kill -9 `pidof listen_test`") + #self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") + #self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") + #self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") + #self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") + #self.driver.Storage.remove_file("/system/etc/init/listen_test.json") + #self.driver.Storage.remove_file("/system/bin/ondemand") + self.log.info("done") diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_022.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_022.json index 67b186e59bd9a2fe8ea209d01ba73906efe43128..0a6fbf9b920e8231c0101fa087607926c1a4135f 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_022.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_022.json @@ -1,3 +1,16 @@ { - "description": "hypium自测试用例" -} \ No newline at end of file + "description": "hypium自测试用例", + "environment": [ + { + "type": "device", + "label": "phone" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "testcases/level1/lifecycle/lifecycle_state_022.py" + ] + }, + "kits":[] + } \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_022.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_022.py index df1907304fa6a39aa31e34838c86bfb0c4e9e3b8..e38b132e20e00fcd1669491cf4190221e795ab33 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_022.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_022.py @@ -15,6 +15,110 @@ # limitations under the License. import os +import time + +from devicetest.core.test_case import TestCase, get_report_dir +from hypium import UiExplore +from hypium.action.host import host + +from hypium.action.os_hypium.checker import Assert +from hypium.action.os_hypium.device_logger import DeviceLogger, AsyncCommand +from devicetest.utils.file.file_util import get_resource_path + + +sa_lib_test_path = get_resource_path( + "resource/SO_RESOURCE/liblisten_test.z.so", + isdir=None) + +sa_lib_ability_c_path = get_resource_path( + "resource/SO_RESOURCE/libtest_audio_ability.z.so", + isdir=None) + +sa_proxy_path = get_resource_path( + "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", + isdir=None) + +sa_listen_cfg_path = get_resource_path( + "resource/level/lifecycle_state_022/listen_test.cfg", + isdir=None) + +sa_listen_json_path = get_resource_path( + "resource/level/lifecycle_state_022/listen_test.json", + isdir=None) + +sa_ondemand_path = get_resource_path( + "resource/SO_RESOURCE/ondemand", + isdir=None) + +sa_tool_path = get_resource_path( + "resource/SO_RESOURCE/TestTool", + isdir=None) + + +class LifeCycle_State_022(TestCase): + + def __init__(self, controllers): + sele.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.tests = [ + "test_step" + ] + self.driver = UiExplore(self.driver1) + self.sn = self.driver1.device_sn + + def setup(self): + driver = self.driver + host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) + # host.shell("hdc -t {} target mount".format(self.sn)) + # driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") + # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") + # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") + # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") + # host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") + # host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") + # host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") + # host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) + # driver.System.reboot() + + def test_step(self): + driver = self.driver + # 用例同步 + # 执行"ondemand test 24"命令, 执行测试程序 + # 预期结果 + # 控制台打印: + # GetSystemAbility result: success + driver.shell('hilog -r') + # 开始保存日志 + device_logger = DeviceLogger(driver).set_filter_string("Scheduler SA:1494") + device_logger.start_log(get_report_dir() + 'lifecycle_state_022_txt') + result = driver.System.execute_command("ondemand test 22") + assert "GetSystemAbility systemAbilityId:1494 faild" in result + # 停止日志 + device_logger.stop_log() + # 检查日志输出 + device_logger.check_log("Scheduler SA:1494 loaded", EXCEPTION=True) + + def teardown(self): + self.driver.System.execute_command("kill -9 `pidof listen_test`") + #self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") + #self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") + #self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") + #self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") + #self.driver.Storage.remove_file("/system/etc/init/listen_test.json") + #self.driver.Storage.remove_file("/system/bin/ondemand") + self.log.info("done") diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_023.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_023.json index 67b186e59bd9a2fe8ea209d01ba73906efe43128..6f311ec00a68f39157d38bcb806209ac1767c11a 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_023.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_023.json @@ -1,3 +1,16 @@ { - "description": "hypium自测试用例" -} \ No newline at end of file + "description": "hypium自测试用例", + "environment": [ + { + "type": "device", + "label": "phone" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "testcases/level1/lifecycle/lifecycle_state_023.py" + ] + }, + "kits":[] + } \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_023.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_023.py index df1907304fa6a39aa31e34838c86bfb0c4e9e3b8..7a158da7b1e262a04ff6c1e3d782fd5b7add037a 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_023.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_023.py @@ -15,7 +15,97 @@ # limitations under the License. import os +import time +from devicetest.core.test_case import TestCase +from devicetest.utils.file.file_util import get_resource_path +from hypium import UiExplore +from hypium.action.host import host +from hypium.action.os_hypium.device_logger import AsyncCommand +sa_lib_test_path = get_resource_path( + "resource/SO_RESOURCE/liblisten_test.z.so", + isdir=None) +sa_lib_ability_c_path = get_resource_path( + "resource/SO_RESOURCE/libtest_audio_ability.z.so", + isdir=None) + +sa_proxy_path = get_resource_path( + "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", + isdir=None) + +sa_listen_cfg_path = get_resource_path( + "resource/level/lifecycle_state_023/listen_test.cfg", + isdir=None) + +sa_listen_json_path = get_resource_path( + "resource/level/lifecycle_state_023/listen_test.json", + isdir=None) + +sa_ondemand_path = get_resource_path( + "resource/SO_RESOURCE/ondemand", + isdir=None) + +sa_tool_path = get_resource_path( + "resource/SO_RESOURCE/TestTool", + isdir=None) + + +class LifeCycle_State_023(TestCase): + + def __init__(self, controllers): + sele.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.tests = [ + "test_step" + ] + self.driver = UiExplore(self.driver1) + self.sn = self.driver1.device_sn + + def setup(self): + driver = self.driver + host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) + # host.shell("hdc -t {} target mount".format(self.sn)) + # driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") + # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") + # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") + # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") + # host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") + # host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") + # host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") + # host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) + # driver.System.reboot() + + def test_step(self): + driver = self.driver + # 用例同步 + # 执行"ondemand test 24"命令, 执行测试程序 + # 预期结果 + # 控制台打印: + # GetSystemAbility result: success + result = driver.System.execute_command("ondemand test 23") + assert "GetSystemAbility systemAbilityId:1494 faild" in result + + def teardown(self): + self.driver.System.execute_command("kill -9 `pidof listen_test`") + self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") + self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") + self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") + self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") + self.driver.Storage.remove_file("/system/etc/init/listen_test.json") + self.driver.Storage.remove_file("/system/bin/ondemand") + self.log.info("done") \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_024.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_024.json index 67b186e59bd9a2fe8ea209d01ba73906efe43128..fc00a077713132b64422303d0c5f2128c931810a 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_024.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_024.json @@ -1,3 +1,16 @@ { - "description": "hypium自测试用例" -} \ No newline at end of file + "description": "hypium自测试用例", + "environment": [ + { + "type": "device", + "label": "phone" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "testcases/level1/lifecycle/lifecycle_state_024.py" + ] + }, + "kits":[] + } \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_024.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_024.py index df1907304fa6a39aa31e34838c86bfb0c4e9e3b8..6bfb7238986bdff08efb1c9189fa1cc3670df8f2 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_024.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_024.py @@ -15,7 +15,97 @@ # limitations under the License. import os +import time +from devicetest.core.test_case import TestCase +from devicetest.utils.file.file_util import get_resource_path +from hypium import UiExplore +from hypium.action.host import host +from hypium.action.os_hypium.device_logger import AsyncCommand +sa_lib_test_path = get_resource_path( + "resource/SO_RESOURCE/liblisten_test.z.so", + isdir=None) +sa_lib_ability_c_path = get_resource_path( + "resource/SO_RESOURCE/libtest_audio_ability.z.so", + isdir=None) + +sa_proxy_path = get_resource_path( + "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", + isdir=None) + +sa_listen_cfg_path = get_resource_path( + "resource/level/lifecycle_state_024/listen_test.cfg", + isdir=None) + +sa_listen_json_path = get_resource_path( + "resource/level/lifecycle_state_024/listen_test.json", + isdir=None) + +sa_ondemand_path = get_resource_path( + "resource/SO_RESOURCE/ondemand", + isdir=None) + +sa_tool_path = get_resource_path( + "resource/SO_RESOURCE/TestTool", + isdir=None) + + +class LifeCycle_State_024(TestCase): + + def __init__(self, controllers): + sele.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.tests = [ + "test_step" + ] + self.driver = UiExplore(self.driver1) + self.sn = self.driver1.device_sn + + def setup(self): + driver = self.driver + host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) + # host.shell("hdc -t {} target mount".format(self.sn)) + # driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") + # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") + # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") + # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") + # host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") + # host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") + # host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") + # host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) + # driver.System.reboot() + + def test_step(self): + driver = self.driver + # 用例同步 + # 执行"ondemand test 24"命令, 执行测试程序 + # 预期结果 + # 控制台打印: + # GetSystemAbility result: success + result = driver.System.execute_command("ondemand test 24") + assert "GetSystemAbility systemAbilityId:1494 faild" in result + + def teardown(self): + self.driver.System.execute_command("kill -9 `pidof listen_test`") + self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") + self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") + self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") + self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") + self.driver.Storage.remove_file("/system/etc/init/listen_test.json") + self.driver.Storage.remove_file("/system/bin/ondemand") + self.log.info("done") \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_025.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_025.json index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..20c0df83f35c78f70696d705740d314116a8e6c7 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_025.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_025.json @@ -0,0 +1,16 @@ +{ + "description": "hypium自测试用例", + "environment": [ + { + "type": "device", + "label": "phone" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "testcases/level1/lifecycle/lifecycle_state_025.py" + ] + }, + "kits":[] + } \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_025.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_025.py index df1907304fa6a39aa31e34838c86bfb0c4e9e3b8..0a7419e5e39b09810ed208018b7181a4c1780c1f 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_025.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_025.py @@ -16,6 +16,99 @@ import os +from devicetest.core.test_case import TestCase +#导入时间 +import time +from devicetest.utils.file.file_util import get_resource_path +from hypium import UiExplore +from hypium.action.host import host +from hypium.action.os_hypium.device_logger import AsyncCommand +sa_lib_test_path = get_resource_path( + "resource/SO_RESOURCE/liblisten_test.z.so", + isdir=None) + +sa_lib_ability_c_path = get_resource_path( + "resource/SO_RESOURCE/libtest_audio_ability.z.so", + isdir=None) + +sa_proxy_path = get_resource_path( + "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", + isdir=None) + +sa_listen_cfg_path = get_resource_path( + "resource/level/lifecycle_state_025/listen_test.cfg", + isdir=None) + +sa_listen_json_path = get_resource_path( + "resource/level/lifecycle_state_025/listen_test.json", + isdir=None) + +sa_ondemand_path = get_resource_path( + "resource/SO_RESOURCE/ondemand", + isdir=None) + +sa_tool_path = get_resource_path( + "resource/SO_RESOURCE/TestTool", + isdir=None) + + +class LifeCycle_State_025(TestCase): + + def __init__(self, controllers): + sele.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.tests = [ + "test_step" + ] + self.driver = UiExplore(self.driver1) + self.sn = self.driver1.device_sn + + def setup(self): + driver = self.driver + host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) + # host.shell("hdc -t {} target mount".format(self.sn)) + # driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") + # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") + # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") + # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") + # host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") + # host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") + # host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") + # host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) + # driver.System.reboot() + + def test_step(self): + driver = self.driver + # 用例同步 + # 执行"ondemand test 24"命令, 执行测试程序 + # 预期结果 + # 控制台打印: + # GetSystemAbility result: success + result = driver.System.execute_command("ondemand test 25") + assert "GetSystemAbility systemAbilityId:1494 faild" in result + + def teardown(self): + self.driver.System.execute_command("kill -9 `pidof listen_test`") + self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") + self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") + self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") + self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") + self.driver.Storage.remove_file("/system/etc/init/listen_test.json") + self.driver.Storage.remove_file("/system/bin/ondemand") + self.log.info("done") + diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_026.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_026.json index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0a781e3a3e7c51ffcc100cb628a143edfe0e35a6 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_026.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_026.json @@ -0,0 +1,16 @@ +{ + "description": "hypium自测试用例", + "environment": [ + { + "type": "device", + "label": "phone" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "testcases/level1/lifecycle/lifecycle_state_026.py" + ] + }, + "kits":[] + } \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_026.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_026.py index df1907304fa6a39aa31e34838c86bfb0c4e9e3b8..50caf381e802558bd288537dc5e59e627398dc95 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_026.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_026.py @@ -19,3 +19,160 @@ import os +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- + +# Copyright (c) 2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time + +from hypium import UiExplore +from hypium.action.host import host +from hypium.action.os_hypium.device_logger import DeviceLogger +from devicetest.core.test_case import TestCase, CheckPoint, get_report_dir +from devicetest.utils.file.file_util import get_resource_path + +sa_lib_test_path = get_resource_path( + "resource/SO_RESOURCE/liblisten_test.z.so", + isdir=None) + +sa_lib_ability_c_path = get_resource_path( + "resource/SO_RESOURCE/libtest_audio_ability.z.so", + isdir=None) + +sa_proxy_path = get_resource_path( + "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", + isdir=None) + +sa_listen_cfg_path = get_resource_path( + "resource/level/lifecycle_state_026/listen_test.cfg", + isdir=None) + +sa_listen_json_path = get_resource_path( + "resource/level/lifecycle_state_026/listen_test.json", + isdir=None) + +sa_ondemand_path = get_resource_path( + "resource/SO_RESOURCE/ondemand", + isdir=None) + +sa_tool_path = get_resource_path( + "resource/SO_RESOURCE/TestTool", + isdir=None) + +sa_samgr_path = get_resource_path( + "resource/level/lifecycle/lifecycle_state_026/samgr.para", + isdir=None) + +sa_samgr_dac_path = get_resource_path( + "resource/level/lifecycle/lifecycle_state_026/samgr.para.dac", + isdir=None) + +sa_para_origin = get_resource_path( + "resource/origin_file/samgr.para", isdir=None) + +sa_para_dac_origin = get_resource_path( + "resource/origin_file/samgr.para.dac", isdir=None) + +class LifeCycle_State_026(TestCase): + + def __init__(self, controllers): + sele.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, controllers) + self.tests = [ + "test_step" + ] + self.driver = UiExplore(self.driver1) + self.sn = self.driver1.device_sn + + def setup(self): + driver = self.driver + host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) + # host.shell("hdc -t {} target mount".format(self.sn)) + # driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") + # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") + # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") + # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") + # host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") + # host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") + # host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") + # host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_samgr_path, device_path="/systemlib/etc/param") + # host.shell("hdc -t {} shell chmod 755 /system/etc/param/samgr.para".format(self.sn)) + + # driver.Storage.push_file(local_path=sa_samgr_dac_path, device_path="/systemlib/etc/param") + # host.shell("hdc -t {} shell chmod 755 /system/etc/param/samgr.para.dac".format(self.sn)) + # driver.System.reboot() + + def test_step(self): + driver = self.driver + # 用例同步 + # 执行"ondemand test 24"命令, 执行测试程序 + # 预期结果 + # 控制台打印: + # GetSystemAbility result: success + result = driver.System.execute_command("ondemand test 26") + assert "GetSystemAbility systemAbilityId:1494 faild" in result + # 1、打开日志目录 + # 2、关闭wifi (20s后卸载) + # 3、等待5s, hidumper -ls查看1494存在 + # 4、打开wifi出发加载, 移除延时卸载 + # 5、等待15s后hidumper -ls查看1494是否存在 + # 6、停止日志落盘, 查看Scheduler SA:1494 rm delay unlaod event + # + # driver = selef.driver + #device_logger = DeviceLogger(driver).set_filter_string("Scheduler") + #device_logger.start_log(get_report_dir() + '//lifecycle_state_026.txt') + # 打开WiFi + #driver.wifi.enable() + #time.sleep(10) + # #关闭WiFi + #driver.wifi.disable() + #time.sleep(5) + # #打开WiFi + #driver.wifi.enable() + #time.sleep(15) + #device_logger.stop_log() + #log_check_result = device_logger.check_log("Scheduler SA:1494 rm delay unlaod event", EXCEPTION=False) + #assert log_check_result is True + #result = driver.System.execute_command("hidumper -ls") + #assert "1494" in result + + def teardown(self): + self.driver.System.execute_command("kill -9 `pidof listen_test`") + self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") + self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") + self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") + self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") + self.driver.Storage.remove_file("/system/etc/init/listen_test.json") + self.driver.Storage.remove_file("/system/bin/ondemand") + self.driver.Storage.remove_file("/system/etc/param/samgr.para") + self.driver.Storage.remove_file("/system/etc/param/samgr.para.dac") + self.driver.Storage.push_file(local_path=sa_para_origin, device_path="/systemlib/etc/param") + self.driver.Storage.push_file(local_path=sa_para_dac_origin, device_path="/systemlib/etc/param") + self.log.info("清理动作: 关闭设置") + diff --git a/test/autotest/testcases/level1/networking/sub_samgr_sa_load_002.json b/test/autotest/testcases/level1/networking/sub_samgr_sa_load_002.json index 67b186e59bd9a2fe8ea209d01ba73906efe43128..c66143c40996e1b4fad1b316d9d0fcc5150bd939 100644 --- a/test/autotest/testcases/level1/networking/sub_samgr_sa_load_002.json +++ b/test/autotest/testcases/level1/networking/sub_samgr_sa_load_002.json @@ -1,3 +1,20 @@ { - "description": "hypium自测试用例" -} \ No newline at end of file + "description": "hypium自测试用例", + "environment": [ + { + "type": "device", + "label": "phone" + }, + { + "type": "device", + "label": "phone" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "testcases/level1/lifecycle/sub_samgr_sa_load_002.py" + ] + }, + "kits":[] + } \ No newline at end of file diff --git a/test/autotest/testcases/level1/networking/sub_samgr_sa_load_002.py b/test/autotest/testcases/level1/networking/sub_samgr_sa_load_002.py index 075418a7866520ab28b61f638694cf5b5f677bc0..fd28f67891131fb739e8be11043e6c45a798816e 100644 --- a/test/autotest/testcases/level1/networking/sub_samgr_sa_load_002.py +++ b/test/autotest/testcases/level1/networking/sub_samgr_sa_load_002.py @@ -15,3 +15,136 @@ # limitations under the License. import os +import time + +from devicetest.core.test_case import TestCase, setup, CheckPoint +from devicetest.utils.file.file_util import get_resource_path +from hypium import * +from hypium.action.host import host + +from aw import NetWorking + +sa_listen_cfg_path = get_resource_path( + "resource/level/networking/sub_samgr_sa_load_002/listen_test.cfg", + isdir=None) + +sa_listen_json_path = get_resource_path( + "resource/level/networking/sub_samgr_sa_load_002/listen_test.json", + isdir=None) + +sa_lib_test_path = get_resource_path( + "resource/SO_RESOURCE/liblisten_test.z.so", + isdir=None) + +sa_lib_ability_c_path = get_resource_path( + "resource/SO_RESOURCE/libtest_audio_ability.z.so", + isdir=None) + +sa_ondemand_path = get_resource_path( + "resource/SO_RESOURCE/ondemand", + isdir=None) + +sa_proxy_path = get_resource_path( + "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", + isdir=None) + + +class Sub_Samgr_SA_Load_002(TestCase): + + def __init__(self, configs): + sele.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, configs) + self.driver1 = UiDriver(self.device1) + self.driver1 = UiDriver(self.device2) + self.sn1 = self.device1.device_sn + self.sn1 = self.device2.device_sn + + def setup(self): + driver1 = self.driver1 + driver1 = self.driver1 + # host.shell()用来在pc端执行shell命令,亦可直接执行bat脚本(bat脚本中是push所需要的测试文件) + host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn1)) + host.shell("hdc -t {} target mount".format(self.sn1)) + driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") + host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn1)) + + driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") + host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn1)) + + driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") + host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn1) + + driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") + host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn1)) + + driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") + host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn1)) + + driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") + host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn1)) + + host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn2)) + host.shell("hdc -t {} target mount".format(self.sn2)) + driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") + host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn2)) + + driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") + host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn2)) + + driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") + host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn2) + + driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") + host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn2)) + + driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") + host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn2)) + + driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") + host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn2)) + + # # 设备A登录华为账号 + NetWorking.login_account(driver1) + # # 设备b登录华为账号 + NetWorking.login_account(driver2) + time.sleep(3) + #判断组网成功 + NetWorking.determine_newwork(driver1) + + def process(self): + driver1 = self.driver1 + driver2 = self.driver2 + # 步骤 + # 1、准备两台手机,通过wifi组上网络(自己手机开热点) + # 2、执行ondemand小包分别推测试文件到手机中 + # 3、执行hdc shell + # 4、执行ondemand, 然后执行sa,load, 1494 + + #预期结果 + # 5、本端设备cmd窗口显示succed, 远端设备通过hidumper -ls查找1494 + + driver1.System.execute_command("ondemand sa load 1494") + result1 = driver1.System.execute_command("hidumper -ls ") + assert "1494" in result1 + # 远端设备也查询到 + result2 = driver1.System.execute_command("hidumper -ls ") + assert "1494" in result2 + + def teardown(self): + self.driver.System.execute_command("kill -9 `pidof listen_test`") + host.shell("hdc -t {} target mount".format(self.sn1)) + self.driver1.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") + self.driver1.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") + self.driver1Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") + self.driver1.Storage.remove_file("/system/etc/init/listen_test.cfg") + self.driver1.Storage.remove_file("/system/etc/init/listen_test.json") + self.driver1.Storage.remove_file("/system/bin/ondemand") + + host.shell("hdc -t {} target mount".format(self.sn2)) + self.driver2.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") + self.driver2.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") + self.driver2.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") + self.driver2.Storage.remove_file("/system/etc/init/listen_test.cfg") + self.driver2.Storage.remove_file("/system/etc/init/listen_test.json") + self.driver2.Storage.remove_file("/system/bin/ondemand") + self.log.info("done") \ No newline at end of file diff --git a/test/autotest/testcases/level1/networking/sub_samgr_sa_once_001.json b/test/autotest/testcases/level1/networking/sub_samgr_sa_once_001.json index 67b186e59bd9a2fe8ea209d01ba73906efe43128..947357d19cc33393e108e5259149492b63593173 100644 --- a/test/autotest/testcases/level1/networking/sub_samgr_sa_once_001.json +++ b/test/autotest/testcases/level1/networking/sub_samgr_sa_once_001.json @@ -1,3 +1,20 @@ { - "description": "hypium自测试用例" -} \ No newline at end of file + "description": "hypium自测试用例", + "environment": [ + { + "type": "device", + "label": "phone" + }, + { + "type": "device", + "label": "phone" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "testcases/level1/lifecycle/sub_samgr_sa_once_001.py" + ] + }, + "kits":[] + } \ No newline at end of file diff --git a/test/autotest/testcases/level1/networking/sub_samgr_sa_once_001.py b/test/autotest/testcases/level1/networking/sub_samgr_sa_once_001.py index 4c677816309a3d588bc49ae8fb519b0d3a9232b8..dda9e322525706ff20fb6c583f89ca496fd42e79 100644 --- a/test/autotest/testcases/level1/networking/sub_samgr_sa_once_001.py +++ b/test/autotest/testcases/level1/networking/sub_samgr_sa_once_001.py @@ -14,4 +14,154 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os \ No newline at end of file +import os +import time + +from devicetest.core.test_case import TestCase +from devicetest.utils.file.file_util import get_resource_path +from hypium import * +from hypium.action.host import host + +from aw import NetWorking + +sa_listen_cfg_path = get_resource_path( + "resource/level/networking/sub_samgr_sa_load_002/listen_test.cfg", + isdir=None) + +sa_listen_json_path = get_resource_path( + "resource/level/networking/sub_samgr_sa_load_002/listen_test.json", + isdir=None) + +sa_lib_test_path = get_resource_path( + "resource/SO_RESOURCE/liblisten_test.z.so", + isdir=None) + +sa_lib_ability_c_path = get_resource_path( + "resource/SO_RESOURCE/libtest_audio_ability.z.so", + isdir=None) + +sa_ondemand_path = get_resource_path( + "resource/SO_RESOURCE/ondemand", + isdir=None) + +sa_proxy_path = get_resource_path( + "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", + isdir=None) + + +class Sub_Samgr_SA_Load_002(TestCase): + + def __init__(self, configs): + sele.TAG = self.__class__.__name__ + TestCase.__init__(self, self.TAG, configs) + self.driver1 = UiDriver(self.device1) + self.driver1 = UiDriver(self.device2) + self.sn1 = self.device1.device_sn + self.sn1 = self.device2.device_sn + + def setup(self): + driver = self.driver1 + driver.Wifi.disable() + driver.Bluetooth.disable() #避免开始就组网成功 + # host.shell()用来在pc端执行shell命令,亦可直接执行bat脚本(bat脚本中是push所需要的测试文件) + host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn1)) + # 推入资源文件进入设备 + host.shell("hdc -t {} target mount".format(self.sn1)) + driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") + host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn1)) + + driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") + host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn1)) + + driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") + host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn1)) + + driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") + host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn2)) + + driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") + host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn1)) + + driver2 = self.driver2 + host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn2)) + # 推入资源文件进入设备 + host.shell("hdc -t {} target mount".format(self.sn2)) + driver2.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") + host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn2)) + + driver2.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") + host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn2)) + + driver2.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") + host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn2)) + + driver2.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") + host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn2)) + + driver2.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") + host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn2)) + + driver.System.reboot() + driver2.System.reboot() + + + def process(self): + # 执行步骤 + #1、执行push.bat脚本, 推入once - online测试资源 + #2、组网后hidumper-ls查看 + #3、wifi断开后hidumper -ls再次查看 + #4、组网后hidumper-ls再次查看 + #5、wifi断开后hidumper -ls再次查看 + + # 预期结果 + #1、DistributedDeviceProfile存在 + #2、20s后DistributedDeviceProfile不存在 + #3、DistributedDeviceProfile存在 + #4、DistributedDeviceProfile存在 + + #3 + # 设备A断开wifi蓝牙 + driver.wifi.disable() + driver.Bluetooth.disable() + time.sleep(25) + # 判断组网成功 + NetWorking.determine_newwork(driver) + result = driver1.System.execute_command("hidumper -ls ") + assert "1494" in result + + #4 + driver.wifi.disable() + driver.Bluetooth.disable() + time.sleep(50) + # 判断组网成功 + NetWorking.determine_newwork(driver) + result = driver1.System.execute_command("hidumper -ls ") + assert "1494" in result + + #5 + # 设备A断开蓝牙wifi + driver.wifi.disable() + driver.Bluetooth.disable() + time.sleep(25) + result = driver1.System.execute_command("hidumper -ls ") + assert "1494" in result + + def teardown(self): + self.driver1.System.execute_command("kill -9 `pidof listen_test`") + host.shell("hdc -t {} target mount".format(self.sn1)) + self.driver1.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") + self.driver1.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") + self.driver1Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") + self.driver1.Storage.remove_file("/system/etc/init/listen_test.cfg") + self.driver1.Storage.remove_file("/system/etc/init/listen_test.json") + self.driver1.Storage.remove_file("/system/bin/ondemand") + + self.driver2.System.execute_command("kill -9 `pidof listen_test`") + host.shell("hdc -t {} target mount".format(self.sn2)) + self.driver2.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") + self.driver2.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") + self.driver2.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") + self.driver2.Storage.remove_file("/system/etc/init/listen_test.cfg") + self.driver2.Storage.remove_file("/system/etc/init/listen_test.json") + self.driver2.Storage.remove_file("/system/bin/ondemand") + self.log.info("done") \ No newline at end of file