From f9251cf4146f1fe00bd697bfb42050583bfab4a1 Mon Sep 17 00:00:00 2001 From: honglulu Date: Tue, 10 Jun 2025 15:13:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A1=A5=E5=85=85level0=20?= =?UTF-8?q?=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/autotest/{tools => aw}/disk_drop_log.py | 150 +++++++------- .../autotest/{tools => aw}/get_source_path.py | 173 ++++++++-------- .../{tools => aw}/push_remove_source.py | 191 +++++++++--------- .../level0/case24_sub001/listen_test.cfg | 2 +- .../level0/case24_sub001/listen_test.json | 19 +- test/autotest/resource/soResource/ReadMe.md | 7 +- .../testcases/level0/case01_listen001.json | 3 +- .../testcases/level0/case01_listen001.py | 15 +- .../testcases/level0/case02_load001.json | 3 +- .../testcases/level0/case02_load001.py | 17 +- .../testcases/level0/case03_get001.json | 3 +- .../testcases/level0/case03_get001.py | 20 +- .../testcases/level0/case04_get002.json | 3 +- .../testcases/level0/case04_get002.py | 22 +- .../testcases/level0/case05_init001.json | 3 +- .../testcases/level0/case05_init001.py | 3 +- .../level0/case06_commonevent001.json | 3 +- .../testcases/level0/case06_commonevent001.py | 17 +- .../testcases/level0/case07_once002.json | 3 +- .../testcases/level0/case07_once002.py | 17 +- .../testcases/level0/case08_once003.json | 3 +- .../testcases/level0/case08_once003.py | 17 +- .../testcases/level0/case09_once004.json | 3 +- .../testcases/level0/case09_once004.py | 17 +- .../level0/case10_delay_time002.json | 3 +- .../testcases/level0/case10_delay_time002.py | 17 +- .../level0/case11_delay_time003.json | 3 +- .../testcases/level0/case11_delay_time003.py | 17 +- .../level0/case12_delay_time001.json | 3 +- .../testcases/level0/case12_delay_time001.py | 17 +- .../testcases/level0/case13_param001.json | 3 +- .../testcases/level0/case13_param001.py | 17 +- .../level0/case14_dysaprofile003.json | 3 +- .../testcases/level0/case14_dysaprofile003.py | 18 +- .../level0/case15_dysaprofile004.json | 3 +- .../testcases/level0/case15_dysaprofile004.py | 22 +- .../level0/case16_dysaprofile001.json | 3 +- .../testcases/level0/case16_dysaprofile001.py | 16 +- .../level0/case17_dysaprofile002.json | 3 +- .../testcases/level0/case17_dysaprofile002.py | 17 +- .../testcases/level0/case18_switch001.json | 3 +- .../testcases/level0/case18_switch001.py | 16 +- .../testcases/level0/case19_switch002.json | 3 +- .../testcases/level0/case19_switch002.py | 17 +- .../testcases/level0/case20_timer003.json | 3 +- .../testcases/level0/case20_timer003.py | 17 +- .../testcases/level0/case21_add001.json | 3 +- .../testcases/level0/case21_add001.py | 17 +- .../testcases/level0/case22_process001.json | 3 +- .../testcases/level0/case22_process001.py | 21 +- .../testcases/level0/case23_process002.json | 3 +- .../testcases/level0/case23_process002.py | 23 ++- .../testcases/level0/case24_sub001.json | 3 +- .../testcases/level0/case24_sub001.py | 28 ++- .../testcases/level0/case25_selinux001.json | 3 +- .../testcases/level0/case25_selinux001.py | 23 ++- .../testcases/level0/case26_init001.json | 3 +- .../testcases/level0/case26_init001.py | 6 +- 58 files changed, 613 insertions(+), 461 deletions(-) rename test/autotest/{tools => aw}/disk_drop_log.py (92%) rename test/autotest/{tools => aw}/get_source_path.py (91%) rename test/autotest/{tools => aw}/push_remove_source.py (67%) 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 4bfa33e4..f97c7f38 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 5cbdcef5..1365abcd 100644 --- a/test/autotest/tools/get_source_path.py +++ b/test/autotest/aw/get_source_path.py @@ -1,89 +1,84 @@ -#!/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 5faeefaa..abde9ec4 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.hdc("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("chmod 644 /system/etc/init/listen_test.cfg") + driver.Storage.push_file(local_path=source_path["sa_listen_json_path"], device_path="/system/profile/") + driver.shell("chmod 644 /system/profile/listen_test.json") + + 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("chmod 644 /system/lib/liblisten_test.z.so") + + if "sa_proxy_path" in source_path: + driver.Storage.push_file(local_path=source_path["sa_proxy_path"], device_path="/system/lib/") + driver.shell("chmod 644 /system/lib/libtest_sa_proxy.z.so") + + + 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("chmod 644 /system/lib/libtest_audio_ability.z.so") + + if "sa_ondemand_path" in source_path: + driver.Storage.push_file(local_path=source_path["sa_ondemand_path"], device_path="/system/bin/") + driver.shell("chmod 755 /system/bin/ondemand") + + 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("chmod 755 /system/etc/param/samgr.para") + driver.Storage.push_file(local_path=source_path["sa_para_dac_path"], device_path="/system/etc/param/") + driver.shell("chmod 755 /system/etc/param/samgr.para.dac") + 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("kill -9 `pidof listen_test`") + driver.shell("target mount") + 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 cb4036c2..10a8006e 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 858e4160..87c91a16 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 7cf4b8f5..ce32bf0d 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 eea02047..389dab06 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 65e41a79..53eb7085 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("rm -r /data/log/hilog") + self.driver.shell("hilog -d /system/bin/samgr") 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 `pidof 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 39ebd534..e692760d 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 0fadea52..657f742b 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")) + 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 e736b1d7..93b43c67 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 9a49b57e..063669e7 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")) + 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): - self.log.info("case003_get001 down") + remove_source(source_path=self.source_path, driver=self.driver, sn=self.sn) + self.log.info("case03_get001 down") diff --git a/test/autotest/testcases/level0/case04_get002.json b/test/autotest/testcases/level0/case04_get002.json index c7ad5b0a..58508a98 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 8cf1ed75..9724a615 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")) + 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": False, + "proxy": False, "para": False} + self.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 aecffb19..82f1beb8 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 379c76de..1f92bdbf 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("rm -r /data/log/hilog") 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 289ab959..28fa0b44 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 856e9e9b..3ab272bd 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")) + 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,8 +43,8 @@ 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, - "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/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 00a1a183..7aea6a68 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 c2ce52d9..d9753fa7 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")) + 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": False, + "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 33d309c5..0e0c20bb 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 84ad760a..ab8faeab 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")) + 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, "listen_test": False, "audio_ability": False, "ondemand": False, + "proxy": False, "para": True} 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 eb3805d9..6f2f53c2 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 a1d5a0e8..07e19f11 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")) + 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 bfe5a2ea..f7fcffa6 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 44ba6394..4ad010f8 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")) + 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 3950d981..97035217 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 b863205f..0a38803f 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")) + 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 2f9fd407..4c18575e 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 4f614d32..c86d1245 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")) + 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 4415429a..6a5f9ff5 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 0841150d..b2a6fa4e 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")) + 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 e8d072db..a3f1906e 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 0cc80cf3..67d945b8 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")) + 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 e2af01c3..c2a4be27 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 56ce1b12..e4a8152d 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")) + 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 @@ -54,8 +67,5 @@ class case15_dysaprofile004(TestCase): assert "1494" not 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/case14_dysaprofile003") - 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("case15_dysaprofile004 down") diff --git a/test/autotest/testcases/level0/case16_dysaprofile001.json b/test/autotest/testcases/level0/case16_dysaprofile001.json index 3239991b..f9bdd610 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 9d4765c6..08776859 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")) 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 dcf1f109..d1df7ae7 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 a49bcd3d..13e3d061 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")) + 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 2bc15e45..12394e42 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 5392a33b..cf5ec0e1 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")) 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 c7d4e3b6..cbbd321f 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 933ded7c..11a532a1 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")) + 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 eeba36fe..4abbe688 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 e82f53bc..4072ca07 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")) + 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 c3668229..76861d97 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 82ac4de3..a35873d9 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")) + 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 68c0c8be..5877bbc4 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 5ce2741c..59b3fd6d 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")) + 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 8306ade0..f26b719c 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 33d1303a..46fac941 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")) + 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 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 97cc6102..1fcd14e4 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 714b7112..80bebbbe 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")) + 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 4aa4d373..a7a95f2e 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 386d55df..5b55f800 100644 --- a/test/autotest/testcases/level0/case25_selinux001.py +++ b/test/autotest/testcases/level0/case25_selinux001.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")) + 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 +import disk_drop_log class case25_selinux001(TestCase): @@ -30,19 +38,18 @@ class case25_selinux001(TestCase): "test_step" ] self.driver = UiDriver(self.device1) - self.sn = self.device1.device_sn 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 a3e73898..74140074 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 c19a96c3..ce88996c 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: -- Gitee