diff --git a/test/autotest/tools/disk_drop_log.py b/test/autotest/aw/disk_drop_log.py similarity index 92% rename from test/autotest/tools/disk_drop_log.py rename to test/autotest/aw/disk_drop_log.py index 4bfa33e451994a9b977ed6ee0f04e33aad959800..494355b4301e140729bd3c87d02313e8e523a521 100644 --- a/test/autotest/tools/disk_drop_log.py +++ b/test/autotest/aw/disk_drop_log.py @@ -1,75 +1,75 @@ -#!/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 os -from hypium.action.host import host - - -def pulling_disk_dropping_logs(path, sn): - """ - @func: Pull and drop logs to disk - @param: path: Path of log disk storage - @param: sn: device SN - """ - host.shell(f"hdc -t {sn} file recv data/log/hilog/ {path}") - - -def parse_disk_dropping_logs(path): - """ - @func: Analyze log storage on disk - @param path: log path - """ - host.shell(f"hilog parse -i {path} -d {path}") - - -def count_keys_disk_dropping_logs(path, keys) -> int: - """ - @func: count the number of occurrences of shutdown words in the log disk - @param path: log download path - @param keys: Keywords to be queried - @return: The number of times the keyword to be queried appears - """ - list_count = [0] - dirs = os.listdir(path) - for file in dirs: - if file.endswith(".txt"): - with open(f"{path}/{file}", "r", encoding="utf-8", errors="ignore") as read_file: - count = read_file.read().count(keys) - list_count.append(count) - return sum(list_count) - - -def check_disk_dropping_logs(path, keys) -> bool: - """ - @func: judge whether a certain keyword exists - @param path: log path - @param keys: Keywords to be queried - @return: whether a certain keyword exists - """ - - flag = False - dirs = os.listdir(path) - for file in dirs: - if file.endswith(".txt"): - with open(f"{path}/{file}", "r", encoding="utf-8", errors="ignore") as read_file: - for line in read_file.readlines(): - result = line.find(keys) - if result != -1: - flag = True - break - if flag: - break - return flag +#!/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 os +from hypium.action.host import host + + +def pulling_disk_dropping_logs(path, driver): + """ + @func: Pull and drop logs to disk + @param: path: Path of log disk storage + @param: sn: device SN + """ + result = driver.hdc(f"file recv data/log/hilog/ {path}"") + + +def parse_disk_dropping_logs(path): + """ + @func: Analyze log storage on disk + @param path: log path + """ + host.shell(f"hilog parse -i {path} -d {path}") + + +def count_keys_disk_dropping_logs(path, keys) -> int: + """ + @func: count the number of occurrences of shutdown words in the log disk + @param path: log download path + @param keys: Keywords to be queried + @return: The number of times the keyword to be queried appears + """ + list_count = [0] + dirs = os.listdir(path) + for file in dirs: + if file.endswith(".txt"): + with open(f"{path}/{file}", "r", encoding="utf-8", errors="ignore") as read_file: + count = read_file.read().count(keys) + list_count.append(count) + return sum(list_count) + + +def check_disk_dropping_logs(path, keys) -> bool: + """ + @func: judge whether a certain keyword exists + @param path: log path + @param keys: Keywords to be queried + @return: whether a certain keyword exists + """ + + flag = False + dirs = os.listdir(path) + for file in dirs: + if file.endswith(".txt"): + with open(f"{path}/{file}", "r", encoding="utf-8", errors="ignore") as read_file: + for line in read_file.readlines(): + result = line.find(keys) + if result != -1: + flag = True + break + if flag: + break + return flag diff --git a/test/autotest/tools/get_source_path.py b/test/autotest/aw/get_source_path.py similarity index 91% rename from test/autotest/tools/get_source_path.py rename to test/autotest/aw/get_source_path.py index 5cbdcef5dee661ef1806f805560ab93d4a77ab72..2a7e3c1125e78306cdd72eee5e9875e8a8dc705e 100644 --- a/test/autotest/tools/get_source_path.py +++ b/test/autotest/aw/get_source_path.py @@ -1,89 +1,83 @@ -#!/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. - -from devicetest.utils.file_util import get_resource_path - - -def get_source_path(need_source, casename): - """ - @func: get the resource path required for a case - @param need_source: the resources required for a case - @param casename: the case name - @return: source absolute paths - """ - - source_path = {} - if need_source["cfg"]: - cfg_relative_path = "resource/" + casename + "/listen_test.cfg" - json_relative_path = "resource/" + casename + "/listen_test.json" - sa_listen_cfg_path = get_resource_path( - cfg_relative_path, - isdir=None) - sa_listen_json_path = get_resource_path( - json_relative_path, - isdir=None) - source_path["sa_listen_cfg_path"] = sa_listen_cfg_path - source_path["sa_listen_json_path"] = sa_listen_json_path - - if need_source["fwk"]: - sa_lib_fwk_path = get_resource_path( - "resource/soResource/libsystem_ability_fwk.z.so", - isdir=None) - source_path["sa_lib_fwk_path"] = sa_lib_fwk_path - - if need_source["listen_test"]: - sa_lib_listen_test_path = get_resource_path( - "resource/soResource/liblisten_test.z.so", - isdir=None) - source_path["sa_lib_listen_test_path"] = sa_lib_listen_test_path - - if need_source["audio_ability"]: - sa_lib_audio_ability = get_resource_path( - "resource/soResource/libtest_audio_ability.z.so", - isdir=None) - source_path["sa_lib_audio_ability"] = sa_lib_audio_ability - - if need_source["ondemand"]: - sa_ondemand_path = get_resource_path( - "resource/soResource/ondemand", - isdir=None) - source_path["sa_ondemand_path"] = sa_ondemand_path - - if need_source["proxy"]: - sa_proxy_path = get_resource_path( - "resource/soResource/libtest_sa_proxy_cache.z.so", - isdir=None) - source_path["sa_proxy_path"] = sa_proxy_path - - if need_source["para"]: - sa_para_path = get_resource_path( - "resource/level0/case13_param001/samgr.para", - isdir=None) - sa_para_dac_path = get_resource_path( - "resource/level0/case13_param001/samgr.para.dac", - isdir=None) - sa_para_origin = get_resource_path( - "resource/originFile/samgr.para", - isdir=None) - sa_para_dac_origin = get_resource_path( - "resource/originFile/samgr.para.dac", - isdir=None) - source_path["sa_para_path"] = sa_para_path - source_path["sa_para_dac_path"] = sa_para_dac_path - source_path["sa_para_origin"] = sa_para_origin - source_path["sa_para_dac_origin"] = sa_para_dac_origin - - return source_path +#!/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. + +from devicetest.utils.file_util import get_resource_path + + +def get_source_path(need_source, casename): + """ + @func: get the resource path required for a case + @param need_source: the resources required for a case + @param casename: the case name + @return: source absolute paths + """ + + source_path = {} + if need_source["cfg"]: + cfg_relative_path = "resource/" + casename + "/listen_test.cfg" + json_relative_path = "resource/" + casename + "/listen_test.json" + sa_listen_cfg_path = get_resource_path( + cfg_relative_path, + isdir=None) + sa_listen_json_path = get_resource_path( + json_relative_path, + isdir=None) + source_path["sa_listen_cfg_path"] = sa_listen_cfg_path + source_path["sa_listen_json_path"] = sa_listen_json_path + + if need_source["listen_test"]: + sa_lib_listen_test_path = get_resource_path( + "resource/soResource/liblisten_test.z.so", + isdir=None) + source_path["sa_lib_listen_test_path"] = sa_lib_listen_test_path + + if need_source["audio_ability"]: + sa_lib_audio_ability = get_resource_path( + "resource/soResource/libtest_audio_ability.z.so", + isdir=None) + source_path["sa_lib_audio_ability"] = sa_lib_audio_ability + + if need_source["ondemand"]: + sa_ondemand_path = get_resource_path( + "resource/soResource/ondemand", + isdir=None) + source_path["sa_ondemand_path"] = sa_ondemand_path + + if need_source["proxy"]: + sa_proxy_path = get_resource_path( + "resource/soResource/libtest_sa_proxy_cache.z.so", + isdir=None) + source_path["sa_proxy_path"] = sa_proxy_path + + if need_source["para"]: + sa_para_path = get_resource_path( + "resource/level0/case13_param001/samgr.para", + isdir=None) + sa_para_dac_path = get_resource_path( + "resource/level0/case13_param001/samgr.para.dac", + isdir=None) + sa_para_origin = get_resource_path( + "resource/originFile/samgr.para", + isdir=None) + sa_para_dac_origin = get_resource_path( + "resource/originFile/samgr.para.dac", + isdir=None) + source_path["sa_para_path"] = sa_para_path + source_path["sa_para_dac_path"] = sa_para_dac_path + source_path["sa_para_origin"] = sa_para_origin + source_path["sa_para_dac_origin"] = sa_para_dac_origin + + return source_path diff --git a/test/autotest/tools/push_remove_source.py b/test/autotest/aw/push_remove_source.py similarity index 67% rename from test/autotest/tools/push_remove_source.py rename to test/autotest/aw/push_remove_source.py index 5faeefaa9fc63563af5df0cea9e58c3a3464ff8e..5752b665fa90f62ac8a968ecb3629504b7ab1787 100644 --- a/test/autotest/tools/push_remove_source.py +++ b/test/autotest/aw/push_remove_source.py @@ -1,99 +1,92 @@ -#!/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. - -from hypium.action.host import host - - -def push_source(source_path, driver, sn, update_param=False): - """ - @func: push resources to devices - @param source_path: the path of resources required by a case - @param driver: the device - @param sn: device sn - """ - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(sn)) - host.shell("hdc -t {} target mount".format(sn)) - host.shell("hdc -t {} shell rm -r /data/log/hilog".format(sn)) - host.shell("hdc -t {} shell hilog -d /system/bin/samgr".format(sn)) - if "sa_listen_cfg_path" in source_path: - driver.Storage.push_file(local_path=source_path["sa_listen_cfg_path"], device_path="/system/etc/init") - host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(sn)) - driver.Storage.push_file(local_path=source_path["sa_listen_json_path"], device_path="/system/profile/") - host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(sn)) - - if "sa_lib_listen_test_path" in source_path: - driver.Storage.push_file(local_path=source_path["sa_lib_listen_test_path"], device_path="/system/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/liblisten_test.z.so".format(sn)) - - if "sa_proxy_path" in source_path: - driver.Storage.push_file(local_path=source_path["sa_proxy_path"], device_path="/system/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/libtest_sa_proxy.z.so".format(sn)) - - if "sa_lib_fwk_path" in source_path: - driver.Storage.push_file(local_path=source_path["sa_lib_fwk_path"], device_path="/system/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/libsystem_ability_fwk.z.so".format(sn)) - - if "sa_lib_audio_ability" in source_path: - driver.Storage.push_file(local_path=source_path["sa_lib_audio_ability"], device_path="/system/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/libtest_audio_ability.z.so".format(sn)) - - if "sa_ondemand_path" in source_path: - driver.Storage.push_file(local_path=source_path["sa_ondemand_path"], device_path="/system/bin/") - host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(sn)) - - if "sa_para_path" in source_path: - driver.Storage.push_file(local_path=source_path["sa_para_path"], device_path="/system/etc/param/") - host.shell("hdc -t {} shell chmod 755 /system/etc/param/samgr.para".format(sn)) - driver.Storage.push_file(local_path=source_path["sa_para_dac_path"], device_path="/system/etc/param/") - host.shell("hdc -t {} shell chmod 755 /system/etc/param/samgr.para.dac".format(sn)) - if update_param: - driver.System.execute_command("ondemand param true") - driver.System.reboot() - - -def remove_source(source_path, driver, sn): - """ - @func: push resources from devices - @param source_path: the path of resources required by a case - @param driver: the device - @param sn: device sn - """ - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(sn)) - host.shell("hdc -t {} target mount".format(sn)) - if "sa_listen_cfg_path" in source_path: - driver.Storage.remove_file("/system/etc/init/listen_test.cfg") - driver.Storage.remove_file("/system/etc/init/listen_test.json") - - if "sa_lib_listen_test_path" in source_path: - driver.Storage.remove_file("/system/lib/liblisten_test.z.so") - - if "sa_proxy_path" in source_path: - driver.Storage.remove_file("/system/lib/libtest_sa_proxy.z.so") - - if "sa_lib_fwk_path" in source_path: - driver.Storage.remove_file("/system/lib/libsystem_ability_fwk.z.so") - - if "sa_lib_audio_ability" in source_path: - driver.Storage.remove_file("/system/lib/libtest_audio_ability.z.so") - - if "sa_ondemand_path" in source_path: - driver.Storage.remove_file("/system/bin/ondemand") - - if "sa_para_path" in source_path: - driver.Storage.remove_file("/system/etc/param/samgr.para") - driver.Storage.remove_file("/system/etc/param/samgr.para.dac") - driver.Storage.push_file(local_path=source_path["sa_para_origin"], device_path="/system/etc/param/") - driver.Storage.push_file(local_path=source_path["sa_para_dac_origin"], device_path="/system/etc/param/") +#!/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. + + +def push_source(source_path, driver, sn, update_param=False): + """ + @func: push resources to devices + @param source_path: the path of resources required by a case + @param driver: the device + @param sn: device sn + """ + driver.shell("kill -9 `pidof listen_test`") + driver.shell("target mount") + driver.shell("rm -r /data/log/hilog") + driver.shell("hilog -d /system/bin/samgr") + if "sa_listen_cfg_path" in source_path: + driver.Storage.push_file(local_path=source_path["sa_listen_cfg_path"], device_path="/system/etc/init") + driver.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(sn)) + driver.Storage.push_file(local_path=source_path["sa_listen_json_path"], device_path="/system/profile/") + driver.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(sn)) + + if "sa_lib_listen_test_path" in source_path: + driver.Storage.push_file(local_path=source_path["sa_lib_listen_test_path"], device_path="/system/lib/") + driver.shell("hdc -t {} shell chmod 644 /system/lib/liblisten_test.z.so".format(sn)) + + if "sa_proxy_path" in source_path: + driver.Storage.push_file(local_path=source_path["sa_proxy_path"], device_path="/system/lib/") + driver.shell("hdc -t {} shell chmod 644 /system/lib/libtest_sa_proxy.z.so".format(sn)) + + + if "sa_lib_audio_ability" in source_path: + driver.Storage.push_file(local_path=source_path["sa_lib_audio_ability"], device_path="/system/lib/") + driver.shell("hdc -t {} shell chmod 644 /system/lib/libtest_audio_ability.z.so".format(sn)) + + if "sa_ondemand_path" in source_path: + driver.Storage.push_file(local_path=source_path["sa_ondemand_path"], device_path="/system/bin/") + driver.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(sn)) + + if "sa_para_path" in source_path: + driver.Storage.push_file(local_path=source_path["sa_para_path"], device_path="/system/etc/param/") + driver.shell("hdc -t {} shell chmod 755 /system/etc/param/samgr.para".format(sn)) + driver.Storage.push_file(local_path=source_path["sa_para_dac_path"], device_path="/system/etc/param/") + driver.shell("hdc -t {} shell chmod 755 /system/etc/param/samgr.para.dac".format(sn)) + if update_param: + driver.System.execute_command("ondemand param true") + driver.System.reboot() + + +def remove_source(source_path, driver, sn): + """ + @func: push resources from devices + @param source_path: the path of resources required by a case + @param driver: the device + @param sn: device sn + """ + driver.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(sn)) + driver.shell("hdc -t {} target mount".format(sn)) + if "sa_listen_cfg_path" in source_path: + driver.Storage.remove_file("/system/etc/init/listen_test.cfg") + driver.Storage.remove_file("/system/etc/init/listen_test.json") + + if "sa_lib_listen_test_path" in source_path: + driver.Storage.remove_file("/system/lib/liblisten_test.z.so") + + if "sa_proxy_path" in source_path: + driver.Storage.remove_file("/system/lib/libtest_sa_proxy.z.so") + + + if "sa_lib_audio_ability" in source_path: + driver.Storage.remove_file("/system/lib/libtest_audio_ability.z.so") + + if "sa_ondemand_path" in source_path: + driver.Storage.remove_file("/system/bin/ondemand") + + if "sa_para_path" in source_path: + driver.Storage.remove_file("/system/etc/param/samgr.para") + driver.Storage.remove_file("/system/etc/param/samgr.para.dac") + driver.Storage.push_file(local_path=source_path["sa_para_origin"], device_path="/system/etc/param/") + driver.Storage.push_file(local_path=source_path["sa_para_dac_origin"], device_path="/system/etc/param/") diff --git a/test/autotest/resource/level0/case24_sub001/listen_test.cfg b/test/autotest/resource/level0/case24_sub001/listen_test.cfg index cb4036c27a507a2152a52b5415024272e41ac91d..10a8006ef49221f42f0b19f4792beed1ec51a301 100644 --- a/test/autotest/resource/level0/case24_sub001/listen_test.cfg +++ b/test/autotest/resource/level0/case24_sub001/listen_test.cfg @@ -2,7 +2,7 @@ "services":[{ "name":"listen_test", "path":["/system/bin/sa_main","/system/profile/listen_test.json"], - "ondemand":true, + "ondemand":false, "secon":"u:r:listen_test:s0", "permission":["ohos.permission.DISTRIBUTED_DATASYNC"], "uid":"system", diff --git a/test/autotest/resource/level0/case24_sub001/listen_test.json b/test/autotest/resource/level0/case24_sub001/listen_test.json index 858e41608de8ac430c380af88cbc1df12e77fdad..87c91a16c1d7ab77fcac97361ec3f36a2485f446 100644 --- a/test/autotest/resource/level0/case24_sub001/listen_test.json +++ b/test/autotest/resource/level0/case24_sub001/listen_test.json @@ -6,29 +6,14 @@ "libpath": "liblisten_test.z.so", "run-on-create": true, "distributed": true, - "dump_level": 1, - "start-on-demand": { - "commonevent": [ - { - "name": "usual.event.SCREEN_ON", - "value": "" - } - ] - } + "dump_level": 1 }, { "name": 1499, "libpath": "libtest_audio_ability.z.so", "run-on-create": true, "distributed": true, - "dump_level": 1, - "start-on-demand": { - "commonevent": [ - { - "name": "usual.event.SCREEN_ON" - } - ] - } + "dump_level": 1 } ] } \ No newline at end of file diff --git a/test/autotest/resource/soResource/ReadMe.md b/test/autotest/resource/soResource/ReadMe.md index 7cf4b8f5b5c684ec55b61456f457c79e2d5e24ba..ce32bf0d4fa6b8d69ced3e37750d96ffcdf05424 100644 --- a/test/autotest/resource/soResource/ReadMe.md +++ b/test/autotest/resource/soResource/ReadMe.md @@ -1,6 +1,5 @@ Resource products that need to be compiled: 1. liblisten_test.z.so -2. libsystem_ability_fwk.z.so -3. libtest_audio_ability.z.so -4. libtest_sa_proxy_cache.z.so -5. ondemand \ No newline at end of file +2. libtest_audio_ability.z.so +3. libtest_sa_proxy_cache.z.so +4. ondemand \ No newline at end of file diff --git a/test/autotest/testcases/level0/case01_listen001.json b/test/autotest/testcases/level0/case01_listen001.json index eea020477b0c86200fda05c44378a019d008f8ad..389dab0670252306a73e19995b2ff630d4f199ec 100644 --- a/test/autotest/testcases/level0/case01_listen001.json +++ b/test/autotest/testcases/level0/case01_listen001.json @@ -2,8 +2,7 @@ "description": "Kill a process, check process registration and death listening", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case01_listen001.py b/test/autotest/testcases/level0/case01_listen001.py index 65e41a79dc44c8e0c76cb90782c8943c4f1619b5..8e547e02988aa600c53e05adfa311f003790d3eb 100644 --- a/test/autotest/testcases/level0/case01_listen001.py +++ b/test/autotest/testcases/level0/case01_listen001.py @@ -18,7 +18,6 @@ from devicetest.core.test_case import TestCase, CheckPoint, get_report_dir from hypium import UiDriver import time from hypium.action.os_hypium.device_logger import DeviceLogger -from hypium.action.host import host class case01_listen001(TestCase): @@ -34,20 +33,20 @@ class case01_listen001(TestCase): def setup(self): self.log.info("case01_listen001 start") - host.shell("hdc -t {} shell rm -r /data/log/hilog".format(self.sn)) - host.shell("hdc -t {} shell hilog -d /system/bin/samgr".format(self.sn)) + self.driver.shell("hdc -t {} shell rm -r /data/log/hilog".format(self.sn)) + self.driver.shell("hdc -t {} shell hilog -d /system/bin/samgr".format(self.sn)) def test_step(self): driver = self.driver device_logger = DeviceLogger(driver).set_filter_string("01800") device_logger.start_log(get_report_dir() + "//case01_listen001.txt") - driver.System.execute_command("ps -e |grep distributedata") - driver.System.execute_command("kill -9 `pidof distributeddata`") + driver.System.execute_command("ps -e |grep resource_schedule_service") + driver.System.execute_command("kill -9 `resource_schedule_service`") time.sleep(2) device_logger.stop_log() - CheckPoint("'AddProc:distributeddata and rm DeadProc:distributeddata' is present in the logs") - device_logger.check_log("AddProc:distributeddata", EXCEPTION=True) - device_logger.check_log("rm DeadProc:distributeddata", EXCEPTION=True) + CheckPoint("'AddProc:resource_schedule_service and rm DeadProc:resource_schedule_service' is present in the logs") + device_logger.check_log("AddProc:resource_schedule_service", EXCEPTION=True) + device_logger.check_log("rm DeadProc:resource_schedule_service", EXCEPTION=True) def teardown(self): self.log.info("case01_listen001 down") diff --git a/test/autotest/testcases/level0/case02_load001.json b/test/autotest/testcases/level0/case02_load001.json index 39ebd53415569f061c71537d25339b98e4c35787..e692760d0a193b325e42b4c1561b67cb1e8de78d 100644 --- a/test/autotest/testcases/level0/case02_load001.json +++ b/test/autotest/testcases/level0/case02_load001.json @@ -2,8 +2,7 @@ "description": "Load local verification", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case02_load001.py b/test/autotest/testcases/level0/case02_load001.py index 0fadea522888581a3aa7106f989070a5e84cc606..f2e9f4b4112611fce93c7cd5348018422cf30a72 100644 --- a/test/autotest/testcases/level0/case02_load001.py +++ b/test/autotest/testcases/level0/case02_load001.py @@ -14,10 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source, remove_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case02_load001(TestCase): @@ -34,8 +43,8 @@ class case02_load001(TestCase): def setup(self): self.log.info("case02_load001 start") - need_source = {"cfg": True, "fwk": False, "listen_test": True, "audio_ability": True, "ondemand": True, - "proxy": True, "para": False} + need_source = {"cfg": True, "listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": False} self.source_path = get_source_path(need_source=need_source, casename="level0/case02_load001") push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) diff --git a/test/autotest/testcases/level0/case03_get001.json b/test/autotest/testcases/level0/case03_get001.json index e736b1d7ee564287e210f2c57d8f666cda560767..93b43c67e04f0676b2751a42d3d33fc56d333ad6 100644 --- a/test/autotest/testcases/level0/case03_get001.json +++ b/test/autotest/testcases/level0/case03_get001.json @@ -2,8 +2,7 @@ "description": "Get local failed validation", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case03_get001.py b/test/autotest/testcases/level0/case03_get001.py index 9a49b57ec841c71ddf38669c1f2323d72c08ddc4..9361ad829b6eb4691147151e30c903577ebd24ab 100644 --- a/test/autotest/testcases/level0/case03_get001.py +++ b/test/autotest/testcases/level0/case03_get001.py @@ -14,10 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case03_get001(TestCase): @@ -34,8 +43,8 @@ class case03_get001(TestCase): def setup(self): self.log.info("case03_get001 start") - need_source = {"cfg": True, "fwk": False, "listen_test": True, "audio_ability": False, "ondemand": True, - "proxy": True, "para": False} + need_source = {"cfg": True, "listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": False} self.source_path = get_source_path(need_source=need_source, casename="level0/case03_get001") push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) @@ -46,4 +55,5 @@ class case03_get001(TestCase): assert "GetSystemAbility systemAbilityId:100 failed !" in result def teardown(self): + remove_source(source_path=self.source_path, driver=self.driver, sn=self.sn) self.log.info("case003_get001 down") diff --git a/test/autotest/testcases/level0/case04_get002.json b/test/autotest/testcases/level0/case04_get002.json index c7ad5b0ac907bc355e39253fd230c68a59752257..58508a98745035387387450d81386db66d2818f7 100644 --- a/test/autotest/testcases/level0/case04_get002.json +++ b/test/autotest/testcases/level0/case04_get002.json @@ -2,8 +2,7 @@ "description": "Get local successful verification", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case04_get002.py b/test/autotest/testcases/level0/case04_get002.py index 8cf1ed7524780b19fa0f0ca675bd5191f5086458..ba3cbc29627939c313ebf144925b08f84323f1e1 100644 --- a/test/autotest/testcases/level0/case04_get002.py +++ b/test/autotest/testcases/level0/case04_get002.py @@ -14,10 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import remove_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case04_get002(TestCase): @@ -33,6 +42,10 @@ class case04_get002(TestCase): def setup(self): self.log.info("case04_get002 start") + need_source = {"cfg": True, "listen_test": False, "audio_ability": False, "ondemand": True, + "proxy": True, "para": False} + source_path = get_source_path(need_source=need_source, casename="level0/case04_get002") + push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) def test_step(self): driver = self.driver @@ -42,8 +55,5 @@ class case04_get002(TestCase): assert "GetSystemAbility result: success" in result def teardown(self): - need_source = {"cfg": True, "fwk": False, "listen_test": True, "audio_ability": False, "ondemand": True, - "proxy": True, "para": False} - source_path = get_source_path(need_source=need_source, casename="level0/case03_get001") - remove_source(source_path=source_path, driver=self.driver, sn=self.sn) + remove_source(source_path=self.source_path, driver=self.driver, sn=self.sn) self.log.info("case04_get002 down") diff --git a/test/autotest/testcases/level0/case05_init001.json b/test/autotest/testcases/level0/case05_init001.json index aecffb19449eb4ca8a43aa81909a6b480785f321..82f1beb824d766adbaf574074634c414b4d3b3ed 100644 --- a/test/autotest/testcases/level0/case05_init001.json +++ b/test/autotest/testcases/level0/case05_init001.json @@ -2,8 +2,7 @@ "description": "Check if the system can detect startup events", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case05_init001.py b/test/autotest/testcases/level0/case05_init001.py index 379c76de22055e378660386ad2619a5e2a2b80ba..8618247d221cd5bf18790f66b165cf03f1ce1e53 100644 --- a/test/autotest/testcases/level0/case05_init001.py +++ b/test/autotest/testcases/level0/case05_init001.py @@ -16,7 +16,6 @@ from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from hypium.action.host import host class case05_init001(TestCase): @@ -32,7 +31,7 @@ class case05_init001(TestCase): def setup(self): self.log.info("case05_init001 start") - host.shell("hdc -t {} shell rm -r /data/log/hilog".format(self.sn)) + self.driver.shell("hdc -t {} shell rm -r /data/log/hilog".format(self.sn)) def test_step(self): driver = self.driver diff --git a/test/autotest/testcases/level0/case06_commonevent001.json b/test/autotest/testcases/level0/case06_commonevent001.json index 289ab959aec8df629fe317971289fbe199903592..28fa0b4435a97de40a665b61a8d2f09eff983915 100644 --- a/test/autotest/testcases/level0/case06_commonevent001.json +++ b/test/autotest/testcases/level0/case06_commonevent001.json @@ -2,8 +2,7 @@ "description": "The broadcast plugin is functioning properly", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case06_commonevent001.py b/test/autotest/testcases/level0/case06_commonevent001.py index 856e9e9be758a169e388c40ab7a955558bee3b2b..368ea0709630ac64d82380300603d2632bbd3af4 100644 --- a/test/autotest/testcases/level0/case06_commonevent001.py +++ b/test/autotest/testcases/level0/case06_commonevent001.py @@ -14,10 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source, remove_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case06_commonevent001(TestCase): @@ -34,7 +43,7 @@ class case06_commonevent001(TestCase): def setup(self): self.log.info("case06_commonevent001 start") - need_source = {"cfg": True, "fwk": False, "listen_test": True, "audio_ability": False, "ondemand": True, + need_source = {"cfg": True, "listen_test": False, "audio_ability": False, "ondemand": False, "proxy": True, "para": False} self.source_path = get_source_path(need_source=need_source, casename="level0/case06_commonevent001") push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) diff --git a/test/autotest/testcases/level0/case07_once002.json b/test/autotest/testcases/level0/case07_once002.json index 00a1a183fcfb083c7ba9032c359ad05dbb02536f..7aea6a68e29ab5a82556ce8aaee44b12efa20e81 100644 --- a/test/autotest/testcases/level0/case07_once002.json +++ b/test/autotest/testcases/level0/case07_once002.json @@ -2,8 +2,7 @@ "description": "Only effective once for normal use (timer)", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case07_once002.py b/test/autotest/testcases/level0/case07_once002.py index c2ce52d9ad314111143fc00de39a4941db1b3e4c..0c3ef6fa8eeb00fddf8ef23717b439be8618a7ac 100644 --- a/test/autotest/testcases/level0/case07_once002.py +++ b/test/autotest/testcases/level0/case07_once002.py @@ -14,11 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + import time from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source, remove_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case07_once002(TestCase): @@ -35,8 +44,8 @@ class case07_once002(TestCase): def setup(self): self.log.info("case07_once002 start") - need_source = {"cfg": True, "fwk": False, "listen_test": True, "audio_ability": False, "ondemand": True, - "proxy": True, "para": False} + need_source = {"cfg": True, "listen_test": False, "audio_ability": False, "ondemand": True, + "proxy": False, "para": False} self.source_path = get_source_path(need_source=need_source, casename="level0/case07_once002") push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) diff --git a/test/autotest/testcases/level0/case08_once003.json b/test/autotest/testcases/level0/case08_once003.json index 33d309c5aa4d531aa3c186a38c9e678e76c7a8d9..0e0c20bba69e0c2a405161f07ad939478dfbf646 100644 --- a/test/autotest/testcases/level0/case08_once003.json +++ b/test/autotest/testcases/level0/case08_once003.json @@ -2,8 +2,7 @@ "description": "Only effective once for normal use (param)", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case08_once003.py b/test/autotest/testcases/level0/case08_once003.py index 84ad760a55d4d1d6308d143ed30fa375542f9344..3adf9f32c32ed7d55dde56d2d59f162eb34c708f 100644 --- a/test/autotest/testcases/level0/case08_once003.py +++ b/test/autotest/testcases/level0/case08_once003.py @@ -14,11 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + import time from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source, remove_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case08_once003(TestCase): @@ -35,8 +44,8 @@ class case08_once003(TestCase): def setup(self): self.log.info("case08_once003 start") - need_source = {"cfg": True, "fwk": False, "listen_test": True, "audio_ability": False, "ondemand": True, - "proxy": True, "para": True} + need_source = {"cfg": True, "fwk": False, "listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": False} self.source_path = get_source_path(need_source=need_source, casename="level0/case08_once003") self.driver.System.execute_command("ondemand param true") push_source(source_path=self.source_path, driver=self.driver, sn=self.sn, update_param=True) diff --git a/test/autotest/testcases/level0/case09_once004.json b/test/autotest/testcases/level0/case09_once004.json index eb3805d9624277aa4ac4987fae31218eda1ca43a..6f2f53c206d23093a579aaf5483864c0ac0876e9 100644 --- a/test/autotest/testcases/level0/case09_once004.json +++ b/test/autotest/testcases/level0/case09_once004.json @@ -2,8 +2,7 @@ "description": "Only effective once for normal use (broadcast)", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case09_once004.py b/test/autotest/testcases/level0/case09_once004.py index a1d5a0e89c70b8cdf5983b19d91d22f90eef1d50..bda7bbfffee0ef4db08becc3cfb8cdb2c2df5fd5 100644 --- a/test/autotest/testcases/level0/case09_once004.py +++ b/test/autotest/testcases/level0/case09_once004.py @@ -14,11 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + import time from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source, remove_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case09_once004(TestCase): @@ -35,8 +44,8 @@ class case09_once004(TestCase): def setup(self): self.log.info("case09_once004 start") - need_source = {"cfg": True, "fwk": False, "listen_test": True, "audio_ability": False, "ondemand": True, - "proxy": True, "para": False} + need_source = {"cfg": True, listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": False} self.source_path = get_source_path(need_source=need_source, casename="level0/case09_once004") push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) diff --git a/test/autotest/testcases/level0/case10_delay_time002.json b/test/autotest/testcases/level0/case10_delay_time002.json index bfe5a2ea66850c7e70686df494d3ffa403033951..f7fcffa62357936cb996f234f9b448522ee42062 100644 --- a/test/autotest/testcases/level0/case10_delay_time002.json +++ b/test/autotest/testcases/level0/case10_delay_time002.json @@ -2,8 +2,7 @@ "description": "Process delay exit function boundary verification", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case10_delay_time002.py b/test/autotest/testcases/level0/case10_delay_time002.py index 44ba6394ba3a578e8623b4f841d5b6e796fbef8b..aea0d0676c76c0f8e149ae6c594231cd409ed2f8 100644 --- a/test/autotest/testcases/level0/case10_delay_time002.py +++ b/test/autotest/testcases/level0/case10_delay_time002.py @@ -14,11 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + import time from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source, remove_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case10_delay_time002(TestCase): @@ -35,8 +44,8 @@ class case10_delay_time002(TestCase): def setup(self): self.log.info("case10_delay_time002 start") - need_source = {"cfg": True, "fwk": False, "listen_test": True, "audio_ability": True, "ondemand": True, - "proxy": True, "para": False} + need_source = {"cfg": True, "listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": False} self.source_path = get_source_path(need_source=need_source, casename="level0/case10_delay_time002") push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) diff --git a/test/autotest/testcases/level0/case11_delay_time003.json b/test/autotest/testcases/level0/case11_delay_time003.json index 3950d9812caae8e7e03c7830df482ed1808679b4..970352171937ef5a26a504505e4027465e2aa7a9 100644 --- a/test/autotest/testcases/level0/case11_delay_time003.json +++ b/test/autotest/testcases/level0/case11_delay_time003.json @@ -2,8 +2,7 @@ "description": "Process delay exit function boundary verification", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case11_delay_time003.py b/test/autotest/testcases/level0/case11_delay_time003.py index b863205f73704c3394f04ba9b6b0255f1b805587..4c24c2615f9c7a69ddb6efae5ff6ba0ec8874057 100644 --- a/test/autotest/testcases/level0/case11_delay_time003.py +++ b/test/autotest/testcases/level0/case11_delay_time003.py @@ -14,11 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + import time from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source, remove_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case11_delay_time003(TestCase): @@ -35,8 +44,8 @@ class case11_delay_time003(TestCase): def setup(self): self.log.info("case11_delay_time003 start") - need_source = {"cfg": True, "fwk": False, "listen_test": True, "audio_ability": True, "ondemand": True, - "proxy": True, "para": False} + need_source = {"cfg": True, "listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": False} self.source_path = get_source_path(need_source=need_source, casename="level0/case11_delay_time003") push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) diff --git a/test/autotest/testcases/level0/case12_delay_time001.json b/test/autotest/testcases/level0/case12_delay_time001.json index 2f9fd407dd8a72cdfc86db36f72e9a0292406695..4c18575e8e56baa9a88fddb6dd2135433db794d8 100644 --- a/test/autotest/testcases/level0/case12_delay_time001.json +++ b/test/autotest/testcases/level0/case12_delay_time001.json @@ -2,8 +2,7 @@ "description": "Process Delay Exit Function Verification", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case12_delay_time001.py b/test/autotest/testcases/level0/case12_delay_time001.py index 4f614d328ba5232d0ca5cfadfb053f767b17981d..a04a04f3e6a3a19d6146de2247663e13fb447745 100644 --- a/test/autotest/testcases/level0/case12_delay_time001.py +++ b/test/autotest/testcases/level0/case12_delay_time001.py @@ -14,11 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + import time from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source, remove_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case12_delay_time001(TestCase): @@ -35,8 +44,8 @@ class case12_delay_time001(TestCase): def setup(self): self.log.info("case12_delay_time001 start") - need_source = {"cfg": True, "fwk": False, "listen_test": True, "audio_ability": True, "ondemand": True, - "proxy": True, "para": False} + need_source = {"cfg": True, "listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": False} self.source_path = get_source_path(need_source=need_source, casename="level0/case12_delay_time001") push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) diff --git a/test/autotest/testcases/level0/case13_param001.json b/test/autotest/testcases/level0/case13_param001.json index 4415429a10ff7d8279b18563f42d225a819fd2ed..6a5f9ff565e28bef636542bbd59b878217197cdd 100644 --- a/test/autotest/testcases/level0/case13_param001.json +++ b/test/autotest/testcases/level0/case13_param001.json @@ -2,8 +2,7 @@ "description": "The attribute transformation plugin is functioning properly", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case13_param001.py b/test/autotest/testcases/level0/case13_param001.py index 0841150d25082789f19a711f3ba3cc80ccc76bf2..fd931c8f48f95c13f1f2f823ce81df9e4d8d5f50 100644 --- a/test/autotest/testcases/level0/case13_param001.py +++ b/test/autotest/testcases/level0/case13_param001.py @@ -14,11 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + import time from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source, remove_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case13_param001(TestCase): @@ -35,8 +44,8 @@ class case13_param001(TestCase): def setup(self): self.log.info("case13_param001 start") - need_source = {"cfg": True, "fwk": False, "listen_test": True, "audio_ability": False, "ondemand": True, - "proxy": True, "para": True} + need_source = {"cfg": True, "listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": True} self.source_path = get_source_path(need_source=need_source, casename="level0/case13_param001") push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) diff --git a/test/autotest/testcases/level0/case14_dysaprofile003.json b/test/autotest/testcases/level0/case14_dysaprofile003.json index e8d072db1762d03e763fd97c14a79b3a56ef4055..a3f1906efade509623f43b7802e559ccceb5aa02 100644 --- a/test/autotest/testcases/level0/case14_dysaprofile003.json +++ b/test/autotest/testcases/level0/case14_dysaprofile003.json @@ -2,8 +2,7 @@ "description": "Dynamically update and load configuration files", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case14_dysaprofile003.py b/test/autotest/testcases/level0/case14_dysaprofile003.py index 0cc80cf34bffce9a534e95eb4256bc348514b363..2fcf661098eede0e109e9724c6d8407858d77c36 100644 --- a/test/autotest/testcases/level0/case14_dysaprofile003.py +++ b/test/autotest/testcases/level0/case14_dysaprofile003.py @@ -14,11 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + import time from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case14_dysaprofile003(TestCase): @@ -35,8 +44,8 @@ class case14_dysaprofile003(TestCase): def setup(self): self.log.info("case14_dysaprofile003 start") - need_source = {"cfg": True, "fwk": False, "listen_test": True, "audio_ability": False, "ondemand": True, - "proxy": True, "para": False} + need_source = {"cfg": True, "listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": False} self.source_path = get_source_path(need_source=need_source, casename="level0/case14_dysaprofile003") push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) @@ -58,4 +67,5 @@ class case14_dysaprofile003(TestCase): assert "1494" in result def teardown(self): + remove_source(source_path=self.source_path, driver=self.driver, sn=self.sn) self.log.info("case14_dysaprofile003 down") diff --git a/test/autotest/testcases/level0/case15_dysaprofile004.json b/test/autotest/testcases/level0/case15_dysaprofile004.json index e2af01c3d70b754914545d95bd0b78d9730e9eff..c2a4be2703aab8e9804b237820645283bb39dd16 100644 --- a/test/autotest/testcases/level0/case15_dysaprofile004.json +++ b/test/autotest/testcases/level0/case15_dysaprofile004.json @@ -2,8 +2,7 @@ "description": "Dynamically update and unload configuration files", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case15_dysaprofile004.py b/test/autotest/testcases/level0/case15_dysaprofile004.py index 56ce1b12e17e7c2d46a621631c3e0d4dfb08049b..55c23f849bdfea2bbc2194e026978ba18a100cb7 100644 --- a/test/autotest/testcases/level0/case15_dysaprofile004.py +++ b/test/autotest/testcases/level0/case15_dysaprofile004.py @@ -14,11 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + import time from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import remove_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case15_dysaprofile004(TestCase): @@ -34,6 +43,10 @@ class case15_dysaprofile004(TestCase): def setup(self): self.log.info("case15_dysaprofile004 start") + need_source = {"cfg": True, "listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": False} + self.source_path = get_source_path(need_source=need_source, casename="level0/case15_dysaprofile004") + push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) def test_step(self): driver = self.driver diff --git a/test/autotest/testcases/level0/case16_dysaprofile001.json b/test/autotest/testcases/level0/case16_dysaprofile001.json index 3239991bd0872a480b577baad9950c8266e04b38..f9bdd610be6b7f35c98ecb927b17636cbadd6b00 100644 --- a/test/autotest/testcases/level0/case16_dysaprofile001.json +++ b/test/autotest/testcases/level0/case16_dysaprofile001.json @@ -2,8 +2,7 @@ "description": "Get on-demand start stop loading information", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case16_dysaprofile001.py b/test/autotest/testcases/level0/case16_dysaprofile001.py index 9d4765c605e6e98f804c8cef11766634695bd90c..709f9326d21618327b14926eafce57dcff7d137e 100644 --- a/test/autotest/testcases/level0/case16_dysaprofile001.py +++ b/test/autotest/testcases/level0/case16_dysaprofile001.py @@ -14,11 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source, remove_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case16_dysaprofile001(TestCase): @@ -35,8 +43,8 @@ class case16_dysaprofile001(TestCase): def setup(self): self.log.info("case16_dysaprofile001 start") - need_source = {"cfg": True, "fwk": False, "listen_test": True, "audio_ability": False, "ondemand": True, - "proxy": True, "para": False} + need_source = {"cfg": True, "listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": False} self.source_path = get_source_path(need_source=need_source, casename="level0/case16_dysaprofile001") push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) diff --git a/test/autotest/testcases/level0/case17_dysaprofile002.json b/test/autotest/testcases/level0/case17_dysaprofile002.json index dcf1f109e3e5762a6921ba1d0b4411a57f4f337f..d1df7ae7510bad9f3c4d651dea8d08a80d243e30 100644 --- a/test/autotest/testcases/level0/case17_dysaprofile002.json +++ b/test/autotest/testcases/level0/case17_dysaprofile002.json @@ -2,8 +2,7 @@ "description": "Get on-demand start stop unloading information", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case17_dysaprofile002.py b/test/autotest/testcases/level0/case17_dysaprofile002.py index a49bcd3d24289787c365953cec68bf3f802b2129..df5c3134f5c5b08b516d01428619ba724b2abda3 100644 --- a/test/autotest/testcases/level0/case17_dysaprofile002.py +++ b/test/autotest/testcases/level0/case17_dysaprofile002.py @@ -14,10 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source, remove_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case17_dysaprofile002(TestCase): @@ -34,8 +43,8 @@ class case17_dysaprofile002(TestCase): def setup(self): self.log.info("case17_dysaprofile002 start") - need_source = {"cfg": True, "fwk": False, "listen_test": True, "audio_ability": False, "ondemand": True, - "proxy": True, "para": False} + need_source = {"cfg": True, "listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": False} self.source_path = get_source_path(need_source=need_source, casename="level0/case17_dysaprofile002") push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) diff --git a/test/autotest/testcases/level0/case18_switch001.json b/test/autotest/testcases/level0/case18_switch001.json index 2bc15e45b56aaaf4889f83213b2e60e0ba4b5076..12394e42af8f065b4a20fd2d70607a70c13b5ab0 100644 --- a/test/autotest/testcases/level0/case18_switch001.json +++ b/test/autotest/testcases/level0/case18_switch001.json @@ -2,8 +2,7 @@ "description": "The WiFi switch plugin is functioning properly", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case18_switch001.py b/test/autotest/testcases/level0/case18_switch001.py index 5392a33be3a6da5565b6de170a4e3ec0cd3e3ebb..57795a6770a78cdc67f7fa439c9fd5927f7f8398 100644 --- a/test/autotest/testcases/level0/case18_switch001.py +++ b/test/autotest/testcases/level0/case18_switch001.py @@ -14,12 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 import time from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source, remove_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case18_switch001(TestCase): @@ -38,8 +46,8 @@ class case18_switch001(TestCase): self.log.info("case18_switch001 start") self.driver.Screen.wake_up() self.driver.Wifi.disable() - need_source = {"cfg": True, "fwk": False, "listen_test": True, "audio_ability": False, "ondemand": True, - "proxy": True, "para": False} + need_source = {"cfg": True, "listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": False} self.source_path = get_source_path(need_source=need_source, casename="level0/case18_switch001") push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) diff --git a/test/autotest/testcases/level0/case19_switch002.json b/test/autotest/testcases/level0/case19_switch002.json index c7d4e3b60c1cb8e0da4fb08fa36cdf66a5f05adf..cbbd321fbd45d47cfad9c2fa15e25cafb80da005 100644 --- a/test/autotest/testcases/level0/case19_switch002.json +++ b/test/autotest/testcases/level0/case19_switch002.json @@ -2,8 +2,7 @@ "description": "Bluetooth switch plugin is functioning properly", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case19_switch002.py b/test/autotest/testcases/level0/case19_switch002.py index 933ded7c9c68cfd985bb99849e0b06109dd25c58..103edb10cd3b5170c8c8aff899dc7b994013e761 100644 --- a/test/autotest/testcases/level0/case19_switch002.py +++ b/test/autotest/testcases/level0/case19_switch002.py @@ -14,11 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + import time from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source, remove_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case19_switch002(TestCase): @@ -37,8 +46,8 @@ class case19_switch002(TestCase): self.log.info("case19_switch002 start") self.driver.Screen.wake_up() self.driver.Bluetooth.disable() - need_source = {"cfg": True, "fwk": False, "listen_test": True, "audio_ability": False, "ondemand": True, - "proxy": True, "para": False} + need_source = {"cfg": True, "listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": False} self.source_path = get_source_path(need_source=need_source, casename="level0/case19_switch002") push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) diff --git a/test/autotest/testcases/level0/case20_timer003.json b/test/autotest/testcases/level0/case20_timer003.json index eeba36fe2ae2e20ebf274a303826a5a0c6d65c38..4abbe6880f05902f1c64e0df432fbe7ed8661679 100644 --- a/test/autotest/testcases/level0/case20_timer003.json +++ b/test/autotest/testcases/level0/case20_timer003.json @@ -2,8 +2,7 @@ "description": "Timer+combination condition (param)", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case20_timer003.py b/test/autotest/testcases/level0/case20_timer003.py index e82f53bc343d7471e127fd58c4048c16355f086b..4213d2f56c78429e546a762ee764375b20170f97 100644 --- a/test/autotest/testcases/level0/case20_timer003.py +++ b/test/autotest/testcases/level0/case20_timer003.py @@ -14,11 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + import time from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source, remove_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case20_timer003(TestCase): @@ -35,8 +44,8 @@ class case20_timer003(TestCase): def setup(self): self.log.info("case20_timer003 start") - need_source = {"cfg": True, "fwk": False, "listen_test": True, "audio_ability": False, "ondemand": True, - "proxy": True, "para": True} + need_source = {"cfg": True, "listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": True} self.source_path = get_source_path(need_source=need_source, casename="level0/case20_timer003") push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) diff --git a/test/autotest/testcases/level0/case21_add001.json b/test/autotest/testcases/level0/case21_add001.json index c3668229cc987d6e5fb8c3ef60b14a5a1afa93a6..76861d9793784507ab5acf19d910db322184ac9e 100644 --- a/test/autotest/testcases/level0/case21_add001.json +++ b/test/autotest/testcases/level0/case21_add001.json @@ -2,8 +2,7 @@ "description": "Non native process add intercepted", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case21_add001.py b/test/autotest/testcases/level0/case21_add001.py index 82ac4de339921fce5e2c54598f6e1135a9d27287..38f471ea8b91b0b39500b20561f785774164085e 100644 --- a/test/autotest/testcases/level0/case21_add001.py +++ b/test/autotest/testcases/level0/case21_add001.py @@ -14,12 +14,21 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + import time from devicetest.core.test_case import TestCase, CheckPoint, get_report_dir from hypium import UiDriver from hypium.action.os_hypium.device_logger import DeviceLogger -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source, remove_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case21_add001(TestCase): @@ -36,8 +45,8 @@ class case21_add001(TestCase): def setup(self): self.log.info("case21_add001 start") - need_source = {"cfg": True, "fwk": True, "listen_test": True, "audio_ability": True, "ondemand": True, - "proxy": True, "para": False} + need_source = {"cfg": True, "listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": False} self.source_path = get_source_path(need_source=need_source, casename="level0/case21_add001") push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) diff --git a/test/autotest/testcases/level0/case22_process001.json b/test/autotest/testcases/level0/case22_process001.json index 68c0c8bea14fc39341872813158be813c8a361e7..5877bbc4c23565483431096ff81d2a49383f9d9f 100644 --- a/test/autotest/testcases/level0/case22_process001.json +++ b/test/autotest/testcases/level0/case22_process001.json @@ -2,8 +2,7 @@ "description": "SA process creates and destroys relevant information", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case22_process001.py b/test/autotest/testcases/level0/case22_process001.py index 5ce2741c3277a407b707944a2c883d2a9d36db31..d560fb4ce1e162b66c753519d307624f1abb2169 100644 --- a/test/autotest/testcases/level0/case22_process001.py +++ b/test/autotest/testcases/level0/case22_process001.py @@ -14,10 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case22_process001(TestCase): @@ -30,13 +39,14 @@ class case22_process001(TestCase): ] self.driver = UiDriver(self.device1) self.sn = self.device1.device_sn + self.source_path = {} def setup(self): self.log.info("case22_process001 start") - need_source = {"cfg": False, "fwk": False, "listen_test": False, "audio_ability": False, "ondemand": True, + need_source = {"cfg": False, "listen_test": False, "audio_ability": False, "ondemand": False, "proxy": False, "para": False} - source_path = get_source_path(need_source=need_source, casename="level0/case22_process001") - push_source(source_path=source_path, driver=self.driver, sn=self.sn) + self.source_path = get_source_path(need_source=need_source, casename="level0/case22_process001") + push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) def test_step(self): driver = self.driver @@ -45,4 +55,5 @@ class case22_process001(TestCase): assert "GetRunningSystemProcess size" in result def teardown(self): + remove_source(source_path=self.source_path, driver=self.driver, sn=self.sn) self.log.info("case22_process001 down") diff --git a/test/autotest/testcases/level0/case23_process002.json b/test/autotest/testcases/level0/case23_process002.json index 8306ade06c3e49dbaa750705f88c03ebe21b76e7..f26b719c69e2382e3c0be1672a2538f010f09c2c 100644 --- a/test/autotest/testcases/level0/case23_process002.json +++ b/test/autotest/testcases/level0/case23_process002.json @@ -2,8 +2,7 @@ "description": "SA process creates and destroys relevant information", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case23_process002.py b/test/autotest/testcases/level0/case23_process002.py index 33d1303ab6360ae233735cd40a024cd1c316e76b..048b147ee4a4158bb378a761b610cda9c570a109 100644 --- a/test/autotest/testcases/level0/case23_process002.py +++ b/test/autotest/testcases/level0/case23_process002.py @@ -14,10 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver from tools.get_source_path import get_source_path -from tools.push_remove_source import remove_source +from tools.push_remove_source import push_source, remove_source class case23_process002(TestCase): @@ -30,9 +39,14 @@ class case23_process002(TestCase): ] self.driver = UiDriver(self.device1) self.sn = self.device1.device_sn + self.source_path = {} def setup(self): self.log.info("case23_process002 start") + need_source = {"cfg": False, "listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": False} + self.source_path = get_source_path(need_source=need_source, casename="level0/case23_process002") + push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) def test_step(self): driver = self.driver @@ -48,8 +62,5 @@ class case23_process002(TestCase): assert count == 1 def teardown(self): - need_source = {"cfg": False, "fwk": False, "listen_test": False, "audio_ability": False, "ondemand": True, - "proxy": False, "para": False} - source_path = get_source_path(need_source=need_source, casename="level0/case22_process001") - remove_source(source_path=source_path, driver=self.driver, sn=self.sn) + remove_source(source_path=self.source_path, driver=self.driver, sn=self.sn) self.log.info("case23_process002 down") diff --git a/test/autotest/testcases/level0/case24_sub001.json b/test/autotest/testcases/level0/case24_sub001.json index 97cc6102c0e86e1d8c80b4ae9ccc287429d7354f..1fcd14e414ec3382fa77215becb4401576669872 100644 --- a/test/autotest/testcases/level0/case24_sub001.json +++ b/test/autotest/testcases/level0/case24_sub001.json @@ -2,8 +2,7 @@ "description": "Subscription function verification", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case24_sub001.py b/test/autotest/testcases/level0/case24_sub001.py index 714b7112b8981a20b256dc7a819db25bb2741793..12b662690212e748c2d2c566772a401134463702 100644 --- a/test/autotest/testcases/level0/case24_sub001.py +++ b/test/autotest/testcases/level0/case24_sub001.py @@ -14,13 +14,22 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + import os.path import time from devicetest.core.test_case import TestCase, Step, CheckPoint, get_report_dir from hypium import UiDriver -import tools.disk_drop_log -from tools.get_source_path import get_source_path -from tools.push_remove_source import push_source, remove_source +import disk_drop_log +from get_source_path import get_source_path +from push_remove_source import push_source, remove_source class case24_sub001(TestCase): @@ -37,8 +46,8 @@ class case24_sub001(TestCase): def setup(self): self.log.info("case24_sub001 start") - need_source = {"cfg": True, "fwk": True, "listen_test": True, "audio_ability": True, "ondemand": True, - "proxy": True, "para": False} + need_source = {"cfg": True, "listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": False} self.source_path = get_source_path(need_source=need_source, casename="level0/case24_sub001") push_source(source_path=self.source_path, driver=self.driver, sn=self.sn) @@ -55,18 +64,17 @@ class case24_sub001(TestCase): assert "1494" in result log_revice_path = os.path.join(self.get_case_report_path(), "disk_drop") - tools.disk_drop_log.pulling_disk_dropping_logs(log_revice_path, self.sn) - tools.disk_drop_log.parse_disk_dropping_logs(log_revice_path) - result = tools.disk_drop_log.check_disk_dropping_logs(log_revice_path, + disk_drop_log.pulling_disk_dropping_logs(log_revice_path, self.driver) + disk_drop_log.parse_disk_dropping_logs(log_revice_path) + result = disk_drop_log.check_disk_dropping_logs(log_revice_path, "OnAddSystemAbility systemAbilityId:1901 added!") CheckPoint("The log contains 'ListenAbility: OnAddSystemAbility systemAbilityId:1901 added!'") assert result is True - result = tools.disk_drop_log.check_disk_dropping_logs(log_revice_path, + result = disk_drop_log.check_disk_dropping_logs(log_revice_path, "OnAddSystemAbility systemAbilityId:4700 added!") CheckPoint("The log contains 'ListenAbility: OnAddSystemAbility systemAbilityId:4700 added!'") assert result is True def teardown(self): - self.driver.Screen.close() remove_source(source_path=self.source_path, driver=self.driver, sn=self.sn) self.log.info("case24_sub001 down") diff --git a/test/autotest/testcases/level0/case25_selinux001.json b/test/autotest/testcases/level0/case25_selinux001.json index 4aa4d373f29f049d8dae4de3a6f76ac5c5f979f4..a7a95f2eda2f823ba820dcfb3840322a66d95ef6 100644 --- a/test/autotest/testcases/level0/case25_selinux001.json +++ b/test/autotest/testcases/level0/case25_selinux001.json @@ -2,8 +2,7 @@ "description": "System normal startup configuration Samgr Selina policy", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case25_selinux001.py b/test/autotest/testcases/level0/case25_selinux001.py index 386d55df1cfabe08bc1ec3e98c2ccb7be65a978a..6d3ebd2c8da9dd1693b20ee52a2003c67b2dd8a4 100644 --- a/test/autotest/testcases/level0/case25_selinux001.py +++ b/test/autotest/testcases/level0/case25_selinux001.py @@ -14,10 +14,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import sys + +current_dir = os.path.abspath(os.path.dirname(__file__)) +rootPath = os.path.split(current_dir)[0] +awPath = os.path.split(rootPath)[0] +sys.path.append(rootPath) +sys.path.append(os.path.join(awPath), "aw") # 导入aw所在目录 + import os.path from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from hypium.action.host import host import tools.disk_drop_log @@ -34,15 +42,15 @@ class case25_selinux001(TestCase): def setup(self): self.log.info("case25_selinux001 start") - host.shell("hdc -t {} shell rm -r /data/log/hilog".format(self.sn)) - host.shell("hdc -t {} shell hilog -d /system/bin/samgr".format(self.sn)) + self.driver.shell("rm -r /data/log/hilog") + self.driver.shell("hilog -d /system/bin/samgr") self.driver.System.reboot() def test_step(self): log_revice_path = os.path.join(self.get_case_report_path(), "disk_drop") - tools.disk_drop_log.pulling_disk_dropping_logs(log_revice_path, self.sn) - tools.disk_drop_log.parse_disk_dropping_logs(log_revice_path) - result = tools.disk_drop_log.check_disk_dropping_logs(log_revice_path, "scontext=u:r:samgr:s0") + disk_drop_log.pulling_disk_dropping_logs(log_revice_path, self.driver) + disk_drop_log.parse_disk_dropping_logs(log_revice_path) + result = disk_drop_log.check_disk_dropping_logs(log_revice_path, "scontext=u:r:samgr:s0") CheckPoint("The log does not contain 'scontext=u:r:samgr:s0'") assert result is False diff --git a/test/autotest/testcases/level0/case26_init001.json b/test/autotest/testcases/level0/case26_init001.json index a3e73898f3186287157f3deee9fab13cc1ab0469..74140074a0f1f035fb776072cda8dfde8ec7bb05 100644 --- a/test/autotest/testcases/level0/case26_init001.json +++ b/test/autotest/testcases/level0/case26_init001.json @@ -2,8 +2,7 @@ "description": "Samgr process crash recovery detection", "environment": [ { - "type": "device", - "label": "phone" + "type": "device" } ], "driver": { diff --git a/test/autotest/testcases/level0/case26_init001.py b/test/autotest/testcases/level0/case26_init001.py index c19a96c3c390177aa852b6d16616b02e82601c34..ce88996cdb205c7082c1438043db506bdb24a4bc 100644 --- a/test/autotest/testcases/level0/case26_init001.py +++ b/test/autotest/testcases/level0/case26_init001.py @@ -17,7 +17,6 @@ import time from devicetest.core.test_case import TestCase, CheckPoint from hypium import UiDriver -from hypium.action.host import host import subprocess import shlex @@ -42,7 +41,6 @@ class case26_init001(TestCase): "test_step" ] self.driver = UiDriver(self.device1) - self.sn = self.device1.device_sn def setup(self): self.log.info("case26_init001 start") @@ -53,7 +51,7 @@ class case26_init001(TestCase): result = driver.System.get_pid("samgr") assert result is not None time.sleep(1) - host.shell("hdc -t {} shell kill -9 `pidof samgr`".format(self.sn)) + driver.shell("kill -9 `pidof samgr`") command = "fastboot reboot" timeout = 3 current_number = 0 @@ -68,7 +66,7 @@ class case26_init001(TestCase): CheckPoint("Second kill samgr, enter fastboot or restart") result = driver.System.get_pid("samgr") assert result is not None - host.shell("hdc -t {} shell kill -9 `pidof samgr`".format(self.sn)) + driver.shell("kill -9 `pidof samgr`") current_number = 0 return_code = -1 while current_number < max_number and return_code == -1: