diff --git a/interfaces/innerkits/permission/appspawn_mount_permission.c b/interfaces/innerkits/permission/appspawn_mount_permission.c index ed04c48c118e65ad03e0f72900d68fe458cd8ecb..b828348c490bf2dde43f550bd90e91ea1c612af4 100644 --- a/interfaces/innerkits/permission/appspawn_mount_permission.c +++ b/interfaces/innerkits/permission/appspawn_mount_permission.c @@ -112,6 +112,7 @@ static int LoadPermissionConfig(PermissionManager *mgr) (void)ParseJsonConfig("etc/sandbox", mgr->type == CLIENT_FOR_APPSPAWN ? APP_SANDBOX_FILE_NAME : RENDER_SANDBOX_FILE_NAME, ParseAppSandboxConfig, mgr); + size_t count = sizeof(g_staticPermission) / sizeof(g_staticPermission[0]); for (size_t i = 0; i < count; i++) { AddSandboxPermissionNode(g_staticPermission[i], &mgr->permissionQueue); diff --git a/modules/sandbox/BUILD.gn b/modules/sandbox/BUILD.gn index fb3f3f8bf79c2412df125096c781c2da87750fb1..d6f169593958a65616378ba248cbc05d07d11a04 100644 --- a/modules/sandbox/BUILD.gn +++ b/modules/sandbox/BUILD.gn @@ -117,6 +117,7 @@ if (defined(appspawn_sandbox_new) && appspawn_sandbox_new) { include_dirs += [ "${appspawn_path}/modules/sysevent" ] sources += [ "${appspawn_path}/modules/sysevent/hisysevent_adapter.cpp" ] } + if (appspawn_support_nosharefs) { defines += [ "APPSPAWN_SUPPORT_NOSHAREFS" ] } diff --git a/modules/sandbox/normal/sandbox_common.cpp b/modules/sandbox/normal/sandbox_common.cpp index 248323698c114438ebcd4522b2e0677250b24701..f00b4aceb5f8cb400fe9e87927e3bd9fa7cc6436 100644 --- a/modules/sandbox/normal/sandbox_common.cpp +++ b/modules/sandbox/normal/sandbox_common.cpp @@ -465,7 +465,7 @@ std::string SandboxCommon::GetOptions(const AppSpawningCtx *appProperty, cJSON * return options; } -std::vector SandboxCommon::GetDecPath(const AppSpawningCtx *appProperty, cJSON *config) // GetSandboxDecPath +std::vector SandboxCommon::GetDecPath(const AppSpawningCtx *appProperty, cJSON *config) { AppSpawnMsgDacInfo *dacInfo = reinterpret_cast(GetAppProperty(appProperty, TLV_DAC_INFO)); if (dacInfo == nullptr) { @@ -483,7 +483,7 @@ std::vector SandboxCommon::GetDecPath(const AppSpawningCtx *appProp if (strItem == nullptr) { return -1; } - std::string decPath = ConvertToRealPath(appProperty, strItem); + std::string decPath = ConvertToRealPathWithPermission(appProperty, strItem); decPaths.emplace_back(std::move(decPath)); return 0; }; @@ -835,8 +835,8 @@ std::string SandboxCommon::ReplaceVariablePackageName(const AppSpawningCtx *appP variablePackageName << bundleInfo->bundleName; break; } - tmpSandboxPath = ReplaceAllVariables(tmpSandboxPath, SandboxCommonDef::g_variablePackageName, variablePackageName.str()); - APPSPAWN_LOGV("tmpSandboxPath %{public}s", tmpSandboxPath.c_str()); + tmpSandboxPath = ReplaceAllVariables(tmpSandboxPath, SandboxCommonDef::g_variablePackageName, + variablePackageName.str()); return tmpSandboxPath; } @@ -988,7 +988,8 @@ int32_t SandboxCommon::DoAppSandboxMountOnce(const AppSpawningCtx *appProperty, struct timespec mountEnd = {0}; clock_gettime(CLOCK_MONOTONIC_COARSE, &mountEnd); uint64_t diff = DiffTime(&mountStart, &mountEnd); - APPSPAWN_CHECK_ONLY_LOG(diff < SandboxCommonDef::MAX_MOUNT_TIME, "mount %{public}s time %{public}" PRId64 " us", arg->srcPath, diff); + APPSPAWN_CHECK_ONLY_LOG(diff < SandboxCommonDef::MAX_MOUNT_TIME, "mount %{public}s time %{public}" PRId64 " us", + arg->srcPath, diff); #ifdef APPSPAWN_HISYSEVENT APPSPAWN_CHECK_ONLY_EXPER(diff < FUNC_REPORT_DURATION, ReportAbnormalDuration(arg->srcPath, diff)); #endif diff --git a/standard/appspawn_kickdog.c b/standard/appspawn_kickdog.c index 0300f216cd1e22d0221bf8fdd86b5b8aa924a79d..2628a5717082cd9f1b5ee0d81e758f86dbf59f99 100644 --- a/standard/appspawn_kickdog.c +++ b/standard/appspawn_kickdog.c @@ -32,7 +32,7 @@ static int OpenAndWriteToProc(const char *procName, const char *writeStr, size_t int writeResult = write(procFd, writeStr, writeLen); if (writeResult != (int)writeLen) { - APPSPAWN_LOGE("write %{public}s fail,result:%{public}d", writeStr, writeResult); + APPSPAWN_LOGE("write %{public}s fail, ret %{public}d, errno %{public}d", writeStr, writeResult, errno); } else { APPSPAWN_LOGV("write %{public}s success", writeStr); } diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0100.json b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0100.json deleted file mode 100644 index 680ba7fec8c5989c498e99b75d49eab04bbd29f0..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0100.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0100.py"] - } -} \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0100.py b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0100.py deleted file mode 100644 index cc5240317e819e0bcb59635c228e9b37bb5717c4..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0100.py +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright (c) 2025 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.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import UiParam -from hypium.model import UiParam -from aw import Common -import time - - -class SubStartupAppspawnNativespawn0100(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("预置工作:初始化手机开始.................") - self.driver = UiDriver(self.device1) - Step("预置工作:检测屏幕是否亮.................") - self.driver.enable_auto_wakeup(self.device1) - Step("预置工作:滑动解锁.................") - self.driver.swipe(UiParam.UP, side=UiParam.BOTTOM) - Step('设置屏幕常亮') - self.driver.Screen.enable_stay_awake() - Step('获取权限状态') - is_status = self.driver.shell("param get persist.sys.abilityms.multi_process_model") - if ("true" in is_status): - pass - else: - Step('设置权限为true') - self.driver.shell("param set persist.sys.abilityms.multi_process_model true") - Step('重启生效') - self.driver.shell("reboot") - self.driver.System.wait_for_boot_complete() - self.driver.ScreenLock.unlock() - - def test_step1(self): - Step("步骤1:安装测试应用") - hap = Common.sourcepath('entry-default-nativespawn.hap', "SUB_STARTUP_STABILITY_APPSPAWN") - is_hap = self.driver.has_app("com.acts.childprocessmanager") - if(is_hap): - self.driver.uninstall_app("com.acts.childprocessmanager") - else: - pass - self.driver.install_app(hap) - Step("步骤2:打开测试应用") - self.driver.start_app("com.acts.childprocessmanager") - Step("步骤3:点击StartArk用例按钮") - self.driver.touch(BY.text("StartArk用例")) - Step("步骤4:首次获取nativesapwn进程号") - pid1 = self.driver.System.get_pid("nativespawn") - Step("步骤5:点击start Native Process Isolated按钮") - self.driver.touch(BY.text("start Native Process Isolated")) - Step("步骤6:第二次获取nativesapwn进程号") - pid2 = self.driver.System.get_pid("nativespawn") - Step("步骤7:关闭测试应用") - self.driver.stop_app("com.acts.childprocessmanager") - Step("步骤8:第三次获取nativesapwn进程号") - pid3 = self.driver.System.get_pid("nativespawn") - Step("步骤9:预期结果校验") - self.driver.Assert.equal(pid1, None) - self.driver.Assert.not_equal(pid2, None) - self.driver.Assert.equal(pid3, None) - - def teardown(self): - Step("收尾工作:卸载测试应用") - self.driver.uninstall_app("com.acts.childprocessmanager") \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0200.json b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0200.json deleted file mode 100644 index 35f2dbc3c2e4698b8c2aa744417aa00e18c22831..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0200.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0200.py"] - } -} \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0200.py b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0200.py deleted file mode 100644 index 1b81b8e1ad18828b857bc100b91d2e11a5a30c64..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0200.py +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (c) 2025 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.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import UiParam -from hypium.model import UiParam -from aw import Common -import time - - -class SubStartupAppspawnNativespawn0200(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("预置工作:初始化手机开始.................") - self.driver = UiDriver(self.device1) - Step("预置工作:检测屏幕是否亮.................") - self.driver.enable_auto_wakeup(self.device1) - Step("预置工作:滑动解锁.................") - self.driver.swipe(UiParam.UP, side=UiParam.BOTTOM) - Step('设置屏幕常亮') - self.driver.Screen.enable_stay_awake() - Step('获取权限状态') - is_status = self.driver.shell("param get persist.sys.abilityms.multi_process_model") - if ("true" in is_status): - pass - else: - Step('设置权限为true') - self.driver.shell("param set persist.sys.abilityms.multi_process_model true") - Step('重启生效') - self.driver.shell("reboot") - self.driver.System.wait_for_boot_complete() - self.driver.ScreenLock.unlock() - - def test_step1(self): - Step("步骤1:安装测试应用") - hap = Common.sourcepath('entry-default-nativespawn.hap', "SUB_STARTUP_STABILITY_APPSPAWN") - is_hap = self.driver.has_app("com.acts.childprocessmanager") - if(is_hap): - self.driver.uninstall_app("com.acts.childprocessmanager") - else: - pass - self.driver.install_app(hap) - Step("步骤2:打开测试应用") - self.driver.start_app("com.acts.childprocessmanager") - Step("步骤3:点击StartArk用例按钮") - self.driver.touch(BY.text("StartArk用例")) - Step("步骤4:点击start Ark Process按钮") - self.driver.touch(BY.text("Start Ark Process")) - Step("步骤5:获取测试应用pid") - pid = self.driver.System.get_pid("com.acts.childprocessmanager") - Step("步骤6:获取测试应用appspawn孵化子进程pid") - child_pid = self.driver.System.get_pid("com.acts.childprocessmanager:ArkProcess0") - Step("步骤7:查看数据") - res = self.driver.shell("ls -l /proc/%d/ns/net" % pid) - childres = self.driver.shell("ls -l /proc/%d/ns/net" % child_pid) - Step("步骤7:预期结果检验") - arr = res.split("-> ")[1] - childarr = childres.split("-> ")[1] - self.driver.Assert.equal(arr, childarr) - - def teardown(self): - Step("收尾工作:卸载测试应用") - self.driver.uninstall_app("com.acts.childprocessmanager") diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0300.json b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0300.json deleted file mode 100644 index 52c04399192844138443904d9090ea5503e532e6..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0300.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0300.py"] - } -} \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0300.py b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0300.py deleted file mode 100644 index 30963fe61a13ad9a62b57f0c015843b852b50508..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0300.py +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (c) 2025 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.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import UiParam -from hypium.model import UiParam -from aw import Common -import time - - -class SubStartupAppspawnNativespawn0300(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("预置工作:初始化手机开始.................") - self.driver = UiDriver(self.device1) - Step("预置工作:检测屏幕是否亮.................") - self.driver.enable_auto_wakeup(self.device1) - Step("预置工作:滑动解锁.................") - self.driver.swipe(UiParam.UP, side=UiParam.BOTTOM) - Step('设置屏幕常亮') - self.driver.Screen.enable_stay_awake() - Step('获取权限状态') - is_status = self.driver.shell("param get persist.sys.abilityms.multi_process_model") - if ("true" in is_status): - pass - else: - Step('设置权限为true') - self.driver.shell("param set persist.sys.abilityms.multi_process_model true") - Step('重启生效') - self.driver.shell("reboot") - self.driver.System.wait_for_boot_complete() - self.driver.ScreenLock.unlock() - - def test_step1(self): - Step("步骤1:安装测试应用") - hap = Common.sourcepath('entry-default-nativespawn.hap', "SUB_STARTUP_STABILITY_APPSPAWN") - is_hap = self.driver.has_app("com.acts.childprocessmanager") - if(is_hap): - self.driver.uninstall_app("com.acts.childprocessmanager") - else: - pass - self.driver.install_app(hap) - Step("步骤2:打开测试应用") - self.driver.start_app("com.acts.childprocessmanager") - Step("步骤3:点击StartArk用例按钮") - self.driver.touch(BY.text("StartArk用例")) - Step("步骤4:点击start Ark Process按钮") - self.driver.touch(BY.text("Start Ark Process Isolated")) - Step("步骤5:获取测试应用pid") - pid = self.driver.System.get_pid("com.acts.childprocessmanager") - Step("步骤6:获取测试应用appspawn孵化子进程pid") - child_pid = self.driver.System.get_pid("com.acts.childprocessmanager:ArkProcess0") - Step("步骤7:查看数据") - res = self.driver.shell("ls -l /proc/%d/ns/net" % pid) - childres = self.driver.shell("ls -l /proc/%d/ns/net" % child_pid) - Step("步骤7:预期结果检验") - arr = res.split("-> ")[1] - childarr = childres.split("-> ")[1] - self.driver.Assert.not_equal(arr, childarr) - - def teardown(self): - Step("收尾工作:卸载测试应用") - self.driver.uninstall_app("com.acts.childprocessmanager") diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0400.json b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0400.json deleted file mode 100644 index 53ec308d8b07d17a43ec365c74f0d9dc62677784..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0400.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0400.py"] - } -} \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0400.py b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0400.py deleted file mode 100644 index 57bf33a338758ebe4775d142b819010fa9108e70..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0400.py +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (c) 2025 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.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import UiParam -from hypium.model import UiParam -from aw import Common -import time - - -class SubStartupAppspawnNativespawn0400(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("预置工作:初始化手机开始.................") - self.driver = UiDriver(self.device1) - Step("预置工作:检测屏幕是否亮.................") - self.driver.enable_auto_wakeup(self.device1) - Step("预置工作:滑动解锁.................") - self.driver.swipe(UiParam.UP, side=UiParam.BOTTOM) - Step('设置屏幕常亮') - self.driver.Screen.enable_stay_awake() - Step('获取权限状态') - is_status = self.driver.shell("param get persist.sys.abilityms.multi_process_model") - if ("true" in is_status): - pass - else: - Step('设置权限为true') - self.driver.shell("param set persist.sys.abilityms.multi_process_model true") - Step('重启生效') - self.driver.shell("reboot") - self.driver.System.wait_for_boot_complete() - self.driver.ScreenLock.unlock() - - def test_step1(self): - Step("步骤1:安装测试应用") - hap = Common.sourcepath('entry-default-nativespawn.hap', "SUB_STARTUP_STABILITY_APPSPAWN") - is_hap = self.driver.has_app("com.acts.childprocessmanager") - if(is_hap): - self.driver.uninstall_app("com.acts.childprocessmanager") - else: - pass - self.driver.install_app(hap) - Step("步骤2:打开测试应用") - self.driver.start_app("com.acts.childprocessmanager") - Step("步骤3:点击StartArk用例按钮") - self.driver.touch(BY.text("StartArk用例")) - Step("步骤4:点击start Ark Process按钮") - self.driver.touch(BY.text("start Native Process")) - Step("步骤5:获取测试应用pid") - pid = self.driver.System.get_pid("com.acts.childprocessmanager") - Step("步骤6:获取测试应用nativespawn孵化子进程pid") - child_pid = self.driver.System.get_pid("com.acts.childprocessmanager:Native_libentry0") - Step("步骤7:查看数据") - res = self.driver.shell("ls -l /proc/%d/ns/net" % pid) - childres = self.driver.shell("ls -l /proc/%d/ns/net" % child_pid) - Step("步骤7:预期结果检验") - arr = res.split("-> ")[1] - childarr = childres.split("-> ")[1] - self.driver.Assert.equal(arr, childarr) - - def teardown(self): - Step("收尾工作:卸载测试应用") - self.driver.uninstall_app("com.acts.childprocessmanager") diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0500.json b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0500.json deleted file mode 100644 index 8ac0c9f06308f5d28576051d995679d6abbab164..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0500.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0500.py"] - } -} \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0500.py b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0500.py deleted file mode 100644 index c01985d2a74eef7d59896520cb42494efd52e83d..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0500.py +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (c) 2025 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.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import UiParam -from hypium.model import UiParam -from aw import Common -import time - - -class SubStartupAppspawnNativespawn0500(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("预置工作:初始化手机开始.................") - self.driver = UiDriver(self.device1) - Step("预置工作:检测屏幕是否亮.................") - self.driver.enable_auto_wakeup(self.device1) - Step("预置工作:滑动解锁.................") - self.driver.swipe(UiParam.UP, side=UiParam.BOTTOM) - Step('设置屏幕常亮') - self.driver.Screen.enable_stay_awake() - Step('获取权限状态') - is_status = self.driver.shell("param get persist.sys.abilityms.multi_process_model") - if ("true" in is_status): - pass - else: - Step('设置权限为true') - self.driver.shell("param set persist.sys.abilityms.multi_process_model true") - Step('重启生效') - self.driver.shell("reboot") - self.driver.System.wait_for_boot_complete() - self.driver.ScreenLock.unlock() - - def test_step1(self): - Step("步骤1:安装测试应用") - hap = Common.sourcepath('entry-default-nativespawn.hap', "SUB_STARTUP_STABILITY_APPSPAWN") - is_hap = self.driver.has_app("com.acts.childprocessmanager") - if(is_hap): - self.driver.uninstall_app("com.acts.childprocessmanager") - else: - pass - self.driver.install_app(hap) - Step("步骤2:打开测试应用") - self.driver.start_app("com.acts.childprocessmanager") - Step("步骤3:点击StartArk用例按钮") - self.driver.touch(BY.text("StartArk用例")) - Step("步骤4:点击start Ark Process按钮") - self.driver.touch(BY.text("start Native Process Isolated")) - Step("步骤5:获取测试应用pid") - pid = self.driver.System.get_pid("com.acts.childprocessmanager") - Step("步骤6:获取测试应用nativespawn孵化子进程pid") - child_pid = self.driver.System.get_pid("com.acts.childprocessmanager:Native_libentry0") - Step("步骤7:查看数据") - res = self.driver.shell("ls -l /proc/%d/ns/net" % pid) - childres = self.driver.shell("ls -l /proc/%d/ns/net" % child_pid) - Step("步骤7:预期结果检验") - arr = res.split("-> ")[1] - childarr = childres.split("-> ")[1] - self.driver.Assert.not_equal(arr, childarr) - - def teardown(self): - Step("收尾工作:卸载测试应用") - self.driver.uninstall_app("com.acts.childprocessmanager") diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0700.json b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0700.json deleted file mode 100644 index e524f783a15c0c75bb3222b7b085dbc8404340cf..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0700.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0700.py"] - } -} \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0700.py b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0700.py deleted file mode 100644 index 159ff680f3f70eacf7dd5ddfc18c2528b1235bdf..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0700.py +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (c) 2025 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.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import UiParam -from hypium.model import UiParam -from aw import Common -import time - - -class SubStartupAppspawnNativespawn0700(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("预置工作:初始化手机开始.................") - self.driver = UiDriver(self.device1) - Step("预置工作:检测屏幕是否亮.................") - self.driver.enable_auto_wakeup(self.device1) - Step("预置工作:滑动解锁.................") - self.driver.swipe(UiParam.UP, side=UiParam.BOTTOM) - Step('设置屏幕常亮') - self.driver.Screen.enable_stay_awake() - Step('获取权限状态') - is_status = self.driver.shell("param get persist.sys.abilityms.multi_process_model") - if ("true" in is_status): - pass - else: - Step('设置权限为true') - self.driver.shell("param set persist.sys.abilityms.multi_process_model true") - Step('重启生效') - self.driver.shell("reboot") - self.driver.System.wait_for_boot_complete() - self.driver.ScreenLock.unlock() - - def test_step1(self): - Step("步骤1:安装测试应用") - hap = Common.sourcepath('entry-default-nativespawn.hap', "SUB_STARTUP_STABILITY_APPSPAWN") - is_hap = self.driver.has_app("com.acts.childprocessmanager") - if(is_hap): - self.driver.uninstall_app("com.acts.childprocessmanager") - else: - pass - self.driver.install_app(hap) - Step("步骤2:打开测试应用") - self.driver.start_app("com.acts.childprocessmanager") - Step("步骤3:点击StartArk用例按钮") - self.driver.touch(BY.text("StartArk用例")) - Step("步骤4:点击start Ark Process按钮") - self.driver.touch(BY.text("Start Ark Process Isolated")) - Step("步骤5:获取测试应用pid") - pid = self.driver.System.get_pid("com.acts.childprocessmanager") - Step("步骤6:获取测试应用appspawn孵化子进程pid") - child_pid = self.driver.System.get_pid("com.acts.childprocessmanager:ArkProcess0") - Step("步骤7:测试应用沙箱路径data/storage/el1生成一个123.txt") - self.driver.shell("echo 123456789 > /proc/%d/root/data/storage/el1/123.txt" % pid) - Step("步骤8:测试应用appspawn孵化子进程查看沙箱路径data/storage/el1") - childres = self.driver.shell("cat /proc/%d/root/data/storage/el1/123.txt" % child_pid) - Step("步骤8:预期结果检验") - self.driver.Assert.contains(childres, "root/data/storage/el1/123.txt: No such file or directory") - self.driver.shell("rm -rf /proc/%d/root/data/storage/el1/123.txt" % pid) - - def teardown(self): - Step("收尾工作:卸载测试应用") - self.driver.uninstall_app("com.acts.childprocessmanager") \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0900.json b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0900.json deleted file mode 100644 index 4dadc000629fa9eb1a8283f6a2bd8369c3a1496a..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0900.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0900.py"] - } -} \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0900.py b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0900.py deleted file mode 100644 index e425e2310d73fb145cd803d7c94c8c26a388e080..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_0900.py +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright (c) 2025 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.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import UiParam -from hypium.model import UiParam -from aw import Common -import time - - -class SubStartupAppspawnNativespawn0900(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("预置工作:初始化手机开始.................") - self.driver = UiDriver(self.device1) - Step("预置工作:检测屏幕是否亮.................") - self.driver.enable_auto_wakeup(self.device1) - Step("预置工作:滑动解锁.................") - self.driver.swipe(UiParam.UP, side=UiParam.BOTTOM) - Step('设置屏幕常亮') - self.driver.Screen.enable_stay_awake() - Step('获取权限状态') - is_status = self.driver.shell("param get persist.sys.abilityms.multi_process_model") - if ("true" in is_status): - pass - else: - Step('设置权限为true') - self.driver.shell("param set persist.sys.abilityms.multi_process_model true") - Step('重启生效') - self.driver.shell("reboot") - self.driver.System.wait_for_boot_complete() - self.driver.ScreenLock.unlock() - - def test_step1(self): - Step("步骤1:安装测试应用") - hap = Common.sourcepath('entry-default-nativespawn.hap', "SUB_STARTUP_STABILITY_APPSPAWN") - is_hap = self.driver.has_app("com.acts.childprocessmanager") - if(is_hap): - self.driver.uninstall_app("com.acts.childprocessmanager") - else: - pass - self.driver.install_app(hap) - Step("步骤2:打开测试应用") - self.driver.start_app("com.acts.childprocessmanager") - Step("步骤3:点击StartArk用例按钮") - self.driver.touch(BY.text("StartArk用例")) - Step("步骤4:点击start Ark Process Isolated按钮") - self.driver.touch(BY.text("start Native Process Isolated")) - Step("步骤5:获取测试应用pid") - pid = self.driver.System.get_pid("com.acts.childprocessmanager") - Step("步骤6:获取测试应用孵化native进程pid") - child_pid = self.driver.System.get_pid("com.acts.childprocessmanager:Native_libentry0") - Step("步骤7:测试应用沙箱路径data/storage/el1生成一个123.txt") - self.driver.shell("echo 0123456789 > /proc/%d/root/data/storage/el1/123.txt" % pid) - Step("步骤8:测试应用孵化native进程查看沙箱路径data/storage/el1") - childres = self.driver.shell("cat /proc/%d/root/data/storage/el1/123.txt" % child_pid) - Step("步骤8:预期结果检验") - self.driver.Assert.contains(childres, "root/data/storage/el1/123.txt: No such file or directory") - self.driver.shell("rm -rf /proc/%d/root/data/storage/el1/123.txt" % pid) - - - def teardown(self): - Step("收尾工作:卸载测试应用") - self.driver.uninstall_app("com.acts.childprocessmanager") - diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1000.json b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1000.json deleted file mode 100644 index 65eb9d6c961e652a5e13c7afe70202a36aa39673..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1000.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1000.py"] - } -} \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1000.py b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1000.py deleted file mode 100644 index 5041713f21bf2a9eb665155d70394fcfe7bb96df..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1000.py +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright (c) 2025 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.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import UiParam -from hypium.model import UiParam -from aw import Common -import time - - -class SubStartupAppspawnNativespawn1000(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("预置工作:初始化手机开始.................") - self.driver = UiDriver(self.device1) - Step("预置工作:检测屏幕是否亮.................") - self.driver.enable_auto_wakeup(self.device1) - Step("预置工作:滑动解锁.................") - self.driver.swipe(UiParam.UP, side=UiParam.BOTTOM) - Step('设置屏幕常亮') - self.driver.Screen.enable_stay_awake() - Step('获取权限状态') - is_status = self.driver.shell("param get persist.sys.abilityms.multi_process_model") - if ("true" in is_status): - pass - else: - Step('设置权限为true') - self.driver.shell("param set persist.sys.abilityms.multi_process_model true") - Step('重启生效') - self.driver.shell("reboot") - self.driver.System.wait_for_boot_complete() - self.driver.ScreenLock.unlock() - - def test_step1(self): - Step("步骤1:安装测试应用") - hap = Common.sourcepath('entry-default-nativespawn.hap', "SUB_STARTUP_STABILITY_APPSPAWN") - is_hap = self.driver.has_app("com.acts.childprocessmanager") - if(is_hap): - self.driver.uninstall_app("com.acts.childprocessmanager") - else: - pass - self.driver.install_app(hap) - Step("步骤2:打开测试应用") - self.driver.start_app("com.acts.childprocessmanager") - Step("步骤3:点击StartArk用例按钮") - self.driver.touch(BY.text("StartArk用例")) - Step("步骤4:点击start Ark Process按钮") - self.driver.touch(BY.text("Start Ark Process")) - Step("步骤5:获取测试应用pid") - pid = self.driver.System.get_pid("com.acts.childprocessmanager") - Step("步骤6:获取测试应用appspawn孵化子进程pid") - child_pid = self.driver.System.get_pid("com.acts.childprocessmanager:ArkProcess0") - Step("步骤7:测试应用沙箱路径data/storage/el1/bundle目录下,创建2个文件夹") - self.driver.shell("mkdir /proc/%d/root/data/storage/el1/bundle/test1 /proc/%d/root/data/storage/el1/bundle/test2" % (pid, pid)) - Step("步骤8:测试应用沙箱路径data/storage/el1/bundle/tets1,创建1个test.txt文件") - self.driver.shell("echo this is test1 > /proc/%d/root/data/storage/el1/bundle/test1/test.txt" % pid) - Step("步骤9:test1挂载test2") - self.driver.shell("mount /proc/%d/root/data/storage/el1/bundle/test1 /proc/%d/root/data/storage/el1/bundle/test2" % (pid, pid)) - Step("步骤10:查看test2目录下的文件是否和test1内容一致") - res = self.driver.shell("cat /proc/%d/root/data/storage/el1/bundle/test2/test.txt" % pid) - Step("步骤11:测试应用appspawn孵化子进程查看沙箱路径data/storage/el1/bundle/test2/test.txt") - childres = self.driver.shell("cat /proc/%d/root/data/storage/el1/bundle/test2/test.txt" % child_pid) - Step("步骤12:预期结果检验") - self.driver.Assert.contains(res, "this is test1") - self.driver.Assert.contains(childres, "root/data/storage/el1/bundle/test2/test.txt: No such file or directory") - self.driver.shell("rm -rf /proc/%d/root/data/storage/el1/bundle/test1 /proc/%d/root/data/storage/el1/bundle/test2" % (pid, pid)) - - - def teardown(self): - Step("收尾工作:卸载测试应用") - self.driver.uninstall_app("com.acts.childprocessmanager") - diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1100.json b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1100.json deleted file mode 100644 index 52e18e1cf4fedf7b60ecb9c09d2c7c3428a40252..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1100.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1100.py"] - } -} \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1100.py b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1100.py deleted file mode 100644 index 3d6179da2b7e4c128d71408f0866d1093ee85783..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1100.py +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright (c) 2025 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.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import UiParam -from hypium.model import UiParam -from aw import Common -import time - - -class SubStartupAppspawnNativespawn1100(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("预置工作:初始化手机开始.................") - self.driver = UiDriver(self.device1) - Step("预置工作:检测屏幕是否亮.................") - self.driver.enable_auto_wakeup(self.device1) - Step("预置工作:滑动解锁.................") - self.driver.swipe(UiParam.UP, side=UiParam.BOTTOM) - Step('设置屏幕常亮') - self.driver.Screen.enable_stay_awake() - Step('获取权限状态') - is_status = self.driver.shell("param get persist.sys.abilityms.multi_process_model") - if ("true" in is_status): - pass - else: - Step('设置权限为true') - self.driver.shell("param set persist.sys.abilityms.multi_process_model true") - Step('重启生效') - self.driver.shell("reboot") - self.driver.System.wait_for_boot_complete() - self.driver.ScreenLock.unlock() - - def test_step1(self): - Step("步骤1:安装测试应用") - hap = Common.sourcepath('entry-default-nativespawn.hap', "SUB_STARTUP_STABILITY_APPSPAWN") - is_hap = self.driver.has_app("com.acts.childprocessmanager") - if(is_hap): - self.driver.uninstall_app("com.acts.childprocessmanager") - else: - pass - self.driver.install_app(hap) - Step("步骤2:打开测试应用") - self.driver.start_app("com.acts.childprocessmanager") - Step("步骤3:点击StartArk用例按钮") - self.driver.touch(BY.text("StartArk用例")) - Step("步骤4:点击start Ark Process Isolated按钮") - self.driver.touch(BY.text("Start Ark Process Isolated")) - Step("步骤5:获取测试应用pid") - pid = self.driver.System.get_pid("com.acts.childprocessmanager") - Step("步骤6:获取测试应用appspawn孵化子进程pid") - child_pid = self.driver.System.get_pid("com.acts.childprocessmanager:ArkProcess0") - Step("步骤7:测试应用沙箱路径data/storage/el1/bundle目录下,创建2个文件夹") - self.driver.shell("mkdir /proc/%d/root/data/storage/el1/bundle/test1 /proc/%d/root/data/storage/el1/bundle/test2" % (pid, pid)) - Step("步骤8:测试应用沙箱路径data/storage/el1/bundle/tets1,创建1个test.txt文件") - self.driver.shell("echo this is test1 > /proc/%d/root/data/storage/el1/bundle/test1/test.txt" % pid) - Step("步骤9:test1挂载test2") - self.driver.shell("mount /proc/%d/root/data/storage/el1/bundle/test1 /proc/%d/root/data/storage/el1/bundle/test2" % (pid, pid)) - Step("步骤10:查看test2目录下的文件是否和test1内容一致") - res = self.driver.shell("cat /proc/%d/root/data/storage/el1/bundle/test2/test.txt" % pid) - Step("步骤11:测试应用appspawn孵化子进程查看沙箱路径data/storage/el1/bundle/test2/test.txt") - childres = self.driver.shell("cat /proc/%d/root/data/storage/el1/bundle/test2/test.txt" % child_pid) - Step("步骤12:预期结果检验") - self.driver.Assert.contains(res, "this is test1") - self.driver.Assert.contains(childres, "root/data/storage/el1/bundle/test2/test.txt: No such file or directory") - self.driver.shell("rm -rf /proc/%d/root/data/storage/el1/bundle/test1 /proc/%d/root/data/storage/el1/bundle/test2" % (pid, pid)) - - - def teardown(self): - Step("收尾工作:卸载测试应用") - self.driver.uninstall_app("com.acts.childprocessmanager") - diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1200.json b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1200.json deleted file mode 100644 index ff9fc37a5ea011ed6a18bcda6687f4ca518c0125..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1200.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1200.py"] - } -} \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1200.py b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1200.py deleted file mode 100644 index 8fcadffd5a1682466704dcd282cf504f312a9a34..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1200.py +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright (c) 2025 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.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import UiParam -from hypium.model import UiParam -from aw import Common -import time - - -class SubStartupAppspawnNativespawn1200(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("预置工作:初始化手机开始.................") - self.driver = UiDriver(self.device1) - Step("预置工作:检测屏幕是否亮.................") - self.driver.enable_auto_wakeup(self.device1) - Step("预置工作:滑动解锁.................") - self.driver.swipe(UiParam.UP, side=UiParam.BOTTOM) - Step('设置屏幕常亮') - self.driver.Screen.enable_stay_awake() - Step('获取权限状态') - is_status = self.driver.shell("param get persist.sys.abilityms.multi_process_model") - if ("true" in is_status): - pass - else: - Step('设置权限为true') - self.driver.shell("param set persist.sys.abilityms.multi_process_model true") - Step('重启生效') - self.driver.shell("reboot") - self.driver.System.wait_for_boot_complete() - self.driver.ScreenLock.unlock() - - def test_step1(self): - Step("步骤1:安装测试应用") - hap = Common.sourcepath('entry-default-nativespawn.hap', "SUB_STARTUP_STABILITY_APPSPAWN") - is_hap = self.driver.has_app("com.acts.childprocessmanager") - if(is_hap): - self.driver.uninstall_app("com.acts.childprocessmanager") - else: - pass - self.driver.install_app(hap) - Step("步骤2:打开测试应用") - self.driver.start_app("com.acts.childprocessmanager") - Step("步骤3:点击StartArk用例按钮") - self.driver.touch(BY.text("StartArk用例")) - Step("步骤4:点击start Native Process按钮") - self.driver.touch(BY.text("start Native Process")) - Step("步骤5:获取测试应用pid") - pid = self.driver.System.get_pid("com.acts.childprocessmanager") - Step("步骤6:孵化native子进程pid") - child_pid = self.driver.System.get_pid("com.acts.childprocessmanager:Native_libentry0") - Step("步骤7:测试应用沙箱路径data/storage/el1/bundle目录下,创建2个文件夹") - self.driver.shell("mkdir /proc/%d/root/data/storage/el1/bundle/zsj1 /proc/%d/root/data/storage/el1/bundle/zsj2" % (pid, pid)) - Step("步骤8:测试应用沙箱路径data/storage/el1/bundle/tets1,创建1个zsj.txt文件") - self.driver.shell("echo this is zsj1 > /proc/%d/root/data/storage/el1/bundle/zsj1/zsj.txt" % pid) - Step("步骤9:test1挂载test2") - self.driver.shell("mount /proc/%d/root/data/storage/el1/bundle/zsj1 /proc/%d/root/data/storage/el1/bundle/zsj2" % (pid, pid)) - Step("步骤10:查看test2目录下的文件是否和test1内容一致") - res = self.driver.shell("cat /proc/%d/root/data/storage/el1/bundle/zsj2/zsj.txt" % pid) - Step("步骤11:孵化native子进程查看沙箱路径data/storage/el1/bundle/zsj2/zsj.txt") - childres = self.driver.shell("cat /proc/%d/root/data/storage/el1/bundle/zsj2/zsj.txt" % child_pid) - Step("步骤12:预期结果检验") - self.driver.Assert.contains(res, "this is zsj1") - self.driver.Assert.contains(childres, "root/data/storage/el1/bundle/zsj2/zsj.txt: No such file or directory") - self.driver.shell("rm -rf /proc/%d/root/data/storage/el1/bundle/zsj1 /proc/%d/root/data/storage/el1/bundle/zsj2" % (pid, pid)) - - - def teardown(self): - Step("收尾工作:卸载测试应用") - self.driver.uninstall_app("com.acts.childprocessmanager") - diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1300.json b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1300.json deleted file mode 100644 index 060f23479bd1ec68b5d37d14402393a99bb06ece..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1300.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1300.py"] - } -} \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1300.py b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1300.py deleted file mode 100644 index 29eaca606886fbc505cbbe1c0139bd7e7a86597d..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1300.py +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright (c) 2025 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.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import UiParam -from hypium.model import UiParam -from aw import Common -import time - - -class SubStartupAppspawnNativespawn1300(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("预置工作:初始化手机开始.................") - self.driver = UiDriver(self.device1) - Step("预置工作:检测屏幕是否亮.................") - self.driver.enable_auto_wakeup(self.device1) - Step("预置工作:滑动解锁.................") - self.driver.swipe(UiParam.UP, side=UiParam.BOTTOM) - Step('设置屏幕常亮') - self.driver.Screen.enable_stay_awake() - Step('获取权限状态') - is_status = self.driver.shell("param get persist.sys.abilityms.multi_process_model") - if ("true" in is_status): - pass - else: - Step('设置权限为true') - self.driver.shell("param set persist.sys.abilityms.multi_process_model true") - Step('重启生效') - self.driver.shell("reboot") - self.driver.System.wait_for_boot_complete() - self.driver.ScreenLock.unlock() - - def test_step1(self): - Step("步骤1:安装测试应用") - hap = Common.sourcepath('entry-default-nativespawn.hap', "SUB_STARTUP_STABILITY_APPSPAWN") - is_hap = self.driver.has_app("com.acts.childprocessmanager") - if(is_hap): - self.driver.uninstall_app("com.acts.childprocessmanager") - else: - pass - self.driver.install_app(hap) - Step("步骤2:打开测试应用") - self.driver.start_app("com.acts.childprocessmanager") - Step("步骤3:点击StartArk用例按钮") - self.driver.touch(BY.text("StartArk用例")) - Step("步骤4:点击start Native Process Isolated按钮") - self.driver.touch(BY.text("start Native Process Isolated")) - Step("步骤5:获取测试应用pid") - pid = self.driver.System.get_pid("com.acts.childprocessmanager") - Step("步骤6:获取孵化native子进程pid") - child_pid = self.driver.System.get_pid("com.acts.childprocessmanager:Native_libentry0") - Step("步骤7:测试应用沙箱路径data/storage/el1/bundle目录下,创建2个文件夹") - self.driver.shell("mkdir /proc/%d/root/data/storage/el1/bundle/zsj1 /proc/%d/root/data/storage/el1/bundle/zsj2" % (pid, pid)) - Step("步骤8:测试应用沙箱路径data/storage/el1/bundle/tets1,创建1个zsj.txt文件") - self.driver.shell("echo this is zsj1 > /proc/%d/root/data/storage/el1/bundle/zsj1/zsj.txt" % pid) - Step("步骤9:test1挂载test2") - self.driver.shell("mount /proc/%d/root/data/storage/el1/bundle/zsj1 /proc/%d/root/data/storage/el1/bundle/zsj2" % (pid, pid)) - Step("步骤10:查看test2目录下的文件是否和test1内容一致") - res = self.driver.shell("cat /proc/%d/root/data/storage/el1/bundle/zsj2/zsj.txt" % pid) - Step("步骤11:孵化native子进程查看沙箱路径data/storage/el1/bundle/zsj2/zsj.txt") - childres = self.driver.shell("cat /proc/%d/root/data/storage/el1/bundle/zsj2/zsj.txt" % child_pid) - Step("步骤12:预期结果检验") - self.driver.Assert.contains(res, "this is zsj1") - self.driver.Assert.contains(childres, "root/data/storage/el1/bundle/zsj2/zsj.txt: No such file or directory") - self.driver.shell("rm -rf /proc/%d/root/data/storage/el1/bundle/zsj1 /proc/%d/root/data/storage/el1/bundle/zsj2" % (pid, pid)) - - - def teardown(self): - Step("收尾工作:卸载测试应用") - self.driver.uninstall_app("com.acts.childprocessmanager") - diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1400.json b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1400.json deleted file mode 100644 index 6b1aade8c9e12af961bca1127ab8ca3ca9f84204..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1400.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1400.py"] - } -} \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1400.py b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1400.py deleted file mode 100644 index 71c95199cfe295801308a5aba0c3e9fcc3dff745..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1400.py +++ /dev/null @@ -1,90 +0,0 @@ -# Copyright (c) 2025 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.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import UiParam -from hypium.model import UiParam -from aw import Common -import time - - -class SubStartupAppspawnNativespawn1400(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("预置工作:初始化手机开始.................") - self.driver = UiDriver(self.device1) - Step("预置工作:检测屏幕是否亮.................") - self.driver.enable_auto_wakeup(self.device1) - Step("预置工作:滑动解锁.................") - self.driver.swipe(UiParam.UP, side=UiParam.BOTTOM) - Step('设置屏幕常亮') - self.driver.Screen.enable_stay_awake() - Step('获取权限状态') - is_status = self.driver.shell("param get persist.sys.abilityms.multi_process_model") - if ("true" in is_status): - pass - else: - Step('设置权限为true') - self.driver.shell("param set persist.sys.abilityms.multi_process_model true") - Step('重启生效') - self.driver.shell("reboot") - self.driver.System.wait_for_boot_complete() - self.driver.ScreenLock.unlock() - - def test_step1(self): - Step("步骤1:安装测试应用") - hap = Common.sourcepath('entry-default-nativespawn.hap', "SUB_STARTUP_STABILITY_APPSPAWN") - is_hap = self.driver.has_app("com.acts.childprocessmanager") - if(is_hap): - self.driver.uninstall_app("com.acts.childprocessmanager") - else: - pass - self.driver.install_app(hap) - Step("步骤2:打开测试应用") - self.driver.start_app("com.acts.childprocessmanager") - Step("步骤3:点击StartArk用例按钮") - self.driver.touch(BY.text("StartArk用例")) - Step("步骤4:点击start Ark Process Isolated按钮") - self.driver.touch(BY.text("start Native Process Isolated")) - Step("步骤5:获取测试应用pid") - self.driver.System.get_pid("com.acts.childprocessmanager") - Step("步骤6:获取测试应用孵化native进程pid") - child_pid 1 = self.driver.System.get_pid("com.acts.childprocessmanager:Native_libentry0") - Step("步骤7:测试应用沙箱路径data/storage/el1生成一个native.txt") - self.driver.shell("echo this is native1 > /proc/%d/root/data/storage/el1/native.txt" % child_pid 1) - childres = self.driver.shell("cat /proc/%d/root/data/storage/el1/native.txt" % child_pid 1) - Step("步骤8:杀死孵化native进程") - self.driver.shell("kill -9 %d" % child_pid 1) - Step("步骤9:再次点击start Ark Process Isolated按钮") - self.driver.touch(BY.text("start Native Process Isolated")) - Step("步骤10:测试应用孵化native进程查看沙箱路径data/storage/el1") - child_pid 2 = self.driver.System.get_pid("com.acts.childprocessmanager:Native_libentry1") - childres2 = self.driver.shell("cat /proc/%d/root/data/storage/el1/native.txt" % child_pid 2) - Step("步骤11:预期结果检验") - self.driver.Assert.contains(childres, "this is native1") - self.driver.Assert.contains(childres2, "this is native1") - self.driver.shell("rm -rf /proc/%d/root/data/storage/el1/native.txt" % child_pid 2) - - def teardown(self): - Step("收尾工作:卸载测试应用") - self.driver.uninstall_app("com.acts.childprocessmanager") - diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1500.json b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1500.json deleted file mode 100644 index 851b51223a6fe81b8ff8bf3e97467f52acd300a3..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1500.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1500.py"] - } -} \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1500.py b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1500.py deleted file mode 100644 index dc71daf44fb956265c5b5579d7fe275519992b1c..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1500.py +++ /dev/null @@ -1,85 +0,0 @@ -# Copyright (c) 2025 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.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import UiParam -from hypium.model import UiParam -from aw import Common -import time - - -class SubStartupAppspawnNativespawn1500(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("预置工作:初始化手机开始.................") - self.driver = UiDriver(self.device1) - Step("预置工作:检测屏幕是否亮.................") - self.driver.enable_auto_wakeup(self.device1) - Step("预置工作:滑动解锁.................") - self.driver.swipe(UiParam.UP, side=UiParam.BOTTOM) - Step('设置屏幕常亮') - self.driver.Screen.enable_stay_awake() - Step('获取权限状态') - is_status = self.driver.shell("param get persist.sys.abilityms.multi_process_model") - if ("true" in is_status): - pass - else: - Step('设置权限为true') - self.driver.shell("param set persist.sys.abilityms.multi_process_model true") - Step('重启生效') - self.driver.shell("reboot") - self.driver.System.wait_for_boot_complete() - self.driver.ScreenLock.unlock() - - def test_step1(self): - Step("步骤1:安装测试应用") - hap = Common.sourcepath('entry-default-nativespawn.hap', "SUB_STARTUP_STABILITY_APPSPAWN") - is_hap = self.driver.has_app("com.acts.childprocessmanager") - if(is_hap): - self.driver.uninstall_app("com.acts.childprocessmanager") - else: - pass - self.driver.install_app(hap) - Step("步骤2:打开测试应用") - self.driver.start_app("com.acts.childprocessmanager") - Step("步骤3:点击StartArk用例按钮") - self.driver.touch(BY.text("StartArk用例")) - Step("步骤4:点击start Ark Process Isolated按钮") - self.driver.touch(BY.text("start Native Process Isolated")) - Step("步骤5:获取测试应用pid") - pid = self.driver.System.get_pid("com.acts.childprocessmanager") - Step("步骤6:获取测试应用孵化native进程pid") - child_pid 1 = self.driver.System.get_pid("com.acts.childprocessmanager:Native_libentry0") - Step("步骤7:杀死nativespawn进程") - self.driver.shell("kill -9 `pidof nativespawn`") - Step("步骤8:查询测试应用") - result = self.driver.shell("ps -ef | grep com.acts.childprocessmanager") - Step("步骤9:查询nativespawn进程号") - nativepid = self.driver.System.get_pid("nativespawn") - self.driver.Assert.contains(result, str(child_pid 1)) - self.driver.Assert.contains(result, str(pid)) - self.driver.Assert.equal(nativepid, None) - - def teardown(self): - Step("收尾工作:卸载测试应用") - self.driver.uninstall_app("com.acts.childprocessmanager") - diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1600.json b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1600.json deleted file mode 100644 index 749e6f9959947b54f173657a1c4b3a4dd03c8515..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1600.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1600.py"] - } -} \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1600.py b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1600.py deleted file mode 100644 index 4a3bc803cc34df4e138a00f47c17bdeabad9870b..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1600.py +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright (c) 2025 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.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import UiParam -from hypium.model import UiParam -from aw import Common -import time - - -class SubStartupAppspawnNativespawn1600(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("预置工作:初始化手机开始.................") - self.driver = UiDriver(self.device1) - Step("预置工作:检测屏幕是否亮.................") - self.driver.enable_auto_wakeup(self.device1) - Step("预置工作:滑动解锁.................") - self.driver.swipe(UiParam.UP, side=UiParam.BOTTOM) - Step('设置屏幕常亮') - self.driver.Screen.enable_stay_awake() - Step('获取权限状态') - is_status = self.driver.shell("param get persist.sys.abilityms.multi_process_model") - if("true" in is_status): - pass - else: - Step('设置权限为true') - self.driver.shell("param set persist.sys.abilityms.multi_process_model true") - Step('重启生效') - self.driver.shell("reboot") - self.driver.System.wait_for_boot_complete() - self.driver.ScreenLock.unlock() - - def test_step1(self): - Step("步骤1:安装测试应用") - hap = Common.sourcepath('entry-default-nativespawn.hap', "SUB_STARTUP_STABILITY_APPSPAWN") - is_hap = self.driver.has_app("com.acts.childprocessmanager") - if(is_hap): - self.driver.uninstall_app("com.acts.childprocessmanager") - else: - pass - self.driver.install_app(hap) - Step("步骤2:打开测试应用") - self.driver.start_app("com.acts.childprocessmanager") - Step("步骤3:点击StartArk用例按钮") - self.driver.touch(BY.text("StartArk用例")) - Step("步骤4:点击start Ark Process按钮") - self.driver.touch(BY.text("start Native Process Isolated")) - Step("步骤5:获取测试应用nativespawn孵化子进程pid") - time.sleep(1) - child_pid = self.driver.System.get_pid("com.acts.childprocessmanager:Native_libentry0") - Step("步骤6:孵化的native子进程(Isolated=true)selinux标签类型") - childres = self.driver.shell("ps -efZ | grep %d | grep -v grep" % child_pid) - Step("步骤9: 预期结果校验") - self.driver.Assert.contains(childres, "u:r:isolated_render:s0") - - def teardown(self): - Step("收尾工作:卸载测试应用") - self.driver.uninstall_app("com.acts.childprocessmanager") diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1700.json b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1700.json deleted file mode 100644 index 949a2197805fa2395ae8ca5f35ac29dc6b254f0d..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1700.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1700.py"] - } -} \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1700.py b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1700.py deleted file mode 100644 index 58b4c977109c6cc4de6ade43547aedc10b2eb8a0..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1700.py +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright (c) 2025 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.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import UiParam -from hypium.model import UiParam -from aw import Common -import time - - -class SubStartupAppspawnNativespawn1700(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("预置工作:初始化手机开始.................") - self.driver = UiDriver(self.device1) - Step("预置工作:检测屏幕是否亮.................") - self.driver.enable_auto_wakeup(self.device1) - Step("预置工作:滑动解锁.................") - self.driver.swipe(UiParam.UP, side=UiParam.BOTTOM) - Step('设置屏幕常亮') - self.driver.Screen.enable_stay_awake() - Step('获取权限状态') - is_status = self.driver.shell("param get persist.sys.abilityms.multi_process_model") - if ("true" in is_status): - pass - else: - Step('设置权限为true') - self.driver.shell("param set persist.sys.abilityms.multi_process_model true") - Step('重启生效') - self.driver.shell("reboot") - self.driver.System.wait_for_boot_complete() - self.driver.ScreenLock.unlock() - - def test_step1(self): - Step("步骤1:安装测试应用") - hap = Common.sourcepath('entry-default-nativespawn.hap', "SUB_STARTUP_STABILITY_APPSPAWN") - is_hap = self.driver.has_app("com.acts.childprocessmanager") - if(is_hap): - self.driver.uninstall_app("com.acts.childprocessmanager") - else: - pass - self.driver.install_app(hap) - Step("步骤2:打开测试应用") - self.driver.start_app("com.acts.childprocessmanager") - Step("步骤3:点击StartArk用例按钮") - self.driver.touch(BY.text("StartArk用例")) - Step("步骤4:点击start Ark Process按钮") - self.driver.touch(BY.text("start Native Process")) - Step("步骤5:获取测试应用pid") - pid = self.driver.System.get_pid("com.acts.childprocessmanager") - Step("步骤6:获取测试应用nativespawn孵化子进程pid") - child_pid = self.driver.System.get_pid("com.acts.childprocessmanager:Native_libentry0") - Step("步骤7:测试应用selinux标签类型") - res = self.driver.shell("ps -efZ | grep %d | grep -v grep" % pid) - Step("步骤8:孵化的native子进程(Isolated=false)selinux标签类型") - childres = self.driver.shell("ps -efZ | grep %d | grep -v grep" % child_pid) - string = res.split(" ")[0] - child_string = childres.split(" ")[0] - Step("步骤9: 预期结果校验") - self.driver.Assert.equal(string, child_string) - - def teardown(self): - Step("收尾工作:卸载测试应用") - self.driver.uninstall_app("com.acts.childprocessmanager") diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1800.json b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1800.json deleted file mode 100644 index b5bedb14789015eec490b40cd2a9858909dd38d8..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1800.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1800.py"] - } -} \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1800.py b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1800.py deleted file mode 100644 index a1ab55679961bcad0d40d2f3457b0724f2b0ee3a..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1800.py +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright (c) 2025 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.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import UiParam -from hypium.model import UiParam -from aw import Common -import time - - -class SubStartupAppspawnNativespawn1800(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("预置工作:初始化手机开始.................") - self.driver = UiDriver(self.device1) - Step("预置工作:检测屏幕是否亮.................") - self.driver.enable_auto_wakeup(self.device1) - Step("预置工作:滑动解锁.................") - self.driver.swipe(UiParam.UP, side=UiParam.BOTTOM) - Step('设置屏幕常亮') - self.driver.Screen.enable_stay_awake() - Step('获取权限状态') - is_status = self.driver.shell("param get persist.sys.abilityms.multi_process_model") - if ("true" in is_status): - pass - else: - Step('设置权限为true') - self.driver.shell("param set persist.sys.abilityms.multi_process_model true") - Step('重启生效') - self.driver.shell("reboot") - self.driver.System.wait_for_boot_complete() - self.driver.ScreenLock.unlock() - - def test_step1(self): - Step("步骤1:安装测试应用") - hap = Common.sourcepath('entry-default-nativespawn.hap', "SUB_STARTUP_STABILITY_APPSPAWN") - is_hap = self.driver.has_app("com.acts.childprocessmanager") - if(is_hap): - self.driver.uninstall_app("com.acts.childprocessmanager") - else: - pass - self.driver.install_app(hap) - Step("步骤2:打开测试应用") - self.driver.start_app("com.acts.childprocessmanager") - Step("步骤3:点击StartArk用例按钮") - self.driver.touch(BY.text("StartArk用例")) - Step("步骤4:首次获取nativesapwn进程号") - pid1 = self.driver.System.get_pid("nativespawn") - Step("步骤5:点击start Native Process Isolated按钮") - self.driver.touch(BY.text("start Native Process Isolated")) - time.sleep(1) - Step("步骤6:再次点击start Native Process Isolated按钮") - self.driver.touch(BY.text("start Native Process Isolated")) - Step("步骤7:第二次获取nativesapwn进程号") - pid2 = self.driver.System.get_pid("nativespawn") - Step("步骤8:杀掉孵化的一个nativ进程") - child_pid = self.driver.System.get_pid("com.acts.childprocessmanager:Native_libentry0") - self.driver.shell("kill -9 %d" % child_pid) - Step("步骤9:第三次获取nativesapwn进程号") - pid3 = self.driver.System.get_pid("nativespawn") - Step("步骤10:杀掉孵化的最后一个native子进程") - child_pid 1 = self.driver.System.get_pid("com.acts.childprocessmanager:Native_libentry1") - self.driver.shell("kill -9 %d" % child_pid 1) - Step("步骤11:第四次获取nativesapwn进程号") - pid4 = self.driver.System.get_pid("nativespawn") - Step("步骤12:预期结果校验") - self.driver.Assert.equal(pid1, None) - self.driver.Assert.not_equal(pid2, None) - self.driver.Assert.not_equal(pid3, None) - self.driver.Assert.equal(pid4, None) - - def teardown(self): - Step("收尾工作:卸载测试应用") - self.driver.uninstall_app("com.acts.childprocessmanager") \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1900.json b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1900.json deleted file mode 100644 index 77347638d95a1c37628f959e4c5948a95b5346ea..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1900.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1900.py"] - } -} \ No newline at end of file diff --git a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1900.py b/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1900.py deleted file mode 100644 index a4f318c88b170d95141541bdb8ea4531d954be0e..0000000000000000000000000000000000000000 --- a/test/autotest/SubStartupAppspawnNativespawn/sub_startup_appspawn_nativespawn_1900.py +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright (c) 2025 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.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import UiParam -from hypium.model import UiParam -from aw import Common -import time - - -class SubStartupAppspawnNativespawn1900(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("预置工作:初始化手机开始.................") - self.driver = UiDriver(self.device1) - Step("预置工作:检测屏幕是否亮.................") - self.driver.enable_auto_wakeup(self.device1) - Step("预置工作:滑动解锁.................") - self.driver.swipe(UiParam.UP, side=UiParam.BOTTOM) - Step('设置屏幕常亮') - self.driver.Screen.enable_stay_awake() - Step('获取权限状态') - is_status = self.driver.shell("param get persist.sys.abilityms.multi_process_model") - if ("true" in is_status): - pass - else: - Step('设置权限为true') - self.driver.shell("param set persist.sys.abilityms.multi_process_model true") - Step('重启生效') - self.driver.shell("reboot") - self.driver.System.wait_for_boot_complete() - self.driver.ScreenLock.unlock() - - def test_step1(self): - Step("步骤1:安装测试应用") - hap1 = Common.sourcepath('entry-default-nativespawn.hap', "SUB_STARTUP_STABILITY_APPSPAWN") - hap2 = Common.sourcepath('entry-default-nativespawn1.hap', "SUB_STARTUP_STABILITY_APPSPAWN") - is_hap = self.driver.has_app("com.acts.childprocessmanager") - if(is_hap): - self.driver.uninstall_app("com.acts.childprocessmanager") - else: - pass - is_hap = self.driver.has_app("com.acts.childprocessmanager1") - if (is_hap): - self.driver.uninstall_app("com.acts.childprocessmanager1") - else: - pass - self.driver.install_app(hap1) - self.driver.install_app(hap2) - Step("步骤2:打开测试应用1") - self.driver.start_app("com.acts.childprocessmanager") - Step("步骤3:点击StartArk用例按钮") - self.driver.touch(BY.text("StartArk用例")) - Step("步骤4:首次获取nativesapwn进程号") - pid1 = self.driver.System.get_pid("nativespawn") - Step("步骤5:点击start Native Process Isolated按钮") - self.driver.touch(BY.text("start Native Process Isolated")) - Step("步骤6:第二次获取nativesapwn进程号") - pid2 = self.driver.System.get_pid("nativespawn") - Step("步骤7:打开测试应用2") - self.driver.start_app("com.acts.childprocessmanager1") - Step("步骤8:点击StartArk用例按钮") - self.driver.touch(BY.text("StartArk用例")) - Step("步骤9:点击start Native Process Isolated按钮") - self.driver.touch(BY.text("start Native Process Isolated")) - Step("步骤10:关闭测试应用1") - self.driver.stop_app("com.acts.childprocessmanager") - Step("步骤11:第三次获取nativesapwn进程号") - pid3 = self.driver.System.get_pid("nativespawn") - Step("步骤12:关闭测试应用1") - self.driver.stop_app("com.acts.childprocessmanager1") - Step("步骤13:第四次获取nativesapwn进程号") - pid4 = self.driver.System.get_pid("nativespawn") - Step("步骤12:预期结果校验") - self.driver.Assert.equal(pid1, None) - self.driver.Assert.not_equal(pid2, None) - self.driver.Assert.not_equal(pid3, None) - self.driver.Assert.equal(pid4, None) - - def teardown(self): - Step("收尾工作:卸载测试应用") - self.driver.uninstall_app("com.acts.childprocessmanager") - self.driver.uninstall_app("com.acts.childprocessmanager1") \ No newline at end of file diff --git a/test/mock/app_system_stub.c b/test/mock/app_system_stub.c index 6a204c92a348c71693d06a311de62c6a07e8655b..36c0e2bb3941acb9d38c30d35de3bc1bbc27e82a 100644 --- a/test/mock/app_system_stub.c +++ b/test/mock/app_system_stub.c @@ -236,7 +236,7 @@ int AccessStub(const char *pathName, int mode) if (strstr(pathName, "/mnt/sandbox/50/com.example.myapplication/data/storage/el2") != NULL) { return -1; } - if (strstr(pathName, "/mnt/sandbox/100/debug_hap/com.example.myapplication/data/storage/el2") != NULL) { + if (strstr(pathName, "/mnt/debugtmp/100/debug_hap/com.example.myapplication/data/storage/el2") != NULL) { return -1; } if (strstr(pathName, "/data/app/el5/100/base/com.example.myapplication") != NULL) { diff --git a/test/unittest/app_spawn_standard_test/app_spawn_silk_test.cpp b/test/unittest/app_spawn_standard_test/app_spawn_silk_test.cpp index 475eb46342e004c0e7115db9f1f5fe04af4c5476..4efcffbbc8bf86bf9ea47e69395ed9ce3c6fa230 100644 --- a/test/unittest/app_spawn_standard_test/app_spawn_silk_test.cpp +++ b/test/unittest/app_spawn_standard_test/app_spawn_silk_test.cpp @@ -16,11 +16,11 @@ #include #include "appspawn_utils.h" +#include "cJSON.h" #ifdef __cplusplus extern "C" { #endif -#include "cJSON.h" #include "appspawn_silk.h" extern struct SilkConfig g_silkConfig; @@ -46,12 +46,12 @@ HWTEST_F(ParseSilkConfigTest, Parse_Silk_Config_001, TestSize.Level0) { const char *silkJsonStr = "{\"enabled_app_list\":[\"com.taobao.taobao\",\"com.tencent.mm\"]}"; cJSON *root = cJSON_Parse(silkJsonStr); - const char* testEnableSilkProcessName = "com.taobao.taobao"; + const char* TEST_ENABLE_SILK_PROCESS_NAME = "com.taobao.taobao"; bool ret = ParseSilkConfig(root, &g_silkConfig); cJSON_Delete(root); ASSERT_EQ(ret, true); ASSERT_EQ(g_silkConfig.configCursor, 2); - ret = LoadSilkLibrary(testEnableSilkProcessName); + ret = LoadSilkLibrary(TEST_ENABLE_SILK_PROCESS_NAME); ASSERT_EQ(ret, true); ASSERT_EQ(g_silkConfig.configItems, NULL); ASSERT_EQ(g_silkConfig.configCursor, 0); @@ -65,12 +65,12 @@ HWTEST_F(ParseSilkConfigTest, Parse_Silk_Config_002, TestSize.Level0) { const char *silkJsonStr = "{\"enabled_app_list\":[\"com.taobao.taobao\",\"com.tencent.mm\"]}"; cJSON *root = cJSON_Parse(silkJsonStr); - const char* testEnableSilkProcessName = NULL; + const char* TEST_ENABLE_SILK_PROCESS_NAME = NULL; bool ret = ParseSilkConfig(root, &g_silkConfig); cJSON_Delete(root); ASSERT_EQ(ret, true); ASSERT_EQ(g_silkConfig.configCursor, 2); - ret = LoadSilkLibrary(testEnableSilkProcessName); + ret = LoadSilkLibrary(TEST_ENABLE_SILK_PROCESS_NAME); ASSERT_EQ(ret, false); ASSERT_EQ(g_silkConfig.configItems, NULL); ASSERT_EQ(g_silkConfig.configCursor, 0);