From f3a3078e7f934c0019cb6c1ef3a2c5abc13c5d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A8=8A=E6=99=AF=E4=B9=90?= Date: Thu, 11 Sep 2025 11:03:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8D=E4=B8=80=E8=87=B4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 樊景乐 --- ...ub_startup_appspawn_atomservice_0100.json} | 2 +- .../sub_startup_appspawn_atomservice_0100.py} | 75 +- ...ub_startup_appspawn_atomservice_0300.json} | 2 +- .../sub_startup_appspawn_atomservice_0300.py} | 35 +- .../appspawn_appmgr_autotest.cpp | 946 ------------------ .../appspawn_kickdog_autotest.cpp | 213 ---- .../sub_startup_appspawn_cgroups_0100.py | 75 -- .../sub_startup_appspawn_coldstart_0100.json | 15 - .../sub_startup_appspawn_coldstart_0100.py | 59 -- ...startup_appspawn_coldstartablity_0100.json | 15 - ...b_startup_appspawn_coldstartablity_0100.py | 61 -- ...startup_appspawn_coldstartablity_0200.json | 15 - ...b_startup_appspawn_coldstartablity_0200.py | 60 -- .../sub_startup_appspawn_debughap_0200.json | 14 - .../sub_startup_appspawn_debughap_0200.py | 64 -- .../sub_startup_appspawn_debughap_0300.json | 14 - .../sub_startup_appspawn_debughap_0300.py | 79 -- .../sub_startup_appspawn_debughap_0500.json | 14 - .../sub_startup_appspawn_debughap_0600.json | 15 - .../sub_startup_appspawn_debughap_0700.json | 15 - .../sub_startup_appspawn_debughap_0800.json | 14 - .../sub_startup_appspawn_debughap_0800.py | 104 -- .../sub_startup_appspawn_debughap_0900.json | 14 - ...ub_startup_appspawn_devicedebug_0100.json} | 2 +- .../sub_startup_appspawn_devicedebug_0100.py} | 30 +- ...ub_startup_appspawn_devicedebug_0200.json} | 2 +- .../sub_startup_appspawn_devicedebug_0200.py} | 30 +- ...sub_startup_appspawn_devicedebug_0300.json | 14 + .../sub_startup_appspawn_devicedebug_0300.py} | 52 +- ...sub_startup_appspawn_devicedebug_0400.json | 14 + .../sub_startup_appspawn_devicedebug_0400.py | 88 ++ ...sub_startup_appspawn_devicedebug_0500.json | 14 + .../sub_startup_appspawn_devicedebug_0500.py} | 29 +- ...sub_startup_appspawn_devicedebug_0600.json | 14 + .../sub_startup_appspawn_devicedebug_0600.py} | 40 +- ...sub_startup_appspawn_devicedebug_0700.json | 14 + .../sub_startup_appspawn_devicedebug_0700.py} | 29 +- ...sub_startup_appspawn_devicedebug_0800.json | 14 + .../sub_startup_appspawn_devicedebug_0800.py} | 35 +- ...sub_startup_appspawn_devicedebug_0900.json | 14 + .../sub_startup_appspawn_devicedebug_0900.py} | 32 +- ...startup_appspawn_filemgr_sandbox_0100.json | 14 - ...b_startup_appspawn_filemgr_sandbox_0100.py | 61 -- ...startup_appspawn_filemgr_sandbox_0200.json | 14 - ...b_startup_appspawn_filemgr_sandbox_0200.py | 61 -- ...startup_appspawn_filemgr_sandbox_0300.json | 14 - ...b_startup_appspawn_filemgr_sandbox_0300.py | 61 -- ...startup_appspawn_filemgr_sandbox_0400.json | 14 - ...startup_appspawn_filemgr_sandbox_0500.json | 14 - ...b_startup_appspawn_filemgr_sandbox_0500.py | 64 -- ...startup_appspawn_filemgr_sandbox_0600.json | 14 - ...startup_appspawn_filemgr_sandbox_0700.json | 14 - ...b_startup_appspawn_filemgr_sandbox_0700.py | 63 -- ...startup_appspawn_filemgr_sandbox_0800.json | 14 - ...b_startup_appspawn_filemgr_sandbox_0800.py | 63 -- ...startup_appspawn_filemgr_sandbox_0900.json | 14 - ...b_startup_appspawn_filemgr_sandbox_0900.py | 63 -- ...startup_appspawn_filemgr_sandbox_1000.json | 14 - ...b_startup_appspawn_filemgr_sandbox_1000.py | 61 -- ...startup_appspawn_filemgr_sandbox_1100.json | 14 - ...b_startup_appspawn_filemgr_sandbox_1100.py | 61 -- ...startup_appspawn_filemgr_sandbox_1200.json | 14 - ...b_startup_appspawn_filemgr_sandbox_1200.py | 61 -- ...startup_appspawn_filemgr_sandbox_1300.json | 14 - ...b_startup_appspawn_filemgr_sandbox_1300.py | 59 -- ...startup_appspawn_filemgr_sandbox_1400.json | 14 - ...b_startup_appspawn_filemgr_sandbox_1400.py | 61 -- ...startup_appspawn_filemgr_sandbox_1500.json | 14 - ...b_startup_appspawn_filemgr_sandbox_1500.py | 61 -- ...startup_appspawn_filemgr_sandbox_1600.json | 14 - ...b_startup_appspawn_filemgr_sandbox_1600.py | 64 -- ...startup_appspawn_filemgr_sandbox_1700.json | 14 - ...b_startup_appspawn_filemgr_sandbox_1700.py | 59 -- ...startup_appspawn_filemgr_sandbox_1800.json | 14 - ...startup_appspawn_filemgr_sandbox_1900.json | 14 - ...b_startup_appspawn_filemgr_sandbox_1900.py | 64 -- ...startup_appspawn_filemgr_sandbox_2000.json | 14 - ...b_startup_appspawn_filemgr_sandbox_2000.py | 57 -- ...startup_appspawn_filemgr_sandbox_2100.json | 14 - ...b_startup_appspawn_filemgr_sandbox_2100.py | 57 -- ...startup_appspawn_filemgr_sandbox_2200.json | 14 - ...b_startup_appspawn_filemgr_sandbox_2200.py | 58 -- ...startup_appspawn_filemgr_sandbox_2300.json | 14 - ...b_startup_appspawn_filemgr_sandbox_2300.py | 57 -- ...startup_appspawn_filemgr_sandbox_2500.json | 14 - ...b_startup_appspawn_filemgr_sandbox_2500.py | 57 -- .../sub_startup_appspawn_hnpinstall_0100.json | 12 - .../sub_startup_appspawn_hnpinstall_0100.py | 75 -- .../sub_startup_appspawn_hnpinstall_0200.json | 12 - .../sub_startup_appspawn_hnpinstall_0200.py | 69 -- .../sub_startup_appspawn_hnpinstall_0300.json | 12 - .../sub_startup_appspawn_hnpinstall_0300.py | 78 -- .../sub_startup_appspawn_hnpinstall_0400.json | 12 - .../sub_startup_appspawn_hnpinstall_0400.py | 73 -- .../sub_startup_appspawn_hnpinstall_0500.json | 12 - .../sub_startup_appspawn_hnpinstall_0500.py | 75 -- .../sub_startup_appspawn_hnpinstall_0600.json | 12 - .../sub_startup_appspawn_hnpinstall_0600.py | 75 -- .../sub_startup_appspawn_hnpinstall_0700.json | 12 - .../sub_startup_appspawn_hnpinstall_0700.py | 76 -- .../sub_startup_appspawn_hnpinstall_0800.json | 12 - .../sub_startup_appspawn_hnpinstall_0800.py | 79 -- .../sub_startup_appspawn_hnpinstall_0900.json | 12 - .../sub_startup_appspawn_hnpinstall_0900.py | 72 -- ..._startup_appspawn_nativedmscheck_0100.json | 12 - ...ub_startup_appspawn_nativedmscheck_0100.py | 62 -- ..._startup_appspawn_nativedmscheck_0200.json | 12 - ...ub_startup_appspawn_nativedmscheck_0200.py | 67 -- ..._startup_appspawn_nativedmscheck_0300.json | 12 - ...ub_startup_appspawn_nativedmscheck_0300.py | 80 -- ..._startup_appspawn_nativedmscheck_0400.json | 12 - ...ub_startup_appspawn_nativedmscheck_0400.py | 90 -- .../sub_startup_appspawn_nativepack_0100.json | 12 - .../sub_startup_appspawn_nativepack_0100.py | 78 -- .../sub_startup_appspawn_nativepack_0200.json | 12 - .../sub_startup_appspawn_nativepack_0200.py | 68 -- .../sub_startup_appspawn_nativepack_0300.json | 12 - .../sub_startup_appspawn_nativepack_0300.py | 77 -- .../sub_startup_appspawn_nativepack_0400.json | 12 - .../sub_startup_appspawn_nativepack_0400.py | 77 -- .../sub_startup_appspawn_nativepack_0500.json | 12 - .../sub_startup_appspawn_nativepack_0500.py | 88 -- .../sub_startup_appspawn_nativepack_0600.json | 12 - .../sub_startup_appspawn_nativepack_0600.py | 86 -- .../sub_startup_appspawn_nativeprocess.json | 20 - .../sub_startup_appspawn_nativeprocess.py | 41 - ...sub_startup_appspawn_nativeprocess_0100.py | 39 - ...sub_startup_appspawn_nativeprocess_0200.py | 42 - ...sub_startup_appspawn_nativeprocess_0400.py | 39 - ...sub_startup_appspawn_nativeprocess_0500.py | 39 - ...sub_startup_appspawn_nativeprocess_0600.py | 42 - ...b_startup_appspawn_nativesandbox_0100.json | 12 - ...sub_startup_appspawn_nativesandbox_0100.py | 84 -- ...b_startup_appspawn_nativesandbox_0200.json | 13 - ...sub_startup_appspawn_nativesandbox_0200.py | 84 -- .../sub_startup_appspawn_nativespawn_0100.py | 4 +- .../sub_startup_appspawn_nativespawn_0200.py | 4 +- .../sub_startup_appspawn_nativespawn_0300.py | 4 +- .../sub_startup_appspawn_nativespawn_0400.py | 4 +- .../sub_startup_appspawn_nativespawn_0500.py | 4 +- .../sub_startup_appspawn_nativespawn_0700.py | 4 +- .../sub_startup_appspawn_nativespawn_0900.py | 4 +- .../sub_startup_appspawn_nativespawn_1000.py | 4 +- .../sub_startup_appspawn_nativespawn_1100.py | 4 +- .../sub_startup_appspawn_nativespawn_1200.py | 4 +- .../sub_startup_appspawn_nativespawn_1300.py | 4 +- .../sub_startup_appspawn_nativespawn_1400.py | 4 +- .../sub_startup_appspawn_nativespawn_1500.py | 4 +- .../sub_startup_appspawn_nativespawn_1600.py | 4 +- .../sub_startup_appspawn_nativespawn_1700.py | 4 +- .../sub_startup_appspawn_nativespawn_1800.py | 4 +- .../sub_startup_appspawn_nativespawn_1900.py | 4 +- ...b_startup_appspawn_supplementary_0100.json | 14 - ...sub_startup_appspawn_supplementary_0100.py | 59 -- ...b_startup_appspawn_supplementary_0200.json | 14 - ...sub_startup_appspawn_supplementary_0200.py | 62 -- ...b_startup_appspawn_ubsanvariable_0100.json | 13 - ...sub_startup_appspawn_ubsanvariable_0100.py | 77 -- ...b_startup_appspawn_ubsanvariable_0200.json | 13 - ...sub_startup_appspawn_ubsanvariable_0200.py | 75 -- ...b_startup_appspawn_ubsanvariable_0300.json | 13 - ...sub_startup_appspawn_ubsanvariable_0300.py | 75 -- 162 files changed, 456 insertions(+), 6151 deletions(-) rename test/autotest/{sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0200.json => sub_startup_appspawn_atomservice/sub_startup_appspawn_atomservice_0100.json} (70%) rename test/autotest/{sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0300.py => sub_startup_appspawn_atomservice/sub_startup_appspawn_atomservice_0100.py} (38%) rename test/autotest/{sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0300.json => sub_startup_appspawn_atomservice/sub_startup_appspawn_atomservice_0300.json} (70%) rename test/autotest/{sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0200.py => sub_startup_appspawn_atomservice/sub_startup_appspawn_atomservice_0300.py} (66%) delete mode 100644 test/autotest/sub_startup_appspawn_autotest/appspawn_appmgr_autotest.cpp delete mode 100644 test/autotest/sub_startup_appspawn_autotest/appspawn_kickdog_autotest.cpp delete mode 100644 test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0100.py delete mode 100644 test/autotest/sub_startup_appspawn_coldstart/sub_startup_appspawn_coldstart_0100.json delete mode 100644 test/autotest/sub_startup_appspawn_coldstart/sub_startup_appspawn_coldstart_0100.py delete mode 100644 test/autotest/sub_startup_appspawn_coldstartablity/sub_startup_appspawn_coldstartablity_0100.json delete mode 100644 test/autotest/sub_startup_appspawn_coldstartablity/sub_startup_appspawn_coldstartablity_0100.py delete mode 100644 test/autotest/sub_startup_appspawn_coldstartablity/sub_startup_appspawn_coldstartablity_0200.json delete mode 100644 test/autotest/sub_startup_appspawn_coldstartablity/sub_startup_appspawn_coldstartablity_0200.py delete mode 100644 test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0200.json delete mode 100644 test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0200.py delete mode 100644 test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0300.json delete mode 100644 test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0300.py delete mode 100644 test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0500.json delete mode 100644 test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0600.json delete mode 100644 test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0700.json delete mode 100644 test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0800.json delete mode 100644 test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0800.py delete mode 100644 test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0900.json rename test/autotest/{sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0100.json => sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0100.json} (70%) rename test/autotest/{sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0100.py => sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0100.py} (65%) rename test/autotest/{sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0100.json => sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0200.json} (70%) rename test/autotest/{sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0600.py => sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0200.py} (64%) create mode 100644 test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0300.json rename test/autotest/{sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0700.py => sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0300.py} (58%) create mode 100644 test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0400.json create mode 100644 test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0400.py create mode 100644 test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0500.json rename test/autotest/{sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0900.py => sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0500.py} (66%) create mode 100644 test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0600.json rename test/autotest/{sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1800.py => sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0600.py} (58%) create mode 100644 test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0700.json rename test/autotest/{sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0500.py => sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0700.py} (63%) create mode 100644 test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0800.json rename test/autotest/{sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0400.py => sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0800.py} (62%) create mode 100644 test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0900.json rename test/autotest/{sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0600.py => sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0900.py} (64%) delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0100.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0100.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0200.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0200.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0300.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0300.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0400.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0500.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0500.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0600.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0700.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0700.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0800.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0800.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0900.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0900.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1000.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1000.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1100.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1100.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1200.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1200.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1300.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1300.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1400.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1400.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1500.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1500.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1600.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1600.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1700.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1700.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1800.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1900.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1900.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2000.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2000.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2100.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2100.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2200.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2200.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2300.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2300.py delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2500.json delete mode 100644 test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2500.py delete mode 100644 test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0100.json delete mode 100644 test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0100.py delete mode 100644 test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0200.json delete mode 100644 test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0200.py delete mode 100644 test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0300.json delete mode 100644 test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0300.py delete mode 100644 test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0400.json delete mode 100644 test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0400.py delete mode 100644 test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0500.json delete mode 100644 test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0500.py delete mode 100644 test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0600.json delete mode 100644 test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0600.py delete mode 100644 test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0700.json delete mode 100644 test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0700.py delete mode 100644 test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0800.json delete mode 100644 test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0800.py delete mode 100644 test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0900.json delete mode 100644 test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0900.py delete mode 100644 test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0100.json delete mode 100644 test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0100.py delete mode 100644 test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0200.json delete mode 100644 test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0200.py delete mode 100644 test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0300.json delete mode 100644 test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0300.py delete mode 100644 test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0400.json delete mode 100644 test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0400.py delete mode 100644 test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0100.json delete mode 100644 test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0100.py delete mode 100644 test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0200.json delete mode 100644 test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0200.py delete mode 100644 test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0300.json delete mode 100644 test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0300.py delete mode 100644 test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0400.json delete mode 100644 test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0400.py delete mode 100644 test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0500.json delete mode 100644 test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0500.py delete mode 100644 test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0600.json delete mode 100644 test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0600.py delete mode 100644 test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess.json delete mode 100644 test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess.py delete mode 100644 test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0100.py delete mode 100644 test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0200.py delete mode 100644 test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0400.py delete mode 100644 test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0500.py delete mode 100644 test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0600.py delete mode 100644 test/autotest/sub_startup_appspawn_nativesandbox/sub_startup_appspawn_nativesandbox_0100.json delete mode 100644 test/autotest/sub_startup_appspawn_nativesandbox/sub_startup_appspawn_nativesandbox_0100.py delete mode 100644 test/autotest/sub_startup_appspawn_nativesandbox/sub_startup_appspawn_nativesandbox_0200.json delete mode 100644 test/autotest/sub_startup_appspawn_nativesandbox/sub_startup_appspawn_nativesandbox_0200.py delete mode 100644 test/autotest/sub_startup_appspawn_supplementary/sub_startup_appspawn_supplementary_0100.json delete mode 100644 test/autotest/sub_startup_appspawn_supplementary/sub_startup_appspawn_supplementary_0100.py delete mode 100644 test/autotest/sub_startup_appspawn_supplementary/sub_startup_appspawn_supplementary_0200.json delete mode 100644 test/autotest/sub_startup_appspawn_supplementary/sub_startup_appspawn_supplementary_0200.py delete mode 100644 test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0100.json delete mode 100644 test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0100.py delete mode 100644 test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0200.json delete mode 100644 test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0200.py delete mode 100644 test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0300.json delete mode 100644 test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0300.py diff --git a/test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0200.json b/test/autotest/sub_startup_appspawn_atomservice/sub_startup_appspawn_atomservice_0100.json similarity index 70% rename from test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0200.json rename to test/autotest/sub_startup_appspawn_atomservice/sub_startup_appspawn_atomservice_0100.json index 26a1000e..a69713ef 100644 --- a/test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0200.json +++ b/test/autotest/sub_startup_appspawn_atomservice/sub_startup_appspawn_atomservice_0100.json @@ -8,7 +8,7 @@ "driver": { "type": "DeviceTest", "py_file": [ - "sub_startup_appspawn_cgroups/Substartupappspawncgroups0200.py" + "sub_startup_appspawn_atomservice/sub_startup_appspawn_atomservice_0100.py" ] } } \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0300.py b/test/autotest/sub_startup_appspawn_atomservice/sub_startup_appspawn_atomservice_0100.py similarity index 38% rename from test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0300.py rename to test/autotest/sub_startup_appspawn_atomservice/sub_startup_appspawn_atomservice_0100.py index da0bcc97..8ed54e46 100644 --- a/test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0300.py +++ b/test/autotest/sub_startup_appspawn_atomservice/sub_startup_appspawn_atomservice_0100.py @@ -15,13 +15,11 @@ import time from devicetest.core.test_case import TestCase, Step -from hypium import HypiumClass, HypiumFunction - +from hypium import UiDriver from aw import Common -class Substartupappspawncgroups0300(TestCase): - +class SubStartupAppspawnAtomservice0100(TestCase): def __init__(self, controllers): self.tag = self.__class__.__name__ TestCase.__init__(self, self.tag, controllers) @@ -29,7 +27,6 @@ class Substartupappspawncgroups0300(TestCase): def setup(self): Step(self.devices[0].device_id) - device device = self.driver.shell("param get const.product.model") device = device.replace("\n", "").replace(" ", "") device = str(device) @@ -42,11 +39,13 @@ class Substartupappspawncgroups0300(TestCase): else: self.driver.Screen.wake_up() self.driver.ScreenLock.unlock() - self.driver.shell("power-shell timeout -o 86400000") + self.driver.Screen.enable_stay_awake() def process(self): - hap_path = Common.sourcepath('ForkTest3.hap', "SUB_STARTUP_APPSPAWN_CGROUPS") - bundle_name = "com.example.exe_sys_cmd" + hap_info01, hap_info02 = [], [] + bundle_name = "com.atomicservice.5765880207854649689" + bundle_name_start = "+auid-ohosAnonymousUid+com.atomicservice.5765880207854649689" + hap_path = Common.sourcepath('atomicservice.hap', "sub_startup_appspawn_atomservice") hap = self.driver.AppManager.has_app(bundle_name) if hap: self.driver.AppManager.clear_app_data(bundle_name) @@ -54,20 +53,52 @@ class Substartupappspawncgroups0300(TestCase): self.driver.AppManager.install_app(hap_path) else: self.driver.AppManager.install_app(hap_path) - self.driver.AppManager.start_app(bundle_name) - pid = self.driver.System.get_pid(bundle_name) - result1 = self.driver.shell("ps -ef |grep %s" % bundle_name) - count = 0 - for i in cgroup1: - self.driver.Assert.contains(result1.split(), i) - if result1.count(i) == 2: - count += 1 - self.driver.Assert.equal(count, 2) - result2 = self.driver.shell("kill -9 %d" % pid) - self.driver.Assert.equal(result2, '') - result3 = self.driver.shell("ps -ef |grep %s|grep -v grep " % bundle_name) - self.driver.Assert.equal(result3, '') + + for path in ["base", "database"]: + for i in range(1, 5): + has_dir = self.driver.Storage.has_dir("/data/app/el%d/100/%s/%s" % (i, path, bundle_name)) + has_dir_login = self.driver.Storage.has_dir("/data/app/el%d/100/%s/%s" % (i, path, bundle_name_start)) + self.driver.Assert.equal(has_dir, True) + self.driver.Assert.equal(has_dir_login, False) + + log_has_dir = self.driver.Storage.has_dir("/data/app/el2/100/log/%s" % bundle_name) + log_has_dir_login = self.driver.Storage.has_dir("/data/app/el2/100/log/%s" % bundle_name_start) + self.driver.Assert.equal(log_has_dir, True) + self.driver.Assert.equal(log_has_dir_login, False) + + mnt_has_dir = self.driver.Storage.has_dir("/mnt/share/100/%s" % bundle_name) + mnt_has_dir_login = self.driver.Storage.has_dir("/mnt/share/100/%s" % bundle_name_start) + self.driver.Assert.equal(mnt_has_dir, True) + self.driver.Assert.equal(mnt_has_dir_login, False) + + self.driver.shell("aa start -a EntryAbility -b %s" % bundle_name) + for path in ["base", "database"]: + for i in range(1, 5): + has_dir_login = self.driver.Storage.has_dir("/data/app/el%d/100/%s/%s" % (i, path, bundle_name_start)) + self.driver.Assert.equal(has_dir_login, True) + + mnt_has_dir_login = self.driver.Storage.has_dir("/mnt/share/100/%s" % bundle_name_start) + self.driver.Assert.equal(mnt_has_dir_login, True) + + for i in range(1, 5): + hap_detail = self.driver.shell("ls -lZ ../data/app/el%d/100/%s" % (i, "base")).split("\n") + for hap in hap_detail[1:-2]: + if hap.split()[-1] == bundle_name: + hap_info01 = hap + if hap.split()[-1] == bundle_name_start: + hap_info02 = hap + for index in range(2, 5): + self.driver.Assert.equal(hap_info01.split()[index], hap_info02.split()[index]) + + hap_detail = self.driver.shell("ls -lZ ../mnt/share/100").split("\n") + for hap in hap_detail[1:-2]: + if hap.split()[-1] == bundle_name: + hap_info01 = hap + if hap.split()[-1] == bundle_name_start: + hap_info02 = hap + for index in range(2, 5): + self.driver.Assert.equal(hap_info01.split()[index], hap_info02.split()[index]) def teardown(self): Step("收尾工作.................") - self.driver.AppManager.uninstall_app("com.example.exe_sys_cmd") \ No newline at end of file + self.driver.AppManager.uninstall_app("com.atomicservice.5765880207854649689") diff --git a/test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0300.json b/test/autotest/sub_startup_appspawn_atomservice/sub_startup_appspawn_atomservice_0300.json similarity index 70% rename from test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0300.json rename to test/autotest/sub_startup_appspawn_atomservice/sub_startup_appspawn_atomservice_0300.json index 1be0bf2f..c5a1372f 100644 --- a/test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0300.json +++ b/test/autotest/sub_startup_appspawn_atomservice/sub_startup_appspawn_atomservice_0300.json @@ -8,7 +8,7 @@ "driver": { "type": "DeviceTest", "py_file": [ - "sub_startup_appspawn_cgroups/Substartupappspawncgroups0300.py" + "sub_startup_appspawn_atomservice/sub_startup_appspawn_atomservice_0300.py" ] } } \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0200.py b/test/autotest/sub_startup_appspawn_atomservice/sub_startup_appspawn_atomservice_0300.py similarity index 66% rename from test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0200.py rename to test/autotest/sub_startup_appspawn_atomservice/sub_startup_appspawn_atomservice_0300.py index e11d33c4..9001688a 100644 --- a/test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0200.py +++ b/test/autotest/sub_startup_appspawn_atomservice/sub_startup_appspawn_atomservice_0300.py @@ -15,13 +15,11 @@ import time from devicetest.core.test_case import TestCase, Step -from hypium import SomeClass, some_function - +from hypium import UiDriver from aw import Common -class Substartupappspawncgroups0200(TestCase): - +class SubStartupAppspawnAtomservice0300(TestCase): def __init__(self, controllers): self.tag = self.__class__.__name__ TestCase.__init__(self, self.tag, controllers) @@ -29,7 +27,6 @@ class Substartupappspawncgroups0200(TestCase): def setup(self): Step(self.devices[0].device_id) - device device = self.driver.shell("param get const.product.model") device = device.replace("\n", "").replace(" ", "") device = str(device) @@ -42,11 +39,12 @@ class Substartupappspawncgroups0200(TestCase): else: self.driver.Screen.wake_up() self.driver.ScreenLock.unlock() - self.driver.shell("power-shell timeout -o 86400000") + self.driver.Screen.enable_stay_awake() def process(self): - hap_path = Common.sourcepath('ForkTest2.hap', "SUB_STARTUP_APPSPAWN_CGROUPS") - bundle_name = "com.example.exe_sys_cmd" + bundle_name = "com.atomicservice.5765880207854649689" + bundle_name_start = "+auid-ohosAnonymousUid+com.atomicservice.5765880207854649689" + hap_path = Common.sourcepath('atomicservice.hap', "sub_startup_appspawn_atomservice") hap = self.driver.AppManager.has_app(bundle_name) if hap: self.driver.AppManager.clear_app_data(bundle_name) @@ -54,20 +52,15 @@ class Substartupappspawncgroups0200(TestCase): self.driver.AppManager.install_app(hap_path) else: self.driver.AppManager.install_app(hap_path) - self.driver.AppManager.start_app(bundle_name) + self.driver.shell("aa start -a EntryAbility -b %s" % bundle_name) pid = self.driver.System.get_pid(bundle_name) - result1 = self.driver.shell("ps -ef | grep %s" % bundle_name) - count = 0 - for i in cgroup1: - self.driver.Assert.contains(result1.split(), i) - if result1.count(i) == 3: - count += 1 - self.driver.Assert.equal(count, 1) - result2 = self.driver.shell("kill -9 %d" % pid) - self.driver.Assert.equal(result2, '') - result3 = self.driver.shell("ps -ef |grep %s|grep -v grep " % bundle_name) - self.driver.Assert.equal(result3, '') + + for path in ["base", "database"]: + for i in range(1, 5): + result1 = self.driver.shell("ls ../proc/%d/root/data/storage/el%d/%s" % (pid, i, path)) + result2 = self.driver.shell("ls ../data/app/el%d/100/%s/%s" % (i, path, bundle_name_start)) + self.driver.Assert.equal(result1, result2) def teardown(self): Step("收尾工作.................") - self.driver.AppManager.uninstall_app("com.example.exe_sys_cmd") \ No newline at end of file + self.driver.AppManager.uninstall_app(bundle_name) diff --git a/test/autotest/sub_startup_appspawn_autotest/appspawn_appmgr_autotest.cpp b/test/autotest/sub_startup_appspawn_autotest/appspawn_appmgr_autotest.cpp deleted file mode 100644 index 6a2507fc..00000000 --- a/test/autotest/sub_startup_appspawn_autotest/appspawn_appmgr_autotest.cpp +++ /dev/null @@ -1,946 +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. - */ - -#include -#include "appspawn_mgr.h" // 假设这个头文件包含了 GetAppSpawnMgr 函数 -#define WATCHHANDLE_PTR 2 -#define FORKCTX_FD_0 5 -#define FORKCTX_FD_1 6 -#define DIE_APP_COUNT 3 -using namespace testing; -using namespace testing::ext; - -namespace OHOS { -class AppSpawnMgrTest : public testing::Test { -public: - static void SetUpTestCase() {} - static void TearDownTestCase() {} - void SetUp() - { - const TestInfo *info = UnitTest::GetInstance()->current_test_info(); - GTEST_LOG_(INFO) << info->test_suite_name() << "." << info->name() << " start"; - APPSPAWN_LOGI("%{public}s.%{public}s start", info->test_suite_name(), info->name()); - } - void TearDown() - { - const TestInfo *info = UnitTest::GetInstance()->current_test_info(); - GTEST_LOG_(INFO) << info->test_suite_name() << "." << info->name() << " end"; - APPSPAWN_LOGI("%{public}s.%{public}s end", info->test_suite_name(), info->name()); - } -}; - -/** -* @tc.name: GetAppSpawnMgr_Null -* @tc.desc: Verify that the function returns NULL when g_appSpawnMgr is NULL. -*/ -HWTEST_F(AppSpawnMgrTest, GetAppSpawnMgr_Null, TestSize.Level0) -{ - g_appSpawnMgr = nullptr; - - AppSpawnMgr* appSpawnMgr = GetAppSpawnMgr(); - - EXPECT_EQ(appSpawnMgr, nullptr); // 验证返回值是 NULL -} - -/** -* @tc.name: GetAppSpawnMgr_NotNull -* @tc.desc: Verify that the function returns the correct AppSpawnMgr instance when g_appSpawnMgr is not NULL. -*/ -HWTEST_F(AppSpawnMgrTest, GetAppSpawnMgr_NotNull, TestSize.Level0) -{ - AppSpawnMgr appMgr; - g_appSpawnMgr = &appMgr; - - AppSpawnMgr* appSpawnMgr = GetAppSpawnMgr(); - - EXPECT_EQ(appSpawnMgr, &appMgr); // 验证返回的是正确的 AppSpawnMgr 实例 -} - -/** -* @tc.name: GetAppSpawnMgr_NullptrEdge -* @tc.desc: Test if the function handles a NULL pointer passed as a global. -*/ -HWTEST_F(AppSpawnMgrTest, GetAppSpawnMgr_NullptrEdge, TestSize.Level0) -{ - g_appSpawnMgr = nullptr; - - // 直接操作 NULL 全局变量,确保不崩溃 - AppSpawnMgr* appSpawnMgr = GetAppSpawnMgr(); - - EXPECT_EQ(appSpawnMgr, nullptr); -} - -/** -* @tc.name: GetAppSpawnContent_Null -* @tc.desc: Verify that the function returns NULL when g_appSpawnMgr is NULL. -*/ -HWTEST_F(AppSpawnMgrTest, GetAppSpawnContent_Null, TestSize.Level0) -{ - g_appSpawnMgr = nullptr; - - AppSpawnContent* appSpawnContent = GetAppSpawnContent(); - - EXPECT_EQ(appSpawnContent, nullptr); // 验证返回值是 NULL -} - -/** -* @tc.name: GetAppSpawnContent_NotNull -* @tc.desc: Verify that the function returns the correct AppSpawnContent when g_appSpawnMgr is not NULL. -*/ -HWTEST_F(AppSpawnMgrTest, GetAppSpawnContent_NotNull, TestSize.Level0) -{ - AppSpawnMgr appMgr; - g_appSpawnMgr = &appMgr; - - AppSpawnContent* appSpawnContent = GetAppSpawnContent(); - - EXPECT_EQ(appSpawnContent, &appMgr.content); // 验证返回的是正确的 AppSpawnContent 实例 -} - -/** -* @tc.name: GetAppSpawnContent_EdgeCase -* @tc.desc: Test if the function handles unexpected edge cases such as incomplete AppSpawnMgr initialization. -*/ -HWTEST_F(AppSpawnMgrTest, GetAppSpawnContent_EdgeCase, TestSize.Level0) -{ - AppSpawnMgr appMgr; - appMgr.content = nullptr; // 可能 content 为空的情况 - g_appSpawnMgr = &appMgr; - - AppSpawnContent* appSpawnContent = GetAppSpawnContent(); - - EXPECT_EQ(appSpawnContent, nullptr); // 验证 content 为空时的返回 -} -/** -* @tc.name: SpawningQueueDestroy_Success -* @tc.desc: Verify that the function correctly destroys a SpawningQueue node. -*/ -HWTEST_F(SpawningQueueTest, SpawningQueueDestroy_Success, TestSize.Level0) -{ - AppSpawningCtx appSpawningCtx; - ListNode node; - node.entry = &appSpawningCtx; - - SpawningQueueDestroy(&node); // 调用销毁函数 - - // 验证节点已正确销毁 - // 由于实际销毁行为通常不可直接测试,可以通过检查是否有内存泄漏或日志记录来间接验证 - EXPECT_TRUE(true); // 假设已经验证内存释放成功 -} - -/** -* @tc.name: SpawningQueueDestroy_Null -* @tc.desc: Verify that the function handles a NULL node gracefully. -*/ -HWTEST_F(SpawningQueueTest, SpawningQueueDestroy_Null, TestSize.Level0) -{ - ListNode* node = nullptr; - - SpawningQueueDestroy(node); // 确保该函数能够正确处理空指针 - - EXPECT_TRUE(true); // 无崩溃,即通过 -} - - -void DeleteAppSpawnMgr(AppSpawnMgr *mgr) -{ - APPSPAWN_CHECK_ONLY_EXPER(mgr != NULL, return); - OH_ListRemoveAll(&mgr->appQueue, NULL); - OH_ListRemoveAll(&mgr->diedQueue, NULL); - OH_ListRemoveAll(&mgr->appSpawnQueue, SpawningQueueDestroy); - OH_ListRemoveAll(&mgr->extData, ExtDataDestroy); - OH_ListRemoveAll(&mgr->dataGroupCtxQueue, NULL); -#ifdef APPSPAWN_HISYSEVENT - DeleteHisyseventInfo(mgr->hisyseventInfo); -#endif - - APPSPAWN_LOGV("DeleteAppSpawnMgr %{public}d %{public}d", mgr->servicePid, getpid()); - free(mgr); - if (g_appSpawnMgr == mgr) { - g_appSpawnMgr = NULL; - } -} - -void TraversalSpawnedProcess(AppTraversal traversal, void *data) -{ - APPSPAWN_CHECK_ONLY_EXPER(g_appSpawnMgr != NULL && traversal != NULL, return); - ListNode *node = g_appSpawnMgr->appQueue.next; - while (node != &g_appSpawnMgr->appQueue) { - ListNode *next = node->next; - AppSpawnedProcess *appInfo = ListEntry(node, AppSpawnedProcess, node); - traversal(g_appSpawnMgr, appInfo, data); - node = next; - } -} - -/** -* @tc.name: TraversalSpawnedProcess_NullGlobalMgr -* @tc.desc: Verify that the function returns early when g_appSpawnMgr is NULL. -*/ -HWTEST_F(TraversalSpawnedProcessTest, TraversalSpawnedProcess_NullGlobalMgr, TestSize.Level0) -{ - g_appSpawnMgr = nullptr; - - TraversalSpawnedProcess([](AppSpawnMgr *mgr, AppSpawnedProcess *appInfo, void *data) { - // Traversal callback does nothing for this test - }, nullptr); // 函数应立即返回 - - EXPECT_TRUE(true); // 没有崩溃且通过了 -} - -/** -* @tc.name: TraversalSpawnedProcess_Normal -* @tc.desc: Verify that the function correctly traverses the appQueue and calls the traversal callback. -*/ -HWTEST_F(TraversalSpawnedProcessTest, TraversalSpawnedProcess_Normal, TestSize.Level0) -{ - // 创建一个假的 AppSpawnMgr 并填充一些数据 - AppSpawnMgr *mgr = (AppSpawnMgr *)malloc(sizeof(AppSpawnMgr)); - ASSERT_NE(mgr, nullptr); - - AppSpawnedProcess appSpawnedProcess1, appSpawnedProcess2; - ListNode node1, node2; - - node1.entry = &appSpawnedProcess1; - node2.entry = &appSpawnedProcess2; - - mgr->appQueue.next = &node1; - node1.next = &node2; - node2.next = &mgr->appQueue; - - g_appSpawnMgr = mgr; - - int count = 0; - TraversalSpawnedProcess([](AppSpawnMgr *mgr, AppSpawnedProcess *appInfo, void *data) { - (*((int*)data))++; // 增加计数 - }, &count); - - EXPECT_EQ(count, 2); // 应该遍历两个 appSpawnedProcess 节点 -} - -/** -* @tc.name: TraversalSpawnedProcess_NullTraversal -* @tc.desc: Verify that the function returns early when traversal is NULL. -*/ -HWTEST_F(TraversalSpawnedProcessTest, TraversalSpawnedProcess_NullTraversal, TestSize.Level0) -{ - g_appSpawnMgr = (AppSpawnMgr *)malloc(sizeof(AppSpawnMgr)); - ASSERT_NE(g_appSpawnMgr, nullptr); // 确保 mgr 被分配内存 - - TraversalSpawnedProcess(nullptr, nullptr); // traversal 为 NULL,函数应立即返回 - - EXPECT_TRUE(true); // 没有崩溃且通过了 -} - -/** - * @tc.name: AppInfoPidComparePro_Test - * @tc.desc: 测试 pid 比较函数是否正确 - */ -HWTEST_F(AppInfoCompareTest, AppInfoPidComparePro_Test, TestSize.Level0) -{ - AppSpawnedProcess app1 = {1234, "app1"}; - AppSpawnedProcess app2 = {5678, "app2"}; - ListNode node1, node2; - - node1.entry = &app1; - node2.entry = &app2; - - pid_t pid = 1234; - - // 测试 pid 匹配 - EXPECT_EQ(AppInfoPidComparePro(&node1, &pid), 0); // 应该返回 0,表示匹配 - pid = 5678; - EXPECT_LT(AppInfoPidComparePro(&node1, &pid), 0); // 应该返回负值,表示 pid 小于 5678 - EXPECT_GT(AppInfoPidComparePro(&node2, &pid), 0); // 应该返回正值,表示 pid 大于 1234 -} - -/** - * @tc.name: AppInfoNameComparePro_Test - * @tc.desc: 测试名称比较函数是否正确 - */ -HWTEST_F(AppInfoCompareTest, AppInfoNameComparePro_Test, TestSize.Level0) -{ - AppSpawnedProcess app1 = {1234, "app1"}; - AppSpawnedProcess app2 = {5678, "app2"}; - ListNode node1, node2; - - node1.entry = &app1; - node2.entry = &app2; - - const char *name = "app1"; - - // 测试名称匹配 - EXPECT_EQ(AppInfoNameComparePro(&node1, (void *)name), 0); // 应该返回 0,表示匹配 - name = "app2"; - EXPECT_LT(AppInfoNameComparePro(&node1, (void *)name), 0); // 应该返回负值,表示 "app1" 小于 "app2" - EXPECT_GT(AppInfoNameComparePro(&node2, (void *)name), 0); // 应该返回正值,表示 "app2" 大于 "app1" -} - -/** - * @tc.name: AppInfoCompareProc_Test - * @tc.desc: 测试两个节点之间的 pid 比较 - */ -HWTEST_F(AppInfoCompareTest, AppInfoCompareProc_Test, TestSize.Level0) -{ - AppSpawnedProcess app1 = {1234, "app1"}; - AppSpawnedProcess app2 = {5678, "app2"}; - AppSpawnedProcess app3 = {1234, "app3"}; - ListNode node1, node2, node3; - - node1.entry = &app1; - node2.entry = &app2; - node3.entry = &app3; - - // 测试相同 pid - EXPECT_EQ(AppInfoCompareProc(&node1, &node3), 0); // 应该返回 0,表示相同 pid - EXPECT_LT(AppInfoCompareProc(&node1, &node2), 0); // 应该返回负值,表示 1234 < 5678 - EXPECT_GT(AppInfoCompareProc(&node2, &node1), 0); // 应该返回正值,表示 5678 > 1234 -} - -TEST_F(AppInfoCompareTest, AddSpawnedProcess_Success) -{ - pid_t pid = 1234; - const char *name = "test_process"; - uint32_t appIndex = 1; - bool isDebuggable = false; - - // 调用AddSpawnedProcess添加进程 - AppSpawnedProcess *newProcess = AddSpawnedProcess(pid, name, appIndex, isDebuggable); - - // 检查返回的指针是否有效 - ASSERT_NE(newProcess, nullptr); - EXPECT_EQ(newProcess->pid, pid); - EXPECT_STREQ(newProcess->name, name); - EXPECT_EQ(newProcess->appIndex, appIndex); - EXPECT_EQ(newProcess->isDebuggable, isDebuggable); - EXPECT_EQ(newProcess->exitStatus, 0); // 默认退出状态为0 - EXPECT_EQ(newProcess->max, 0); // 默认值 -} - -TEST_F(AppInfoCompareTest, AddSpawnedProcess_InvalidParams) -{ - pid_t pid = -1; // 无效PID - const char *name = nullptr; // 无效进程名 - uint32_t appIndex = 1; - bool isDebuggable = false; - - // 检查无效的PID - AppSpawnedProcess *newProcess = AddSpawnedProcess(pid, name, appIndex, isDebuggable); - EXPECT_EQ(newProcess, nullptr); // 应该返回NULL - - name = "valid_name"; // 修改进程名为有效 - newProcess = AddSpawnedProcess(pid, name, appIndex, isDebuggable); - EXPECT_EQ(newProcess, nullptr); // 无效的pid依然应该返回NULL -} - -TEST_F(AppInfoCompareTest, TerminateSpawnedProcess_Success) -{ - pid_t pid = 1234; - const char *name = "test_process"; - uint32_t appIndex = 1; - bool isDebuggable = false; - - // 添加新进程 - AppSpawnedProcess *newProcess = AddSpawnedProcess(pid, name, appIndex, isDebuggable); - - // 检查添加进程成功后,队列是否包含该进程 - EXPECT_EQ(g_appSpawnMgr->appQueue.size, 1); - - // 调用TerminateSpawnedProcess终止进程 - TerminateSpawnedProcess(newProcess); - - // 检查进程是否被移除并加入死亡队列 - EXPECT_EQ(g_appSpawnMgr->diedAppCount, 1); // 死亡队列中应该有1个进程 - EXPECT_EQ(g_appSpawnMgr->appQueue.size, 0); // 原队列应该没有该进程 -} - -TEST_F(AppInfoCompareTest, TerminateSpawnedProcess_DeathQueueOverflow) -{ - // 假设MAX_DIED_PROCESS_COUNT已经定义为3 - g_appSpawnMgr->diedAppCount = 3; - - // 添加并终止3个进程 - for (int i = 0; i < 3; ++i) { - pid_t pid = 1000 + i; - const char *name = "test_process"; - uint32_t appIndex = 1; - bool isDebuggable = false; - - AppSpawnedProcess *newProcess = AddSpawnedProcess(pid, name, appIndex, isDebuggable); - TerminateSpawnedProcess(newProcess); - } - - // 检查死亡进程队列中的进程数是否为3 - EXPECT_EQ(g_appSpawnMgr->diedAppCount, DIE_APP_COUNT); - - // 再添加一个进程并终止 - pid_t pid = 2000; - const char *name = "test_process_4"; - uint32_t appIndex = 1; - bool isDebuggable = false; - - AppSpawnedProcess *newProcess = AddSpawnedProcess(pid, name, appIndex, isDebuggable); - TerminateSpawnedProcess(newProcess); - - // 检查队列中最早的进程是否已被移除 - EXPECT_EQ(g_appSpawnMgr->diedAppCount, DIE_APP_COUNT); - // 由于最早的进程已被移除,新的死亡进程已添加 - // 如果存在特定的检查最早死亡进程移除的方式,可以加入这里的检查 -} - -TEST_F(AppInfoCompareTest, GetSpawnedProcess_Success) -{ - pid_t pid = 1234; - const char *name = "test_process"; - uint32_t appIndex = 1; - bool isDebuggable = false; - - // 添加进程 - AddSpawnedProcess(pid, name, appIndex, isDebuggable); - - // 根据PID获取进程 - AppSpawnedProcess *proc = GetSpawnedProcess(pid); - - ASSERT_NE(proc, nullptr); - EXPECT_EQ(proc->pid, pid); - EXPECT_STREQ(proc->name, name); -} - -TEST_F(AppInfoCompareTest, GetSpawnedProcess_InvalidPID) -{ - pid_t invalidPid = 9999; - - // 使用不存在的PID获取进程 - AppSpawnedProcess *proc = GetSpawnedProcess(invalidPid); - EXPECT_EQ(proc, nullptr); -} - -TEST_F(AppInfoCompareTest, GetSpawnedProcess_NullManager) -{ - pid_t pid = 1234; - const char *name = "test_process"; - - // 临时置空全局管理器 - AppSpawnMgr *backup = g_appSpawnMgr; - g_appSpawnMgr = nullptr; - - AppSpawnedProcess *proc = GetSpawnedProcess(pid); - EXPECT_EQ(proc, nullptr); - - // 恢复全局管理器 - g_appSpawnMgr = backup; -} - -TEST_F(AppInfoCompareTest, GetSpawnedProcessByName_Success) -{ - pid_t pid = 1234; - const char *name = "test_process"; - uint32_t appIndex = 1; - bool isDebuggable = false; - - // 添加进程 - AddSpawnedProcess(pid, name, appIndex, isDebuggable); - - // 根据名称获取进程 - AppSpawnedProcess *proc = GetSpawnedProcessByName(name); - - ASSERT_NE(proc, nullptr); - EXPECT_EQ(proc->pid, pid); - EXPECT_STREQ(proc->name, name); -} - -TEST_F(AppInfoCompareTest, GetSpawnedProcessByName_InvalidName) -{ - const char *invalidName = "non_exist"; - - // 使用不存在的名称获取进程 - AppSpawnedProcess *proc = GetSpawnedProcessByName(invalidName); - EXPECT_EQ(proc, nullptr); -} - -TEST_F(AppInfoCompareTest, GetSpawnedProcessByName_NullManagerOrName) -{ - pid_t pid = 1234; - const char *name = "test_process"; - - // 置空全局管理器 - AppSpawnMgr *backup = g_appSpawnMgr; - g_appSpawnMgr = nullptr; - EXPECT_EQ(GetSpawnedProcessByName(name), nullptr); - - // 恢复全局管理器,传入空名称 - g_appSpawnMgr = backup; - EXPECT_EQ(GetSpawnedProcessByName(nullptr), nullptr); -} - -TEST_F(AppInfoCompareTest, KillAndWaitStatus_Success) -{ - pid_t pid = 1234; // 假设进程已存在,且可以杀死 - int sig = SIGTERM; // 使用默认的终止信号 - int exitStatus = 0; - - // 假设kill和waitpid在测试环境中可以模拟成功执行 - EXPECT_EQ(KillAndWaitStatus(pid, sig, &exitStatus), 0); - EXPECT_EQ(exitStatus, 0); // 期望返回成功退出状态 -} - -TEST_F(AppInfoCompareTest, KillAndWaitStatus_InvalidPID) -{ - pid_t invalidPid = -1; - int sig = SIGTERM; - int exitStatus = 0; - - // 传入无效PID - EXPECT_EQ(KillAndWaitStatus(invalidPid, sig, &exitStatus), 0); - EXPECT_EQ(exitStatus, -1); // 无效PID,exitStatus应为默认值 -} - -TEST_F(AppInfoCompareTest, KillAndWaitStatus_FailedKill) -{ - pid_t pid = 9999; // 假设此PID无法被杀死 - int sig = SIGTERM; - int exitStatus = 0; - - // 模拟kill失败的情况(例如权限问题) - EXPECT_EQ(KillAndWaitStatus(pid, sig, &exitStatus), -1); - EXPECT_EQ(exitStatus, -1); // 应该返回错误状态 -} - -TEST_F(AppInfoCompareTest, KillAndWaitStatus_Timeout) -{ - pid_t pid = 1234; // 假设进程无法退出 - int sig = SIGTERM; - int exitStatus = 0; - - // 模拟进程无法在规定的超时时间内退出 - EXPECT_EQ(KillAndWaitStatus(pid, sig, &exitStatus), -1); - EXPECT_EQ(exitStatus, -1); // 超时未退出,返回失败 -} - -TEST_F(AppInfoCompareTest, KillAndWaitStatus_ValidExitStatus) -{ - pid_t pid = 1234; // 假设进程成功退出并返回退出状态 - int sig = SIGTERM; - int exitStatus = 0; - - // 模拟正常退出并返回退出状态 - EXPECT_EQ(KillAndWaitStatus(pid, sig, &exitStatus), 0); - EXPECT_EQ(exitStatus, 0); // 正常退出,exitStatus为0 -} - -TEST_F(AppInfoCompareTest, GetProcessTerminationStatus_SuccessFromDiedQueue) -{ - pid_t pid = 1234; - int exitStatus = 0; - - // 假设该进程已经死亡并在 diedQueue 中 - AddDiedProcess(pid, exitStatus); // 自定义函数:将进程加入到 diedQueue - - // 测试获取并返回死去的进程的退出状态 - EXPECT_EQ(GetProcessTerminationStatus(pid), exitStatus); -} - -TEST_F(AppInfoCompareTest, GetProcessTerminationStatus_InvalidPID) -{ - pid_t invalidPid = -1; - int exitStatus = 0; - - // 传入无效的PID,函数应返回0 - EXPECT_EQ(GetProcessTerminationStatus(invalidPid), 0); -} - -TEST_F(AppInfoCompareTest, GetProcessTerminationStatus_UnableToGetProcess) -{ - pid_t pid = 1234; - int exitStatus = 0; - - // 假设 GetSpawnedProcess 返回 NULL,进程没有找到 - EXPECT_EQ(GetProcessTerminationStatus(pid), -1); // 应该返回-1 -} - -TEST_F(AppInfoCompareTest, GetProcessTerminationStatus_SuccessFromGetSpawnedProcess) -{ - pid_t pid = 1234; - int exitStatus = 0; - - // 添加已启动的进程 - AddSpawnedProcess(pid, "test_process", 1, false); // 自定义函数:添加进程 - - // 模拟成功终止进程 - EXPECT_EQ(GetProcessTerminationStatus(pid), exitStatus); -} - -TEST_F(AppInfoCompareTest, GetProcessTerminationStatus_KillFailed) -{ - pid_t pid = 1234; - int exitStatus = 0; - - // 模拟 kill 失败的情况 - EXPECT_EQ(KillAndWaitStatus(pid, SIGKILL, &exitStatus), -1); - EXPECT_EQ(GetProcessTerminationStatus(pid), -1); // kill失败,返回-1 -} - -TEST_F(AppInfoCompareTest, GetProcessTerminationStatus_ValidExitStatus) -{ - pid_t pid = 1234; - int exitStatus = 0; - - // 模拟进程已退出,并且已经加入diedQueue - AddDiedProcess(pid, exitStatus); - - // 返回已死亡进程的退出状态 - EXPECT_EQ(GetProcessTerminationStatus(pid), exitStatus); -} - -TEST_F(AppInfoCompareTest, CreateAppSpawningCtx_Success) -{ - // 模拟 g_appSpawnMgr 为有效 - g_appSpawnMgr = (AppSpawnMgr *)malloc(sizeof(AppSpawnMgr)); // 假设 g_appSpawnMgr 已初始化 - ASSERT_NE(g_appSpawnMgr, nullptr); // 确保 g_appSpawnMgr 被正确初始化 - - // 调用 CreateAppSpawningCtx - AppSpawningCtx *ctx = CreateAppSpawningCtx(); - - // 验证返回的 ctx 是否有效 - ASSERT_NE(ctx, nullptr); - - // 验证 ctx 的成员是否初始化正确 - EXPECT_EQ(ctx->client.id, 1); // 初始 requestId 应为 1 - EXPECT_EQ(ctx->client.flags, 0); - EXPECT_EQ(ctx->forkCtx.watcherHandle, nullptr); - EXPECT_EQ(ctx->forkCtx.pidFdWatcherHandle, nullptr); - EXPECT_EQ(ctx->forkCtx.coldRunPath, nullptr); - EXPECT_EQ(ctx->forkCtx.timer, nullptr); - EXPECT_EQ(ctx->forkCtx.fd[0], -1); - EXPECT_EQ(ctx->forkCtx.fd[1], -1); - EXPECT_EQ(ctx->isPrefork, false); - EXPECT_EQ(ctx->forkCtx.childMsg, nullptr); - EXPECT_EQ(ctx->message, nullptr); - EXPECT_EQ(ctx->pid, 0); - EXPECT_EQ(ctx->state, APP_STATE_IDLE); - - // 验证 appSpawnQueue 是否已添加节点 - ASSERT_TRUE(OH_ListContains(&g_appSpawnMgr->appSpawnQueue, &ctx->node)); - - // 清理 - free(ctx); - free(g_appSpawnMgr); -} - -TEST_F(AppInfoCompareTest, CreateAppSpawningCtx_MallocFailure) -{ - // 模拟 malloc 失败 - EXPECT_CALL(*this, malloc(_)).WillOnce(Return(nullptr)); // 使用 Mock 处理内存分配失败 - - // 调用 CreateAppSpawningCtx,期望返回 nullptr - AppSpawningCtx *ctx = CreateAppSpawningCtx(); - EXPECT_EQ(ctx, nullptr); -} - -TEST_F(AppInfoCompareTest, CreateAppSpawningCtx_GAppSpawnMgrNotInitialized) -{ - // 模拟 g_appSpawnMgr 为 NULL - g_appSpawnMgr = nullptr; - - // 调用 CreateAppSpawningCtx - AppSpawningCtx *ctx = CreateAppSpawningCtx(); - - // 验证返回的 ctx 是否有效 - ASSERT_NE(ctx, nullptr); - - // 验证 g_appSpawnMgr 为 NULL 时,节点不被添加到 appSpawnQueue - ASSERT_FALSE(OH_ListContains(&g_appSpawnMgr->appSpawnQueue, &ctx->node)); - - // 清理 - free(ctx); -} - -TEST_F(AppInfoCompareTest, CreateAppSpawningCtx_RequestIdIncrement) -{ - // 每次调用时 requestId 应递增 - g_appSpawnMgr = (AppSpawnMgr *)malloc(sizeof(AppSpawnMgr)); // 初始化 g_appSpawnMgr - AppSpawningCtx *ctx1 = CreateAppSpawningCtx(); - EXPECT_EQ(ctx1->client.id, 1); // 第一个 ctx 应该有 id 1 - - AppSpawningCtx *ctx2 = CreateAppSpawningCtx(); - EXPECT_EQ(ctx2->client.id, 2); // 第二个 ctx 应该有 id 2 - - // 清理 - free(ctx1); - free(ctx2); - free(g_appSpawnMgr); -} -TEST_F(AppInfoCompareTest, DeleteAppSpawningCtx_Success) -{ - // 创建一个 AppSpawningCtx 对象 - AppSpawningCtx *ctx = CreateAppSpawningCtx(); - ASSERT_NE(ctx, nullptr); // 确保 ctx 创建成功 - - // 模拟非空的成员 - ctx->forkCtx.timer = (void *)1; - ctx->forkCtx.watcherHandle = (void *)WATCHHANDLE_PTR; - ctx->forkCtx.coldRunPath = strdup("/some/path"); - ctx->forkCtx.fd[0] = FORKCTX_FD_0; - ctx->forkCtx.fd[1] = FORKCTX_FD_1; - - // 记录内存分配的地址以便验证是否被释放 - char *coldRunPath = ctx->forkCtx.coldRunPath; - int fd0 = ctx->forkCtx.fd[0]; - int fd1 = ctx->forkCtx.fd[1]; - - // 调用 DeleteAppSpawningCtx 删除 ctx - DeleteAppSpawningCtx(ctx); - - // 验证资源是否被清理 - EXPECT_EQ(ctx->forkCtx.timer, nullptr); - EXPECT_EQ(ctx->forkCtx.watcherHandle, nullptr); - EXPECT_EQ(ctx->forkCtx.coldRunPath, nullptr); - EXPECT_EQ(ctx->forkCtx.fd[0], -1); - EXPECT_EQ(ctx->forkCtx.fd[1], -1); - - // 验证 coldRunPath 是否被释放 - EXPECT_EQ(coldRunPath, nullptr); - - // 验证 fd 是否被关闭 - EXPECT_EQ(fd0, -1); - EXPECT_EQ(fd1, -1); -} - -TEST_F(AppInfoCompareTest, DeleteAppSpawningCtx_NullProperty) -{ - // 传入 NULL 应该不会执行任何操作 - DeleteAppSpawningCtx(nullptr); - // 无法验证返回值,只能确保没有崩溃 -} - -TEST_F(AppInfoCompareTest, DeleteAppSpawningCtx_MessageNull) -{ - // 创建一个 AppSpawningCtx 对象 - AppSpawningCtx *ctx = CreateAppSpawningCtx(); - ASSERT_NE(ctx, nullptr); // 确保 ctx 创建成功 - - // 设置 message 为 NULL - ctx->message = nullptr; - - // 调用 DeleteAppSpawningCtx 删除 ctx - DeleteAppSpawningCtx(ctx); - - // 验证 message 是否没有被删除 - EXPECT_EQ(ctx->message, nullptr); - - free(ctx); -} - -TEST_F(AppInfoCompareTest, DeleteAppSpawningCtx_NodeRemoved) -{ - // 创建一个 AppSpawningCtx 对象并初始化队列 - g_appSpawnMgr = (AppSpawnMgr *)malloc(sizeof(AppSpawnMgr)); // 初始化 g_appSpawnMgr - AppSpawningCtx *ctx = CreateAppSpawningCtx(); - ASSERT_NE(ctx, nullptr); // 确保 ctx 创建成功 - - // 添加到队列 - OH_ListAddTail(&g_appSpawnMgr->appSpawnQueue, &ctx->node); - - // 调用 DeleteAppSpawningCtx 删除 ctx - DeleteAppSpawningCtx(ctx); - - // 验证节点是否已被移除 - ASSERT_FALSE(OH_ListContains(&g_appSpawnMgr->appSpawnQueue, &ctx->node)); - - // 清理 - free(ctx); - free(g_appSpawnMgr); -} - -TEST_F(AppInfoCompareTest, DeleteAppSpawningCtx_TimerNull) -{ - // 创建一个 AppSpawningCtx 对象 - AppSpawningCtx *ctx = CreateAppSpawningCtx(); - ASSERT_NE(ctx, nullptr); // 确保 ctx 创建成功 - - // 设置 timer 为 NULL - ctx->forkCtx.timer = nullptr; - - // 调用 DeleteAppSpawningCtx 删除 ctx - DeleteAppSpawningCtx(ctx); - - // 验证 timer 没有被调用 - EXPECT_EQ(ctx->forkCtx.timer, nullptr); - - free(ctx); -} - -TEST_F(AppInfoCompareTest, DeleteAppSpawningCtx_WatcherHandleNull) -{ - // 创建一个 AppSpawningCtx 对象 - AppSpawningCtx *ctx = CreateAppSpawningCtx(); - ASSERT_NE(ctx, nullptr); // 确保 ctx 创建成功 - - // 设置 watcherHandle 为 NULL - ctx->forkCtx.watcherHandle = nullptr; - - // 调用 DeleteAppSpawningCtx 删除 ctx - DeleteAppSpawningCtx(ctx); - - // 验证 watcherHandle 没有被调用 - EXPECT_EQ(ctx->forkCtx.watcherHandle, nullptr); - - free(ctx); -} - -TEST_F(AppInfoCompareTest, DeleteAppSpawningCtx_ColdRunPathNull) -{ - // 创建一个 AppSpawningCtx 对象 - AppSpawningCtx *ctx = CreateAppSpawningCtx(); - ASSERT_NE(ctx, nullptr); // 确保 ctx 创建成功 - - // 设置 coldRunPath 为 NULL - ctx->forkCtx.coldRunPath = nullptr; - - // 调用 DeleteAppSpawningCtx 删除 ctx - DeleteAppSpawningCtx(ctx); - - // 验证 coldRunPath 没有被释放 - EXPECT_EQ(ctx->forkCtx.coldRunPath, nullptr); - - free(ctx); -} - -TEST_F(AppInfoCompareTest, DeleteAppSpawningCtx_FdValid) -{ - // 创建一个 AppSpawningCtx 对象 - AppSpawningCtx *ctx = CreateAppSpawningCtx(); - ASSERT_NE(ctx, nullptr); // 确保 ctx 创建成功 - - // 设置 fd 为有效值 - ctx->forkCtx.fd[0] = FORKCTX_FD_0; - ctx->forkCtx.fd[1] = FORKCTX_FD_1; - - // 调用 DeleteAppSpawningCtx 删除 ctx - DeleteAppSpawningCtx(ctx); - - // 验证 fd 是否被关闭并重置为 -1 - EXPECT_EQ(ctx->forkCtx.fd[0], -1); - EXPECT_EQ(ctx->forkCtx.fd[1], -1); - - free(ctx); -} - -TEST_F(AppInfoCompareTest, AppPropertyComparePid_MatchingPid) -{ - pid_t pid = 1234; // Example pid - AppSpawningCtx ctx = {.pid = pid}; // Create a context with matching pid - - ListNode node; - node.data = &ctx; - - // Call the comparison function - int result = AppPropertyComparePid(&node, &pid); - - // Check if it returns 0 (match) - EXPECT_EQ(result, 0); -} - -TEST_F(AppInfoCompareTest, AppPropertyComparePid_NonMatchingPid) -{ - pid_t pid = 1234; - pid_t other_pid = 5678; // Different pid - AppSpawningCtx ctx = {.pid = other_pid}; // Create context with non-matching pid - - ListNode node; - node.data = &ctx; - - // Call the comparison function - int result = AppPropertyComparePid(&node, &pid); - - // Check if it returns 1 (no match) - EXPECT_EQ(result, 1); -} - -TEST_F(AppInfoCompareTest, GetAppSpawningCtxByPid_Success) -{ - pid_t pid = 1234; - AppSpawningCtx ctx = {.pid = pid}; // Create a context with matching pid - - g_appSpawnMgr = (AppSpawnMgr *)malloc(sizeof(AppSpawnMgr)); - OH_ListInit(&g_appSpawnMgr->appSpawnQueue); // Initialize the app spawn queue - OH_ListAddTail(&g_appSpawnMgr->appSpawnQueue, &ctx.node); // Add the context to the list - - // Call the function to get the context by pid - AppSpawningCtx *result = GetAppSpawningCtxByPid(pid); - - // Check if the returned context matches the one we added - EXPECT_EQ(result, &ctx); - - free(g_appSpawnMgr); // Clean up -} - -TEST_F(AppInfoCompareTest, GetAppSpawningCtxByPid_NotFound) -{ - pid_t pid = 1234; // Example pid - pid_t non_existing_pid = 5678; // A pid that doesn't exist in the list - AppSpawningCtx ctx = {.pid = pid}; // Create a context with a different pid - - g_appSpawnMgr = (AppSpawnMgr *)malloc(sizeof(AppSpawnMgr)); - OH_ListInit(&g_appSpawnMgr->appSpawnQueue); // Initialize the app spawn queue - OH_ListAddTail(&g_appSpawnMgr->appSpawnQueue, &ctx.node); // Add the context to the list - - // Call the function to get the context by pid - AppSpawningCtx *result = GetAppSpawningCtxByPid(non_existing_pid); - - // Check if the result is NULL, as no matching pid exists - EXPECT_EQ(result, nullptr); - - free(g_appSpawnMgr); // Clean up -} - -TEST_F(AppInfoCompareTest, GetAppSpawningCtxByPid_EmptyList) -{ - pid_t pid = 1234; // Example pid - - g_appSpawnMgr = (AppSpawnMgr *)malloc(sizeof(AppSpawnMgr)); - OH_ListInit(&g_appSpawnMgr->appSpawnQueue); // Initialize the app spawn queue (empty) - - // Call the function to get the context by pid - AppSpawningCtx *result = GetAppSpawningCtxByPid(pid); - - // Check if the result is NULL, as the list is empty - EXPECT_EQ(result, nullptr); - - free(g_appSpawnMgr); // Clean up -} - -TEST_F(AppInfoCompareTest, GetAppSpawningCtxByPid_FoundInMiddle) -{ - pid_t pid = 1234; - pid_t second_pid = 5678; // A different pid - - AppSpawningCtx first_ctx = {.pid = second_pid}; // Create first context with different pid - AppSpawningCtx second_ctx = {.pid = pid}; // Create second context with matching pid - - g_appSpawnMgr = (AppSpawnMgr *)malloc(sizeof(AppSpawnMgr)); - OH_ListInit(&g_appSpawnMgr->appSpawnQueue); // Initialize the app spawn queue - OH_ListAddTail(&g_appSpawnMgr->appSpawnQueue, &first_ctx.node); // Add first context - OH_ListAddTail(&g_appSpawnMgr->appSpawnQueue, &second_ctx.node); // Add second context (middle) - - // Call the function to get the context by pid - AppSpawningCtx *result = GetAppSpawningCtxByPid(pid); - - // Check if the returned context is the correct one - EXPECT_EQ(result, &second_ctx); - - free(g_appSpawnMgr); // Clean up -} -} diff --git a/test/autotest/sub_startup_appspawn_autotest/appspawn_kickdog_autotest.cpp b/test/autotest/sub_startup_appspawn_autotest/appspawn_kickdog_autotest.cpp deleted file mode 100644 index 55695751..00000000 --- a/test/autotest/sub_startup_appspawn_autotest/appspawn_kickdog_autotest.cpp +++ /dev/null @@ -1,213 +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. - */ - -#include -#include -#include -#include -#include "appspawn_utils.h" // 假设这个头文件包含了 OpenAndWriteToProc 函数 - -using namespace testing; -using namespace testing::ext; - -namespace OHOS { -class AppSpawnUtilsTest : public testing::Test { -public: - static void SetUpTestCase() {} - static void TearDownTestCase() {} - void SetUp() - { - const TestInfo *info = UnitTest::GetInstance()->current_test_info(); - GTEST_LOG_(INFO) << info->test_suite_name() << "." << info->name() << " start"; - APPSPAWN_LOGI("%{public}s.%{public}s start", info->test_suite_name(), info->name()); - } - void TearDown() - { - const TestInfo *info = UnitTest::GetInstance()->current_test_info(); - GTEST_LOG_(INFO) << info->test_suite_name() << "." << info->name() << " end"; - APPSPAWN_LOGI("%{public}s.%{public}s end", info->test_suite_name(), info->name()); - } -}; - -/** -* @tc.name: OpenAndWriteToProc_Success -* @tc.desc: Verify that the function successfully writes to the file. -*/ -HWTEST_F(AppSpawnUtilsTest, OpenAndWriteToProc_Success, TestSize.Level0) -{ - const char *procName = "/proc/test"; - const char *writeStr = "Test Data"; - size_t writeLen = strlen(writeStr); - - // 模拟文件成功打开和写入 - int result = OpenAndWriteToProc(procName, writeStr, writeLen); - - EXPECT_GT(result, 0); // 假设返回写入的字节数 -} - -/** -* @tc.name: OpenAndWriteToProc_OpenFail -* @tc.desc: Verify that the function returns an error when opening the file fails. -*/ -HWTEST_F(AppSpawnUtilsTest, OpenAndWriteToProc_OpenFail, TestSize.Level0) -{ - const char *procName = "/proc/nonexistent"; - const char *writeStr = "Test Data"; - size_t writeLen = strlen(writeStr); - - // 模拟文件打开失败,返回 -1 - int result = OpenAndWriteToProc(procName, writeStr, writeLen); - - EXPECT_EQ(result, -1); // 打开失败,返回 -1 -} - -/** -* @tc.name: OpenAndWriteToProc_WriteFail -* @tc.desc: Verify that the function returns an error when writing to the file fails. -*/ -HWTEST_F(AppSpawnUtilsTest, OpenAndWriteToProc_WriteFail, TestSize.Level0) -{ - const char *procName = "/proc/test"; - const char *writeStr = nullptr; // 模拟空指针,写入失败 - size_t writeLen = 0; - - // 模拟写入失败 - int result = OpenAndWriteToProc(procName, writeStr, writeLen); - - EXPECT_EQ(result, -1); // 写入失败,返回 -1 -} - -/** -* @tc.name: GetProcFile_Linux -* @tc.desc: Verify that the function returns the correct procFile for Linux. -*/ -HWTEST_F(AppSpawnUtilsTest, GetProcFile_Linux, TestSize.Level0) -{ - bool isLinux = true; - const char *procFile = GetProcFile(isLinux); - - EXPECT_STREQ(procFile, LINUX_APPSPAWN_WATCHDOG_FILE); // 假设返回的是 LINUX_APPSPAWN_WATCHDOG_FILE -} - -/** -* @tc.name: GetProcFile_Other -* @tc.desc: Verify that the function returns the correct procFile for non-Linux platforms. -*/ -HWTEST_F(AppSpawnUtilsTest, GetProcFile_Other, TestSize.Level0) -{ - bool isLinux = false; - const char *procFile = GetProcFile(isLinux); - - EXPECT_STREQ(procFile, HM_APPSPAWN_WATCHDOG_FILE); // 假设非Linux平台返回的是 HM_APPSPAWN_WATCHDOG_FILE -} - -/** -* @tc.name: GetProcContent_Linux_Open -* @tc.desc: Verify that the function returns the correct content for Linux when open is true. -*/ -HWTEST_F(AppSpawnUtilsTest, GetProcContent_Linux_Open, TestSize.Level0) -{ - bool isLinux = true; - bool isOpen = true; - int mode = MODE_FOR_NWEB_SPAWN; - - const char *procContent = GetProcContent(isLinux, isOpen, mode); - - EXPECT_STREQ(procContent, LINUX_APPSPAWN_WATCHDOG_ON); // 假设返回 LINUX_APPSPAWN_WATCHDOG_ON -} - -/** -* @tc.name: GetProcContent_Linux_Close -* @tc.desc: Verify that the function returns the correct content for Linux when open is false. -*/ -HWTEST_F(AppSpawnUtilsTest, GetProcContent_Linux_Close, TestSize.Level0) -{ - bool isLinux = true; - bool isOpen = false; - int mode = MODE_FOR_HYBRID_SPAWN; - - const char *procContent = GetProcContent(isLinux, isOpen, mode); - - EXPECT_STREQ(procContent, LINUX_APPSPAWN_WATCHDOG_KICK); // 假设返回 LINUX_APPSPAWN_WATCHDOG_KICK -} - -/** -* @tc.name: GetProcContent_Other_Open -* @tc.desc: Verify that the function returns the correct content for non-Linux when open is true. -*/ -HWTEST_F(AppSpawnUtilsTest, GetProcContent_Other_Open, TestSize.Level0) -{ - bool isLinux = false; - bool isOpen = true; - int mode = MODE_FOR_HYBRID_SPAWN; - - const char *procContent = GetProcContent(isLinux, isOpen, mode); - - EXPECT_STREQ(procContent, HM_HYBRIDSPAWN_WATCHDOG_ON); // 假设返回 HM_HYBRIDSPAWN_WATCHDOG_ON -} - -/** -* @tc.name: GetProcContent_Other_Close -* @tc.desc: Verify that the function returns the correct content for non-Linux when open is false. -*/ -HWTEST_F(AppSpawnUtilsTest, GetProcContent_Other_Close, TestSize.Level0) -{ - bool isLinux = false; - bool isOpen = false; - int mode = MODE_FOR_NWEB_SPAWN; - - const char *procContent = GetProcContent(isLinux, isOpen, mode); - - EXPECT_STREQ(procContent, HM_NWEBSPAWN_WATCHDOG_KICK); // 假设返回 HM_NWEBSPAWN_WATCHDOG_KICK -} - -/** -* @tc.name: DealSpawnWatchdog_Success -* @tc.desc: Verify that the function works correctly when the watchdog is successfully dealt with. -*/ -HWTEST_F(AppSpawnUtilsTest, DealSpawnWatchdog_Success, TestSize.Level0) -{ - AppSpawnContent content; - content.isLinux = true; - content.mode = MODE_FOR_NWEB_SPAWN; - content.wdgOpened = false; - - // 模拟 OpenAndWriteToProc 成功 - EXPECT_CALL(*this, OpenAndWriteToProc(_, _, _)).WillOnce(Return(1)); // 假设写入成功 - - DealSpawnWatchdog(&content, true); - - EXPECT_TRUE(content.wdgOpened); // 验证 watchdog 状态 -} - -/** -* @tc.name: DealSpawnWatchdog_Failure -* @tc.desc: Verify that the function handles failure correctly when writing to the proc file fails. -*/ -HWTEST_F(AppSpawnUtilsTest, DealSpawnWatchdog_Failure, TestSize.Level0) -{ - AppSpawnContent content; - content.isLinux = true; - content.mode = MODE_FOR_HYBRID_SPAWN; - content.wdgOpened = false; - - // 模拟 OpenAndWriteToProc 失败 - EXPECT_CALL(*this, OpenAndWriteToProc(_, _, _)).WillOnce(Return(-1)); // 假设写入失败 - - DealSpawnWatchdog(&content, true); - - EXPECT_FALSE(content.wdgOpened); // 验证 watchdog 状态 -} -} diff --git a/test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0100.py b/test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0100.py deleted file mode 100644 index 0e24a7f9..00000000 --- a/test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0100.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium importFunction1, SpecificFunction2 - -from aw import Common - -class Substartupappspawncgroups0100(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.shell("power-shell setmode 602") - - def process(self): - hap_path = Common.sourcepath('ForkTest1.hap', "SUB_STARTUP_APPSPAWN_CGROUPS") - bundle_name - bundle_name = "com.example.exe_sys_cmd" - hap = self.driver.AppManager.has_app(bundle_name) - if hap: - self.driver.AppManager.clear_app_data(bundle_name) - self.driver.AppManager.uninstall_app(bundle_name) - self.driver.AppManager.install_app(hap_path) - else: - self.driver.AppManager.install_app(hap_path) - self.driver.AppManager.start_app(bundle_name) - pid = self.driver.System.get_pid(bundle_name) - result1 = self.driver.shell("ps -ef | grep %s" % bundle_name) - cgroup1 = self.driver.shell("cat /dev/pids/100/%s/app_%d/cgroup.procs" %(bundle_name, pid)).split() - count = 0 - for i in cgroup1: - self.driver.Assert.contains(result1.split(), i) - if result1.count(i) == 2: - count += 1 - self.driver.Assert.equal(count, 1) - result2 = self.driver.shell("kill -9 %d" % pid) - self.driver.Assert.equal(result2, '') - result3 = self.driver.shell("ps -ef |grep %s|grep -v grep " % bundle_name) - self.driver.Assert.equal(result3, '') - - def teardown(self): - Step("收尾工作.................") - self.driver.AppManager.clear_app_data(bundle_name) - self.driver.AppManager.uninstall_app(bundle_name) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_coldstart/sub_startup_appspawn_coldstart_0100.json b/test/autotest/sub_startup_appspawn_coldstart/sub_startup_appspawn_coldstart_0100.json deleted file mode 100644 index 49136690..00000000 --- a/test/autotest/sub_startup_appspawn_coldstart/sub_startup_appspawn_coldstart_0100.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_coldstart/Substartupappspawncoldstart0100.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_coldstart/sub_startup_appspawn_coldstart_0100.py b/test/autotest/sub_startup_appspawn_coldstart/sub_startup_appspawn_coldstart_0100.py deleted file mode 100644 index d0c65b3f..00000000 --- a/test/autotest/sub_startup_appspawn_coldstart/sub_startup_appspawn_coldstart_0100.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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 time import sleep -from devicetest.core.test_case import Step, TestCase -from hypium import HypiumFunction1, HypiumFunction - - -class Substartupappspawncoldstart0100(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("预置工作:初始化手机开始.................") - Step(self.devices[0].device_id) - - def test_step1(self): - Step("设置冷启动全局参数.................") - result = self.driver.shell('param set startup.appspawn.cold.boot 1') - sleep(3) - if "Set parameter startup.appspawn.cold.boot 1 success" in result: - pass - else: - raise ValueError('设置冷启动全局参数失败!') - Step("通过命令启动日历.................") - result = self.driver.shell("aa start -C -d 123456 -a MainAbility -b com.calendar") - sleep(3) - self.driver.Assert.contains(result, "start ability successfully.", "通过命令启动日历失败!") - Step("检查日历冷启动进程.................") - result_ps = self.driver.shell("ps -ef|grep com.calendar") - result_ps = result_ps.split('\n')[0] - Step("日历进程信息如下:" + str(result_ps)) - if '"' in result_ps: - throw std::logic_error("日进程信息中包含非法字符 \"") - - def teardown(self): - Step("收尾工作.................") - pid = self.driver.System.get_pid('com.calendar') - self.driver.shell("kill -9 " + str(pid)) - diff --git a/test/autotest/sub_startup_appspawn_coldstartablity/sub_startup_appspawn_coldstartablity_0100.json b/test/autotest/sub_startup_appspawn_coldstartablity/sub_startup_appspawn_coldstartablity_0100.json deleted file mode 100644 index 0a585dcc..00000000 --- a/test/autotest/sub_startup_appspawn_coldstartablity/sub_startup_appspawn_coldstartablity_0100.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_coldstartablity/Substartupappspawncoldstartablity0100.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_coldstartablity/sub_startup_appspawn_coldstartablity_0100.py b/test/autotest/sub_startup_appspawn_coldstartablity/sub_startup_appspawn_coldstartablity_0100.py deleted file mode 100644 index da2d64dc..00000000 --- a/test/autotest/sub_startup_appspawn_coldstartablity/sub_startup_appspawn_coldstartablity_0100.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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 time import sleep -from devicetest.core.test_case import Step, TestCase -from hyp import HypiumClass1, HypiumClass2, HypiumFunction1 - -from aw import Common - - -class Substartupappspawncoldstartablity0100(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("预置工作:初始化手机开始.................") - Step(self.devices[0].device_id) - Step("安装测试hap.................") - sourpath = Common.sourcepath("asan-enable.hap", "SUB_STARTUP_APPSPAWN_COLDSTARTABLITY") - Step(sourpath) - self.driver.AppManager.install_app(sourpath) - Step("预置工作:检测屏幕是否亮.................") - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def test_step1(self): - Step("打开测试hap.................") - self.driver.start_app("com.example.myapplication", "EntryAbility") - sleep(3) - pid = self.driver.System.get_pid('com.example.myapplication') - Step(pid) - Step("校验hap应用的maps.................") - result = self.driver.shell('cat ' + os.path.join('/proc', str(pid), 'maps') + '|grep libclang.asan.so') - Step(result) - self.driver.Assert.contains(result, '/system/lib64/libclang_rt.asan.so') - self.driver.Assert.contains(result, 'anon:libclang_rt.asan.so.bss') - - def teardown(self): - Step("收尾工作.................") - Step("收尾工作:卸载hap......................") - self.driver.AppManager.clear_app_data('com.example.myapplication') - self.driver.AppManager.uninstall_app('com.example.myapplication') diff --git a/test/autotest/sub_startup_appspawn_coldstartablity/sub_startup_appspawn_coldstartablity_0200.json b/test/autotest/sub_startup_appspawn_coldstartablity/sub_startup_appspawn_coldstartablity_0200.json deleted file mode 100644 index 0e9342a4..00000000 --- a/test/autotest/sub_startup_appspawn_coldstartablity/sub_startup_appspawn_coldstartablity_0200.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_coldstartablity/Substartupappspawncoldstartablity0200.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_coldstartablity/sub_startup_appspawn_coldstartablity_0200.py b/test/autotest/sub_startup_appspawn_coldstartablity/sub_startup_appspawn_coldstartablity_0200.py deleted file mode 100644 index 04fc5b10..00000000 --- a/test/autotest/sub_startup_appspawn_coldstartablity/sub_startup_appspawn_coldstartablity_0200.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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 time import sleep -from devicetest.core.test_case import Step, TestCase -from hyp import HypiumClass1, HypiumClass2, HypiumFunction1 - -from aw import Common - - -class Substartupappspawncoldstartablity0200(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("预置工作:初始化手机开始.................") - Step(self.devices[0].device_id) - Step("安装测试hap.................") - sourpath = Common.sourcepath("asan-disable.hap", "SUB_STARTUP_APPSPAWN_COLDSTARTABLITY") - Step(sourpath) - self.driver.AppManager.install_app(sourpath) - Step("预置工作:检测屏幕是否亮.................") - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def test_step1(self): - Step("打开测试hap.................") - self.driver.start_app("com.example.myapplication", "EntryAbility") - sleep(3) - pid = self.driver.System.get_pid('com.example.myapplication') - Step(pid) - Step("校验hap应用的maps.................") - Step(result) - self.driver.Assert.equal(result, '') - - - def teardown(self): - Step("收尾工作.................") - Step("收尾工作:卸载hap......................") - self.driver.AppManager.clear_app_data('com.example.myapplication') - self.driver.AppManager.uninstall_app('com.example.myapplication') diff --git a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0200.json b/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0200.json deleted file mode 100644 index 66713d04..00000000 --- a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0200.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_debughap/SubStartupAppspawnDebughap0200.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0200.py b/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0200.py deleted file mode 100644 index dec704a0..00000000 --- a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0200.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import os -import time -from devicetest.core.test_case import TestCase, Step -from hypium.action.os_hypium.device_logger import DeviceLogger -from aw import Common - - -class SubStartupAppspawnDebughap0200(TestCase): - - def __init__(self, controllers): - TestCase.__init__(self, self.TAG, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - Step("安装测试hap并打开") - bundle_name = "com.example.myapplication" - hap_path = Common.sourcepath('debug.hap', "sub_startup_appspawn_debughap") - hap = self.driver.AppManager.has_app(bundle_name) - if hap: - self.driver.AppManager.uninstall_app(bundle_name) - self.driver.AppManager.install_app(hap_path) - else: - self.driver.AppManager.install_app(hap_path) - self.driver.shell("param set startup.appspawn.sandbox.debughap true") - self.driver.AppManager.start_app(bundle_name) - - result = self.driver.shell("ls /mnt/debug/100/debug_hap").split() - self.driver.Assert.contains(result, bundle_name) - - def teardown(self): - Step("收尾工作.................") - self.driver.AppManager.stop_app(bundle_name) - self.driver.AppManager.uninstall_app(bundle_name) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0300.json b/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0300.json deleted file mode 100644 index 4918b0b9..00000000 --- a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0300.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_debughap/SubStartupAppspawnDebughap0300.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0300.py b/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0300.py deleted file mode 100644 index fb7609b2..00000000 --- a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0300.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import os -import time -from devicetest.core.test_case import TestCase, Step -from hypium.action.os_hypium.device_logger import DeviceLogger -from aw import Common - - -class SubStartupAppspawnDebughap0300(TestCase): - - def __init__(self, controllers): - TestCase.__init__(self, self.TAG, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - Step("安装测试hap并打开") - bundle_name = "com.example.myapplication" - hap_path = Common.sourcepath('debug.hap', "sub_startup_appspawn_debughap") - hap = self.driver.AppManager.has_app(bundle_name) - if hap: - self.driver.AppManager.uninstall_app(bundle_name) - self.driver.AppManager.install_app(hap_path) - else: - self.driver.AppManager.install_app(hap_path) - self.driver.shell("param set startup.appspawn.sandbox.debughap true") - self.driver.AppManager.start_app(bundle_name) - - sandbox_list = [] - mount_dict = list(filter(None, self.driver.shell("mount|grep %s" % bundle_name).split("\n"))) - for mount in mount_dict: - if mount.split()[2].startswith("/mnt/debug"): - sandbox_list.append(mount.split()[2]) - else: - pass - - for i in range(1, 5): - for path in ["base", "database"]: - self.driver.Assert.contains(sandbox_list, "/mnt/debug/100/debug_hap/%s/data/storage/el%d/%s" - % (bundle_name, i, path)) - - list01 = ["el2/share", "el2/log", "el1/bundle", "el2/auth_groups", "el2/distributedfiles"] - for path in list01: - self.driver.Assert.contains(sandbox_list, "/mnt/debug/100/debug_hap/%s/data/storage/%s" - % (bundle_name, path)) - - def teardown(self): - Step("收尾工作.................") - self.driver.AppManager.stop_app(bundle_name) - self.driver.AppManager.uninstall_app(bundle_name) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0500.json b/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0500.json deleted file mode 100644 index a8e1e788..00000000 --- a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0500.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_debughap/SubStartupAppspawnDebughap0500.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0600.json b/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0600.json deleted file mode 100644 index 7a19d9b4..00000000 --- a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0600.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device", - "label": "" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_debughap/SubStartupAppspawnDebughap0600.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0700.json b/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0700.json deleted file mode 100644 index 5538e209..00000000 --- a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0700.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_debughap/SubStartupAppspawnDebughap0700.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0800.json b/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0800.json deleted file mode 100644 index d17ff07f..00000000 --- a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0800.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_debughap/SubStartupAppspawnDebughap0800.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0800.py b/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0800.py deleted file mode 100644 index 7974ad11..00000000 --- a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0800.py +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import os -import time -from devicetest.core.test_case import TestCase, Step -from hypium.action.os_hypium.device_logger import DeviceLogger -from aw import Common - - -class SubStartupAppspawnDebughap0800(TestCase): - - def __init__(self, controllers): - TestCase.__init__(self, self.TAG, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - Step("安装测试hap并打开") - bundle_name = "com.example.myapplication" - hap_path = Common.sourcepath('debug.hap', "sub_startup_appspawn_debughap") - hap = self.driver.AppManager.has_app(bundle_name) - if hap: - self.driver.AppManager.clear_app_data(bundle_name) - self.driver.AppManager.uninstall_app(bundle_name) - self.driver.AppManager.install_app(hap_path) - else: - self.driver.AppManager.install_app(hap_path) - self.driver.AppManager.start_app(bundle_name) - - for i in range(1, 5): - for path in {"database", "base"}: - mac_path = self.driver.Storage.has_dir("/data/app/el%d/100/%s/%s" % (i, path, bundle_name)) - sandbox_path = self.driver.Storage.has_dir("/mnt/debug/100/debug_hap/%s/data/storage/el%d/%s" - % (bundle_name, i, path)) - self.driver.Assert.equal(mac_path, sandbox_path) - - if mac_path is True: - mac_path_content = self.driver.shell("ls /data/app/el%d/100/%s/%s" % (i, path, bundle_name)) - sandbox_path_content = self.driver.shell("ls /mnt/debug/100/debug_hap/%s/data/storage/el%d/%s" - % (bundle_name, i, path)) - self.driver.Assert.equal(mac_path_content, sandbox_path_content) - - path_dict = { - "/mnt/hmdfs/100/non_account/merge_view/data": "el2/auth_groups", - "/mnt/hmdfs/100/account/merge_view/data": "el2/distributedfiles", - "/data/app/el2/100/log": "el2/log", - "/data/app/el1/bundle/public": "el1/bundle", - "/mnt/share/100": "el2/share" - } - - for mac, sandbox in path_dict.items(): - if mac != "/mnt/hmdfs/100/non_account/merge_view/data": - mac_path = self.driver.Storage.has_dir("%s/%s" % (mac, bundle_name)) - sandbox_path = self.driver.Storage.has_dir("/mnt/debug/100/debug_hap/%s/data/storage/%s" - % (bundle_name, sandbox)) - self.driver.Assert.equal(mac_path, sandbox_path) - if mac_path is True: - mac_path_content = self.driver.shell("ls %s/%s" % (mac, bundle_name)) - sandbox_path_content = self.driver.shell( - "ls /mnt/debug/100/debug_hap/%s/data/storage/%s" % (bundle_name, sandbox)) - self.driver.Assert.equal(mac_path_content, sandbox_path_content) - else: - mac_path = self.driver.Storage.has_dir("%s" % mac) - sandbox_path = self.driver.Storage.has_dir("/mnt/debug/100/debug_hap/%s/data/storage/%s" - % (bundle_name, sandbox)) - self.driver.Assert.equal(mac_path, sandbox_path) - if mac_path is True: - mac_path_content = self.driver.shell("ls %s" % mac) - sandbox_path_content = self.driver.shell("ls /mnt/debug/100/debug_hap/%s/data/storage/%s" - % (bundle_name, sandbox)) - self.driver.Assert.equal(mac_path_content, sandbox_path_content) - - def teardown(self): - Step("收尾工作.................") - self.driver.AppManager.stop_app(bundle_name) - self.driver.AppManager.uninstall_app(bundle_name) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0900.json b/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0900.json deleted file mode 100644 index ab601307..00000000 --- a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0900.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_debughap/SubStartupAppspawnDebughap0900.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0100.json b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0100.json similarity index 70% rename from test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0100.json rename to test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0100.json index 2e315add..02dfa622 100644 --- a/test/autotest/sub_startup_appspawn_cgroups/sub_startup_appspawn_cgroups_0100.json +++ b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0100.json @@ -8,7 +8,7 @@ "driver": { "type": "DeviceTest", "py_file": [ - "sub_startup_appspawn_cgroups/Substartupappspawncgroups0100.py" + "sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0100.py" ] } } \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0100.py b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0100.py similarity index 65% rename from test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0100.py rename to test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0100.py index a429b69f..08ecc379 100644 --- a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0100.py +++ b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0100.py @@ -16,18 +16,21 @@ import os import time from devicetest.core.test_case import TestCase, Step +from hypium import * from hypium.action.os_hypium.device_logger import DeviceLogger from aw import Common -class SubStartupAppspawnDebughap0100(TestCase): +SubStartupAppspawnDevicedebug0100(TestCase): def __init__(self, controllers): - TestCase.__init__(self, self.TAG, controllers) + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) self.driver = UiDriver(self.device1) def setup(self): Step(self.devices[0].device_id) + global device device = self.driver.shell("param get const.product.model") device = device.replace("\n", "").replace(" ", "") device = str(device) @@ -44,8 +47,9 @@ class SubStartupAppspawnDebughap0100(TestCase): def process(self): Step("安装测试hap并打开") - bundle_name = "com.example.release" - hap_path = Common.sourcepath('release.hap', "sub_startup_appspawn_debughap") + global bundle_name + bundle_name = "com.example.myapplication" + hap_path = Common.sourcepath('release.hap', "sub_startup_appspawn_devicedebug") hap = self.driver.AppManager.has_app(bundle_name) if hap: self.driver.AppManager.clear_app_data(bundle_name) @@ -54,9 +58,23 @@ class SubStartupAppspawnDebughap0100(TestCase): else: self.driver.AppManager.install_app(hap_path) self.driver.AppManager.start_app(bundle_name) + pid1 = self.driver.System.get_pid(bundle_name) - release_has = self.driver.Storage.has_dir("/mnt/debug/100/debug_hap/%s" % bundle_name) - self.driver.Assert.equal(release_has, False) + Step("开启日志") + device_logger = DeviceLogger(self.driver).set_filter_string("C02C11") + log_name = 'LOG_' + os.path.basename(__file__).split('.')[0] + device_logger.start_log("testFile/sub_startup_appspawn_devicedebug/%s.txt" % log_name) + + Step("devicedebug发送kill信号") + self.driver.shell("devicedebug kill -9 %d" % pid1) + pid2 = self.driver.System.get_pid(bundle_name) + self.driver.Assert.equal(pid1, pid2) + + Step("匹配日志") + device_logger.stop_log() + time.sleep(10) + assert device_logger.check_log("devicedebug cmd kill start signal[9], pid[%d]" % pid1) + assert device_logger.check_log("appspawn devicedebug process is not debuggable, pid=%d" % pid1) def teardown(self): Step("收尾工作.................") diff --git a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0100.json b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0200.json similarity index 70% rename from test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0100.json rename to test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0200.json index 1fd513bc..2910d9a0 100644 --- a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0100.json +++ b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0200.json @@ -8,7 +8,7 @@ "driver": { "type": "DeviceTest", "py_file": [ - "sub_startup_appspawn_debughap/SubStartupAppspawnDebughap0100.py" + "sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0200.py" ] } } \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0600.py b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0200.py similarity index 64% rename from test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0600.py rename to test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0200.py index 446185f8..47ac9c3b 100644 --- a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0600.py +++ b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0200.py @@ -16,18 +16,21 @@ import os import time from devicetest.core.test_case import TestCase, Step +from hypium import * from hypium.action.os_hypium.device_logger import DeviceLogger from aw import Common -class SubStartupAppspawnDebughap0600(TestCase): +SubStartupAppspawnDevicedebug0200(TestCase): def __init__(self, controllers): - TestCase.__init__(self, self.TAG, controllers) + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) self.driver = UiDriver(self.device1) def setup(self): Step(self.devices[0].device_id) + global device device = self.driver.shell("param get const.product.model") device = device.replace("\n", "").replace(" ", "") device = str(device) @@ -44,8 +47,9 @@ class SubStartupAppspawnDebughap0600(TestCase): def process(self): Step("安装测试hap并打开") + global bundle_name bundle_name = "com.example.myapplication" - hap_path = Common.sourcepath('debug.hap', "sub_startup_appspawn_debughap") + hap_path = Common.sourcepath('debug.hap', "sub_startup_appspawn_devicedebug") hap = self.driver.AppManager.has_app(bundle_name) if hap: self.driver.AppManager.clear_app_data(bundle_name) @@ -54,9 +58,25 @@ class SubStartupAppspawnDebughap0600(TestCase): else: self.driver.AppManager.install_app(hap_path) self.driver.AppManager.start_app(bundle_name) + pid1 = self.driver.System.get_pid(bundle_name) - result = self.driver.shell("ls /mnt/debug/100/debug_hap").split() - self.driver.Assert.contains(result, bundle_name) + Step("开启日志") + device_logger = DeviceLogger(self.driver).set_filter_string("C02C11") + log_name = 'LOG_' + os.path.basename(__file__).split('.')[0] + device_logger.start_log("testFile/sub_startup_appspawn_devicedebug/%s.txt" % log_name) + + Step("devicedebug发送kill信号") + self.driver.shell("devicedebug kill -9 %d" % pid1) + + Step("匹配日志") + device_logger.stop_log() + time.sleep(10) + assert device_logger.check_log("devicedebug cmd kill start signal[9], pid[%d]" % pid1) + assert device_logger.check_log("appspawn devicedebug debugable=1, pid=%d, signal=9" % pid1) + assert device_logger.check_log("devicedebug manager process exit. ret=0") + self.driver.AppManager.start_app(bundle_name) + pid2 = self.driver.System.get_pid(bundle_name) + self.driver.Assert.not_equal(pid1, pid2) def teardown(self): Step("收尾工作.................") diff --git a/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0300.json b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0300.json new file mode 100644 index 00000000..34848f52 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0300.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0300.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0700.py b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0300.py similarity index 58% rename from test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0700.py rename to test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0300.py index e19ac7fd..f84d39b3 100644 --- a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0700.py +++ b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0300.py @@ -16,28 +16,23 @@ import os import time from devicetest.core.test_case import TestCase, Step +from hypium import * from hypium.action.os_hypium.device_logger import DeviceLogger from aw import Common - -class SubStartupAppspawnDebughap0700(TestCase): - +SubStartupAppspawnDevicedebug0300(TestCase): def __init__(self, controllers): - TestCase.__init__(self, self.TAG, controllers) + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) self.driver = UiDriver(self.device1) def setup(self): Step(self.devices[0].device_id) + global device device = self.driver.shell("param get const.product.model") device = device.replace("\n", "").replace(" ", "") device = str(device) Step(device) - - self.driver.hdc("target mount") - self.driver.shell("mv /system/etc/init/init_dec.cfg /system/etc/init/init_dec.cfg_bak") - cfg_path = Common.sourcepath('init_dec.cfg', "sub_startup_appspawn_debughap") - self.driver.push_file(cfg_path, "/system/etc/init") - self.driver.System.reboot() # 解锁屏幕 wake = self.driver.Screen.is_on() time.sleep(0.5) @@ -50,8 +45,9 @@ class SubStartupAppspawnDebughap0700(TestCase): def process(self): Step("安装测试hap并打开") + global bundle_name bundle_name = "com.example.myapplication" - hap_path = Common.sourcepath('debug.hap', "sub_startup_appspawn_debughap") + hap_path = Common.sourcepath('debug.hap', "sub_startup_appspawn_devicedebug") hap = self.driver.AppManager.has_app(bundle_name) if hap: self.driver.AppManager.clear_app_data(bundle_name) @@ -59,20 +55,32 @@ class SubStartupAppspawnDebughap0700(TestCase): self.driver.AppManager.install_app(hap_path) else: self.driver.AppManager.install_app(hap_path) - self.driver.shell("param set startup.appspawn.sandbox.debughap true") - self.driver.AppManager.start_app(bundle_name) - has_dir = self.driver.Storage.has_dir("/mnt/debug/100/debug_hap/%s" % bundle_name) - self.driver.Assert.equal(has_dir, True) - result = self.driver.shell("ls /mnt/debug/100/debug_hap/%s" % bundle_name) - self.driver.Assert.contains(result, "Operation not permitted") + Step("开启日志") + device_logger = DeviceLogger(self.driver).set_filter_string("C02C11") + log_name = 'LOG_' + os.path.basename(__file__).split('.')[0] + device_logger.start_log("testFile/sub_startup_appspawn_devicedebug/%s.txt" % log_name) + + Step("devicedebug发送kill信号") + signal_lst = [1, 9, 11, 15, 64] + log_dict = {} + # 本地跑1-64的 但是由于太费时间,流水线跑signal_lst中这几个有代表性的就可以了 + for signal in signal_lst: # range(1, 65)替换signal_lst + self.driver.AppManager.start_app(bundle_name) + pid = self.driver.System.get_pid(bundle_name) + log_dict.update({signal: pid}) + self.driver.shell("devicedebug kill -%d %d" % (signal, pid)) + self.driver.AppManager.stop_app(bundle_name) + + Step("匹配日志") + device_logger.stop_log() + time.sleep(10) + for signal, pid in log_dict.items(): + assert device_logger.check_log("devicedebug cmd kill start signal[%d], pid[%d]" % (signal, pid)) + assert device_logger.check_log("appspawn devicedebug debugable=1, pid=%d, signal=%d" % (pid, signal)) + assert device_logger.check_log("devicedebug manager process exit. ret=0") def teardown(self): Step("收尾工作.................") - self.driver.hdc("target mount") - self.driver.shell("mv /system/etc/init/init_dec.cfg_bak /system/etc/init/init_dec.cfg") self.driver.AppManager.stop_app(bundle_name) self.driver.AppManager.uninstall_app(bundle_name) - self.driver.System.reboot() - self.driver.System.wait_for_boot_complete() - self.driver.shell("param set startup.appspawn.sandbox.debughap true") \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0400.json b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0400.json new file mode 100644 index 00000000..fea84661 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0400.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0400.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0400.py b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0400.py new file mode 100644 index 00000000..1c050e08 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0400.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# 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. + +import os +import time +from devicetest.core.test_case import TestCase, Step +from hypium import * +from hypium.action.os_hypium.device_logger import DeviceLogger +from aw import Common + + +SubStartupAppspawnDevicedebug0400(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + Step("安装测试hap并打开") + global bundle_name + bundle_name = "com.example.myapplication" + hap_path = Common.sourcepath('debug.hap', "sub_startup_appspawn_devicedebug") + hap = self.driver.AppManager.has_app(bundle_name) + if hap: + self.driver.AppManager.clear_app_data(bundle_name) + self.driver.AppManager.uninstall_app(bundle_name) + self.driver.AppManager.install_app(hap_path) + else: + self.driver.AppManager.install_app(hap_path) + + Step("开启日志") + device_logger = DeviceLogger(self.driver).set_filter_string("C02C11") + log_name = 'LOG_' + os.path.basename(__file__).split('.')[0] + device_logger.start_log("testFile/sub_startup_appspawn_devicedebug/%s.txt" % log_name) + + Step("devicedebug发送kill信号") + signal_lst = ["65", "0", "SIGKILL", "null", "undefined", "sigkill"] + for signal in signal_lst: + self.driver.AppManager.start_app(bundle_name) + pid1 = self.driver.System.get_pid(bundle_name) + self.driver.shell("devicedebug kill -%s %d" % (signal, pid1)) + pid2 = self.driver.System.get_pid(bundle_name) + self.driver.Assert.equal(pid1, pid2) + + Step("匹配日志") + device_logger.stop_log() + time.sleep(10) + for i in range(len(signal_lst)): + assert device_logger.check_log("devicedebug manager process start.") + assert device_logger.check_log("devicedebug manager process exit. ret=22") + assert device_logger.check_log("signal is 65 not in [1, 64]") + assert device_logger.check_log("signal is 0 not in [1, 64]", expect_match_times=len(signal_lst)-1) + + + def teardown(self): + Step("收尾工作.................") + self.driver.AppManager.stop_app(bundle_name) + self.driver.AppManager.uninstall_app(bundle_name) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0500.json b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0500.json new file mode 100644 index 00000000..15c0777e --- /dev/null +++ b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0500.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0500.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0900.py b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0500.py similarity index 66% rename from test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0900.py rename to test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0500.py index 67a388ef..611d0c82 100644 --- a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0900.py +++ b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0500.py @@ -16,18 +16,21 @@ import os import time from devicetest.core.test_case import TestCase, Step +from hypium import * from hypium.action.os_hypium.device_logger import DeviceLogger from aw import Common -class SubStartupAppspawnDebughap0900(TestCase): +SubStartupAppspawnDevicedebug0500(TestCase): def __init__(self, controllers): - TestCase.__init__(self, self.TAG, controllers) + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) self.driver = UiDriver(self.device1) def setup(self): Step(self.devices[0].device_id) + global device device = self.driver.shell("param get const.product.model") device = device.replace("\n", "").replace(" ", "") device = str(device) @@ -44,8 +47,9 @@ class SubStartupAppspawnDebughap0900(TestCase): def process(self): Step("安装测试hap并打开") + global bundle_name bundle_name = "com.example.myapplication" - hap_path = Common.sourcepath('debug.hap', "sub_startup_appspawn_debughap") + hap_path = Common.sourcepath('debug.hap', "sub_startup_appspawn_devicedebug") hap = self.driver.AppManager.has_app(bundle_name) if hap: self.driver.AppManager.clear_app_data(bundle_name) @@ -53,10 +57,25 @@ class SubStartupAppspawnDebughap0900(TestCase): self.driver.AppManager.install_app(hap_path) else: self.driver.AppManager.install_app(hap_path) + + Step("开启日志") + device_logger = DeviceLogger(self.driver).set_filter_string("C02C11") + log_name = 'LOG_' + os.path.basename(__file__).split('.')[0] + device_logger.start_log("testFile/sub_startup_appspawn_devicedebug/%s.txt" % log_name) + + Step("devicedebug发送kill信号") self.driver.AppManager.start_app(bundle_name) + pid1 = self.driver.System.get_pid(bundle_name) + self.driver.shell("devicedebug kill %d" % pid1) + pid2 = self.driver.System.get_pid(bundle_name) + self.driver.Assert.equal(pid1, pid2) - result = self.driver.shell("ls -Z /mnt/debug/100") - self.driver.Assert.contains(result, "u:object_r:sharefs:s0 debug_hap") + Step("匹配日志") + device_logger.stop_log() + time.sleep(10) + assert device_logger.check_log("devicedebug manager process start.") + assert device_logger.check_log("devicedebug cmd operator num is 3 < 4") + assert device_logger.check_log("devicedebug manager process exit. ret=18") def teardown(self): Step("收尾工作.................") diff --git a/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0600.json b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0600.json new file mode 100644 index 00000000..e4e5f0d6 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0600.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0600.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1800.py b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0600.py similarity index 58% rename from test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1800.py rename to test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0600.py index 53eeb475..6f755915 100644 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1800.py +++ b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0600.py @@ -13,12 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os import time from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup +from hypium import * +from hypium.action.os_hypium.device_logger import DeviceLogger +from aw import Common -class SubStartupAppspawnFilemgrSandbox1800(TestCase): +SubStartupAppspawnDevicedebug0600(TestCase): def __init__(self, controllers): self.tag = self.__class__.__name__ @@ -27,7 +30,7 @@ class SubStartupAppspawnFilemgrSandbox1800(TestCase): def setup(self): Step(self.devices[0].device_id) - device + global device device = self.driver.shell("param get const.product.model") device = device.replace("\n", "").replace(" ", "") device = str(device) @@ -43,22 +46,21 @@ class SubStartupAppspawnFilemgrSandbox1800(TestCase): self.driver.Screen.enable_stay_awake() def process(self): - notepad - count = 0 - notepad = "com.notepad" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(notepad) - time.sleep(3) - pid = self.driver.System.get_pid(notepad) - result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata/el2/distributedfiles" % pid).split() - for bundle_name in result: - if "com." in bundle_name or "com.ohos" in bundle_name: - count += 1 - self.driver.Assert.greater(count, 0) + Step("开启日志") + device_logger = DeviceLogger(self.driver).set_filter_string("C02C11") + log_name = 'LOG_' + os.path.basename(__file__).split('.')[0] + device_logger.start_log("testFile/sub_startup_appspawn_devicedebug/%s.txt" % log_name) + Step("devicedebug发送kill信号") + pid = self.driver.System.get_pid("nwebspawn") + self.driver.shell("devicedebug kill -9 %d" % pid) + + Step("匹配日志") + device_logger.stop_log() + time.sleep(10) + assert device_logger.check_log("devicedebug cmd kill start signal[9], pid[%d]" % pid) + assert device_logger.check_log("appspawn devicedebug process is not debuggable, pid=%d" % pid) + assert device_logger.check_log("devicedebug manager process exit. ret=218103838") def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(notepad) - self.driver.AppManager.stop_app(notepad) \ No newline at end of file + Step("收尾工作.................") \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0700.json b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0700.json new file mode 100644 index 00000000..77aac977 --- /dev/null +++ b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0700.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0700.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0500.py b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0700.py similarity index 63% rename from test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0500.py rename to test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0700.py index e410e953..08ead140 100644 --- a/test/autotest/sub_startup_appspawn_debughap/sub_startup_appspawn_debughap_0500.py +++ b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0700.py @@ -16,18 +16,21 @@ import os import time from devicetest.core.test_case import TestCase, Step +from hypium import * from hypium.action.os_hypium.device_logger import DeviceLogger from aw import Common -class SubStartupAppspawnDebughap0500(TestCase): +SubStartupAppspawnDevicedebug0700(TestCase): def __init__(self, controllers): - TestCase.__init__(self, self.TAG, controllers) + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) self.driver = UiDriver(self.device1) def setup(self): Step(self.devices[0].device_id) + global device device = self.driver.shell("param get const.product.model") device = device.replace("\n", "").replace(" ", "") device = str(device) @@ -44,8 +47,9 @@ class SubStartupAppspawnDebughap0500(TestCase): def process(self): Step("安装测试hap并打开") - bundle_name = "com.example.myapplication" - hap_path = Common.sourcepath('debug.hap', "sub_startup_appspawn_debughap") + global bundle_name + bundle_name = "com.example.exe_sys_cmd" + hap_path = Common.sourcepath('debug_fork.hap', "sub_startup_appspawn_devicedebug") hap = self.driver.AppManager.has_app(bundle_name) if hap: self.driver.AppManager.clear_app_data(bundle_name) @@ -54,9 +58,22 @@ class SubStartupAppspawnDebughap0500(TestCase): else: self.driver.AppManager.install_app(hap_path) self.driver.AppManager.start_app(bundle_name) + result01 = self.driver.shell("ps -ef|grep exe_sys_cmd|grep -v grep").split("\n") + childprocess_pid = result01[1].split()[1] - result = self.driver.shell("ls -Z /mnt/debug/100/debug_hap").split("\n") - self.driver.Assert.contains(result, "u:object_r:sharefs:s0 %s" % bundle_name) + Step("开启日志") + device_logger = DeviceLogger(self.driver).set_filter_string("C02C11") + log_name = 'LOG_' + os.path.basename(__file__).split('.')[0] + device_logger.start_log("testFile/sub_startup_appspawn_devicedebug/%s.txt" % log_name) + + Step("devicedebug发送kill信号") + self.driver.shell("devicedebug kill -9 %s" % childprocess_pid) + + Step("匹配日志") + device_logger.stop_log() + time.sleep(10) + assert device_logger.check_log("appspawn devicedebug get app info unsuccess, pid=%s" % childprocess_pid) + assert device_logger.check_log("devicedebug manager process exit. ret=218103837") def teardown(self): Step("收尾工作.................") diff --git a/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0800.json b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0800.json new file mode 100644 index 00000000..1f4d8bbc --- /dev/null +++ b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0800.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0800.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0400.py b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0800.py similarity index 62% rename from test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0400.py rename to test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0800.py index 26a39493..6f078921 100644 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0400.py +++ b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0800.py @@ -13,12 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os import time from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup +from hypium import * +from hypium.action.os_hypium.device_logger import DeviceLogger +from aw import Common -class SubStartupAppspawnFilemgrSandbox0400(TestCase): +SubStartupAppspawnDevicedebug0800(TestCase): def __init__(self, controllers): self.tag = self.__class__.__name__ @@ -27,7 +30,7 @@ class SubStartupAppspawnFilemgrSandbox0400(TestCase): def setup(self): Step(self.devices[0].device_id) - device + global device device = self.driver.shell("param get const.product.model") device = device.replace("\n", "").replace(" ", "") device = str(device) @@ -43,19 +46,17 @@ class SubStartupAppspawnFilemgrSandbox0400(TestCase): self.driver.Screen.enable_stay_awake() def process(self): - file_mgr - file_mgr = "com.filemanager" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(file_mgr) - time.sleep(3) - pid = self.driver.System.get_pid(file_mgr) - result = self.driver.shell("ls -Z /proc/%d/root/storage/Users/currentUser/appdata/el2" % pid) - content = ["base", "distributedfiles", "cloud"] - for i in content: - self.driver.Assert.contains(result, "u:object_r:sharefs:s0 %s" % i) + devicedebug_help_dict = [ + "devicedebug: 'aaa' is not a valid devicedebug command. See 'devicedebug help'.", + "usage: devicedebug ", + "These are common devicedebug commands list:", + " help list available commands", + " kill send a signal(1-64) to a process" + ] + result_dict = list(filter(lambda x: x != "\r", self.driver.shell("devicedebug aaa").split("\n"))) + result_dict = list(filter(None, result_dict)) + for result in result_dict: + self.driver.Assert.contains(devicedebug_help_dict, result.rstrip("\r")) def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(file_mgr) - self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file + Step("收尾工作.................") \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0900.json b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0900.json new file mode 100644 index 00000000..323b277c --- /dev/null +++ b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0900.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0900.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0600.py b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0900.py similarity index 64% rename from test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0600.py rename to test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0900.py index e4914937..3701ead6 100644 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0600.py +++ b/test/autotest/sub_startup_appspawn_devicedebug/sub_startup_appspawn_devicedebug_0900.py @@ -13,12 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os import time from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup +from hypium import * +from hypium.action.os_hypium.device_logger import DeviceLogger +from aw import Common -class SubStartupAppspawnFilemgrSandbox0600(TestCase): +SubStartupAppspawnDevicedebug0900(TestCase): def __init__(self, controllers): self.tag = self.__class__.__name__ @@ -27,7 +30,7 @@ class SubStartupAppspawnFilemgrSandbox0600(TestCase): def setup(self): Step(self.devices[0].device_id) - device + global device device = self.driver.shell("param get const.product.model") device = device.replace("\n", "").replace(" ", "") device = str(device) @@ -43,17 +46,16 @@ class SubStartupAppspawnFilemgrSandbox0600(TestCase): self.driver.Screen.enable_stay_awake() def process(self): - file_mgr - file_mgr = "com.filemanager" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(file_mgr) - time.sleep(3) - pid = self.driver.System.get_pid(file_mgr) - result = self.driver.shell("ls -Z /proc/%d/root/storage/Users/currentUser/appdata/el1" % pid) - self.driver.Assert.contains(result, "u:object_r:sharefs:s0 base") + devicedebug_help_dict = [ + "usage: devicedebug ", + "These are common devicedebug commands list:", + " help list available commands", + " kill send a signal(1-64) to a process" + ] + result_dict = list(filter(lambda x: x != "\r", self.driver.shell("devicedebug help").split("\n"))) + result_dict = list(filter(None, result_dict)) + for result in result_dict: + self.driver.Assert.contains(devicedebug_help_dict, result.rstrip("\r")) def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(file_mgr) - self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file + Step("收尾工作.................") \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0100.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0100.json deleted file mode 100644 index 2b59544a..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0100.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox0100.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0100.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0100.py deleted file mode 100644 index 0a019433..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0100.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox0100(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - file_mgr - file_mgr = "com.filemanager" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(file_mgr) - time.sleep(3) - pid = self.driver.System.get_pid(file_mgr) - result = self.driver.shell("ls /proc/%d/root/storage" % pid).split() - content = ["External", "Users", "hmdfs"] - for i in content: - self.driver.Assert.contains(result, i) - - def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(file_mgr) - self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0200.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0200.json deleted file mode 100644 index 494b8688..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0200.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox0200.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0200.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0200.py deleted file mode 100644 index daf89fbc..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0200.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox0200(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - file_mgr - file_mgr = "com.filemanager" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(file_mgr) - time.sleep(3) - pid = self.driver.System.get_pid(file_mgr) - result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser" % pid).split() - content = ["Desktop", "Documents", "Download", "appdata"] - for i in content: - self.driver.Assert.contains(result, i) - - def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(file_mgr) - self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0300.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0300.json deleted file mode 100644 index d3d2775c..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0300.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox0300.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0300.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0300.py deleted file mode 100644 index a1b1e96b..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0300.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox0300(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - file_mgr - file_mgr = "com.filemanager" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(file_mgr) - time.sleep(3) - pid = self.driver.System.get_pid(file_mgr) - result = self.driver.shell("ls -Z /proc/%d/root/storage/Users/currentUser/appdata" % pid) - content = ["el1", "el2"] - for i in content: - self.driver.Assert.contains(result, "u:object_r:sharefs:s0 %s" % i) - - def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(file_mgr) - self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0400.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0400.json deleted file mode 100644 index 39d21ea1..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0400.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox0400.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0500.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0500.json deleted file mode 100644 index 603a7825..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0500.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox0500.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0500.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0500.py deleted file mode 100644 index 3c1c873b..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0500.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox0500(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - file_mgr - count = 0 - file_mgr = "com.filemanager" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(file_mgr) - time.sleep(3) - pid = self.driver.System.get_pid(file_mgr) - for i in range(1, 3): - result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata/el%d/base" % (pid, i)).split() - for bundle_name in result: - if "com." in bundle_name or "com.ohos" in bundle_name: - count += 1 - self.driver.Assert.greater(count, 0) - - def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(file_mgr) - self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0600.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0600.json deleted file mode 100644 index 4e801c20..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0600.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox0600.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0700.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0700.json deleted file mode 100644 index 8f16be1a..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0700.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox0700.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0700.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0700.py deleted file mode 100644 index 64725e22..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0700.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox0700(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - file_mgr - count = 0 - file_mgr = "com.filemanager" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(file_mgr) - time.sleep(3) - pid = self.driver.System.get_pid(file_mgr) - result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata/el2/distributedfiles" % pid,).split() - for bundle_name in result: - if "com." in bundle_name or "com.ohos" in bundle_name: - count += 1 - self.driver.Assert.greater(count, 0) - - def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(file_mgr) - self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0800.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0800.json deleted file mode 100644 index 80bd2cf2..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0800.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox0800.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0800.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0800.py deleted file mode 100644 index 4ddfadbd..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0800.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox0800(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - file_mgr - count = 0 - file_mgr = "com.filemanager" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(file_mgr) - time.sleep(3) - pid = self.driver.System.get_pid(file_mgr) - result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata/el2/cloud" % pid,).split() - for bundle_name in result: - if "com." in bundle_name or "com.ohos" in bundle_name: - count += 1 - self.driver.Assert.greater(count, 0) - - def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(file_mgr) - self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0900.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0900.json deleted file mode 100644 index 0c444897..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0900.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox0900.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0900.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0900.py deleted file mode 100644 index e0d16560..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_0900.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox0900(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - file_mgr - count = 0 - file_mgr = "com.filemanager" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(file_mgr) - time.sleep(3) - pid = self.driver.System.get_pid(file_mgr) - result = self.driver.shell("ls -Z /proc/%d/root/storage" % pid,).split() - for i in result: - if "sharefs" in i: - count += 1 - self.driver.Assert.equal(count, 0) - - def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(file_mgr) - self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1000.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1000.json deleted file mode 100644 index 56838555..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1000.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox1000.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1000.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1000.py deleted file mode 100644 index a9890f38..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1000.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox1000(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - notepad - notepad = "com.notepad" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(notepad) - time.sleep(3) - pid = self.driver.System.get_pid(notepad) - result = self.driver.shell("ls /proc/%d/root/storage" % pid) - content = ["External", "Users", "hmdfs"] - for i in content: - self.driver.Assert.contains(result, i) - - def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(notepad) - self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1100.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1100.json deleted file mode 100644 index 071a6565..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1100.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox1100.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1100.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1100.py deleted file mode 100644 index 0a81042e..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1100.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox1100(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - notepad - notepad = "com.notepad" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(notepad) - time.sleep(3) - pid = self.driver.System.get_pid(notepad) - result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser" % pid) - content = ["Desktop", "Documents", "Download", "appdata"] - for i in content: - self.driver.Assert.contains(result, i) - - def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(notepad) - self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1200.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1200.json deleted file mode 100644 index 1cdcdb7d..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1200.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox1200.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1200.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1200.py deleted file mode 100644 index 2ef1db99..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1200.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox1200(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - notepad - notepad = "com.notepad" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(notepad) - time.sleep(3) - pid = self.driver.System.get_pid(notepad) - result = self.driver.shell("ls -Z /proc/%d/root/storage" % pid) - content = ["External", "hmdfs", "Users"] - for i in content: - self.driver.Assert.contains(result, "u:object_r:sharefs:s0 %s" % i) - - def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(notepad) - self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1300.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1300.json deleted file mode 100644 index 6a974dd2..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1300.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox1300.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1300.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1300.py deleted file mode 100644 index 6231fe7e..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1300.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox1300(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - notepad - notepad = "com.notepad" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(notepad) - time.sleep(3) - pid = self.driver.System.get_pid(notepad) - result = self.driver.shell("ls -Z /proc/%d/root/storage/Users" % pid).rsplit("\n") - self.driver.Assert.equal(result[0], "u:object_r:sharefs:s0 currentUser") - - def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(notepad) - self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1400.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1400.json deleted file mode 100644 index 6be9d12e..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1400.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox1400.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1400.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1400.py deleted file mode 100644 index 7803be0c..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1400.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox1400(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - notepad - notepad = "com.notepad" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(notepad) - time.sleep(3) - pid = self.driver.System.get_pid(notepad) - result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata" % pid).split() - content = ["el1", "el2"] - for i in content: - self.driver.Assert.contains(result, i) - - def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(notepad) - self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1500.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1500.json deleted file mode 100644 index 3b303104..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1500.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox1500.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1500.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1500.py deleted file mode 100644 index 2a6326a1..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1500.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox1500(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - notepad - notepad = "com.notepad" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(notepad) - time.sleep(3) - pid = self.driver.System.get_pid(notepad) - result = self.driver.shell("ls -Z /proc/%d/root/storage/Users/currentUser/appdata/el2" % pid) - content = ["base", "distributedfiles", "cloud"] - for i in content: - self.driver.Assert.contains(result, "sharefs_appdata_file:s0 %s" % i) - - def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(notepad) - self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1600.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1600.json deleted file mode 100644 index cc7e90ae..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1600.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox1600.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1600.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1600.py deleted file mode 100644 index cde3680a..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1600.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox1600(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - notepad - count = 0 - notepad = "com.notepad" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(notepad) - time.sleep(3) - pid = self.driver.System.get_pid(notepad) - for i in range(1, 3): - result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata/el%d/base" % (pid, i)).split() - for bundle_name in result: - if "com." in bundle_name or "com.ohos" in bundle_name: - count += 1 - self.driver.Assert.greater(count, 0) - - def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(notepad) - self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1700.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1700.json deleted file mode 100644 index 987cdcae..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1700.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox1700.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1700.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1700.py deleted file mode 100644 index e9d03195..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1700.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox1700(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - notepad - notepad = "com.notepad" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(notepad) - time.sleep(3) - pid = self.driver.System.get_pid(notepad) - result = self.driver.shell("ls -Z /proc/%d/root/storage/Users/currentUser/appdata/el1" % pid).split("\n") - self.driver.Assert.equal(result[0], "u:object_r:sharefs_appdata_file:s0 base") - - def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(notepad) - self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1800.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1800.json deleted file mode 100644 index 93278ccf..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1800.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox1800.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1900.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1900.json deleted file mode 100644 index c6034bb5..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1900.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox1900.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1900.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1900.py deleted file mode 100644 index cec6adb6..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_1900.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox1900(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - notepad - count = 0 - notepad = "com.notepad" - self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.start_app(notepad) - time.sleep(3) - pid = self.driver.System.get_pid(notepad) - result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata/el2/cloud" % pid).split() - for bundle_name in result: - if "com." in bundle_name or "com.ohos" in bundle_name: - count += 1 - self.driver.Assert.greater(count, 0) - - - def teardown(self): - Step("收尾工作.................") - self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") - self.driver.AppManager.clear_app_data(notepad) - self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2000.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2000.json deleted file mode 100644 index b2533830..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2000.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox2000.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2000.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2000.py deleted file mode 100644 index e954c06d..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2000.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox2000(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - notepad - notepad = "com.notepad" - self.driver.AppManager.start_app(notepad) - time.sleep(3) - pid = self.driver.System.get_pid(notepad) - result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser" % pid) - self.driver.Assert.contains(result, "Operation not permitted") - - def teardown(self): - Step("收尾工作.................") - self.driver.AppManager.clear_app_data(notepad) - self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2100.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2100.json deleted file mode 100644 index d4d8580c..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2100.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox2100.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2100.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2100.py deleted file mode 100644 index d977d931..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2100.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox2100(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - notepad - notepad = "com.notepad" - self.driver.AppManager.start_app(notepad) - time.sleep(3) - pid = self.driver.System.get_pid(notepad) - result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata" % pid) - self.driver.Assert.contains(result, "Operation not permitted") - - def teardown(self): - Step("收尾工作.................") - self.driver.AppManager.clear_app_data(notepad) - self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2200.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2200.json deleted file mode 100644 index d204b6d2..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2200.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox2200.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2200.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2200.py deleted file mode 100644 index 2fbd8db1..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2200.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox2200(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - notepad - notepad = "com.notepad" - self.driver.AppManager.start_app(notepad) - time.sleep(3) - pid = self.driver.System.get_pid(notepad) - for i in range(1, 3): - result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata/el%d" % (pid, i)) - self.driver.Assert.contains(result, "Operation not permitted") - - def teardown(self): - Step("收尾工作.................") - self.driver.AppManager.clear_app_data(notepad) - self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2300.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2300.json deleted file mode 100644 index c1f9ef72..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2300.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox2300.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2300.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2300.py deleted file mode 100644 index 4062169b..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2300.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox2300(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - notepad - notepad = "com.notepad" - self.driver.AppManager.start_app(notepad) - time.sleep(3) - pid = self.driver.System.get_pid(notepad) - result = self.driver.shell("ls /proc/%d/root/storage/External" % pid) - self.driver.Assert.contains(result, "Operation not permitted") - - def teardown(self): - Step("收尾工作.................") - self.driver.AppManager.clear_app_data(notepad) - self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2500.json b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2500.json deleted file mode 100644 index b89444cb..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2500.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox2500.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2500.py b/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2500.py deleted file mode 100644 index 61a324b6..00000000 --- a/test/autotest/sub_startup_appspawn_filemgr_sandbox/sub_startup_appspawn_filemgr_sandbox_2500.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step -from hypium import FilemgrSandbox, Appspawn, SubStartup - - -class SubStartupAppspawnFilemgrSandbox2500(TestCase): - - def __init__(self, controllers): - self.tag = self.__class__.__name__ - TestCase.__init__(self, self.tag, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step(self.devices[0].device_id) - device - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - Step(device) - # 解锁屏幕 - wake = self.driver.Screen.is_on() - time.sleep(0.5) - if wake: - self.driver.ScreenLock.unlock() - else: - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def process(self): - notepad - notepad = "com.notepad" - self.driver.AppManager.start_app(notepad) - time.sleep(3) - pid = self.driver.System.get_pid(notepad) - result = self.driver.shell("ls /proc/%d/root/storage/hmdfs" % pid) - self.driver.Assert.contains(result, "Operation not permitted") - - def teardown(self): - Step("收尾工作.................") - self.driver.AppManager.clear_app_data(notepad) - self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0100.json b/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0100.json deleted file mode 100644 index 12504c72..00000000 --- a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0100.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_hnpinstall/SubStartupAppspawnHnpinstall0100.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0100.py b/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0100.py deleted file mode 100644 index 8aa9ec00..00000000 --- a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0100.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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.model import UiParam, WindowFilter -import os -from aw import Common - - -class SubStartupAppspawnHnpinstall0100(TestCase): - - def __init__(self, controllers): - 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() - - def test_step1(self): - Step("步骤1:安装测试应用") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - hnp = os.path.abspath(os.path.join( - os.path.join(path, "testFile"), 'SUB_STARTUP_APPSPAWN_NATIVE/entry-default-hnpinsall.hap')) - isHap = self.driver.has_app("com.example.hnp_test") - if(isHap): - self.driver.uninstall_app("com.example.hnp_test") - else: - pass - self.driver.install_app(hnp) - Step("是否刷root包") - isroot = self.driver.shell("ls") - Step("步骤2:展示公有目录列表") - result1 = self.driver.shell("ls /data/app/el1/bundle/100/hnppublic") - self.driver.Assert.contains(result1, "hnpsample.org") - if ("Permission denied" in isroot): - Step("步骤4:执行公有目录软链二进制") - th = Common.hnpexecute_async(self.driver, "/data/app/el1/bundle/100/hnppublic/bin/hnpsample 5") - th.start() - result3 = self.driver.shell("ps -ef | grep hnpsample | grep -v grep") - self.driver.Assert.contains(result3, "hnpsample") - else: - Step("步骤3:展示私有目录列表") - result2 = self.driver.shell("ls /data/app/el1/bundle/100/hnp/com.example.hnp_test") - self.driver.Assert.contains(result2, "node.org") - Step("步骤4:执行公有目录软链二进制") - result3 = self.driver.hdc("hdc shell /data/app/el1/bundle/100/hnppublic/bin/hnpsample") - self.driver.Assert.contains(result3, "start hnp sample") - self.driver.Assert.contains(result3, "hnp sample end") - - def teardown(self): - Step("收尾工作:卸载hap") - self.driver.uninstall_app("com.example.hnp_test") diff --git a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0200.json b/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0200.json deleted file mode 100644 index 8a17d83b..00000000 --- a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0200.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_hnpinstall/SubStartupAppspawnHnpinstall0200.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0200.py b/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0200.py deleted file mode 100644 index 4831a3f7..00000000 --- a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0200.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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.model import UiParam, WindowFilter -import os - - -class SubStartupAppspawnHnpinstall0200(TestCase): - - def __init__(self, controllers): - 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() - - def test_step1(self): - Step("步骤1:安装测试应用") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - hnp = os.path.abspath(os.path.join( - os.path.join(path, "testFile"), 'SUB_STARTUP_APPSPAWN_NATIVE/entry-default-hnpinsall.hap')) - isHap = self.driver.has_app("com.example.hnp_test") - if(isHap): - self.driver.uninstall_app("com.example.hnp_test") - else: - pass - self.driver.install_app(hnp) - Step("步骤2:读取公有目录列表") - result1 = self.driver.shell("cat /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/hnp.json") - self.driver.Assert.contains(result1, "hnpsample") - Step("是否刷root包") - isroot = self.driver.shell("ls") - if("Permission denied" in isroot): - Step("步骤3:读取私有目录列表") - result2 = self.driver.shell( - "cat /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/hnp.json") - self.driver.Assert.contains(result2, "Permission denied") - else: - Step("步骤3:读取私有目录列表") - result2 = self.driver.shell("cat /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/hnp.json") - self.driver.Assert.contains(result2, "node") - - def teardown(self): - Step("收尾工作:卸载hap") - self.driver.uninstall_app("com.example.hnp_test") diff --git a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0300.json b/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0300.json deleted file mode 100644 index 90f6a911..00000000 --- a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0300.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_hnpinstall/SubStartupAppspawnHnpinstall0300.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0300.py b/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0300.py deleted file mode 100644 index 268ea56f..00000000 --- a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0300.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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.model import UiParam, WindowFilter -import os - - -class SubStartupAppspawnHnpinstall0300(TestCase): - - def __init__(self, controllers): - 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() - - def test_step1(self): - Step("步骤1:安装测试应用") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - hnp = os.path.abspath(os.path.join( - os.path.join(path, "testFile"), 'SUB_STARTUP_APPSPAWN_NATIVE/entry-default-hnpinsall.hap')) - isHap = self.driver.has_app("com.example.hnp_test") - if (isHap): - self.driver.uninstall_app("com.example.hnp_test") - else: - pass - self.driver.install_app(hnp) - isroot = self.driver.shell("ls") - if ("Permission denied" in isroot): - Step("步骤2:修改公有目录文件内容") - data = {"name": "zsj", "sex": "girl", "age": 31}; - result1 = self.driver.shell(f"echo {data} > /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/hnp.json") - self.driver.Assert.contains(result1, "Permission denied") - Step("步骤3:修改私有目录文件内容") - data = {"name": "private", "sex": "girl", "age": 31}; - result2 = self.driver.shell(f"echo {data} > /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/hnp.json") - self.driver.Assert.contains(result2, "Permission denied") - else: - Step("步骤2:修改公有目录文件内容") - data = {"name": "zsj", "sex": "girl", "age": 31}; - self.driver.shell(f"echo {data} > /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/hnp.json") - result1 = self.driver.shell("cat /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/hnp.json") - self.driver.Assert.contains(result1, "zsj") - Step("步骤3:修改私有目录文件内容") - data = {"name": "private", "sex": "girl", "age": 31}; - self.driver.shell( - f"echo {data} > /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/hnp.json") - result2 = self.driver.shell( - "cat /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/hnp.json") - self.driver.Assert.contains(result2, "private") - - def teardown(self): - Step("收尾工作:卸载hap") - self.driver.uninstall_app("com.example.hnp_test") diff --git a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0400.json b/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0400.json deleted file mode 100644 index eab617a8..00000000 --- a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0400.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_hnpinstall/SubStartupAppspawnHnpinstall0400.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0400.py b/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0400.py deleted file mode 100644 index 67daef31..00000000 --- a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0400.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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.model import UiParam, WindowFilter -import os - - -class SubStartupAppspawnHnpinstall0400(TestCase): - - def __init__(self, controllers): - 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() - - def test_step1(self): - Step("步骤1:安装测试应用") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - hnp = os.path.abspath(os.path.join( - os.path.join(path, "testFile"), 'SUB_STARTUP_APPSPAWN_NATIVE/entry-default-hnpinsall.hap')) - isHap = self.driver.has_app("com.example.hnp_test") - if (isHap): - self.driver.uninstall_app("com.example.hnp_test") - else: - pass - self.driver.install_app(hnp) - isroot = self.driver.shell("ls") - if ("Permission denied" in isroot): - Step("步骤2:修改公有目录文件内容") - result1 = self.driver.shell(f"touch /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/123.txt") - self.driver.Assert.contains(result1, "Permission denied") - Step("步骤3:修改私有目录文件内容") - result2 = self.driver.shell(f"touch /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/abc.txt") - self.driver.Assert.contains(result2, "Permission denied") - else: - Step("步骤2:修改公有目录文件内容") - self.driver.shell(f"touch /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/123.txt") - result1 = self.driver.shell("ls /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/") - self.driver.Assert.contains(result1, "123.txt") - Step("步骤3:修改私有目录文件内容") - self.driver.shell(f"touch /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/abc.txt") - result2 = self.driver.shell( - "ls /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/") - self.driver.Assert.contains(result2, "abc.txt") - - def teardown(self): - Step("收尾工作:卸载hap") - self.driver.uninstall_app("com.example.hnp_test") diff --git a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0500.json b/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0500.json deleted file mode 100644 index 2cd61186..00000000 --- a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0500.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_hnpinstall/SubStartupAppspawnHnpinstall0500.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0500.py b/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0500.py deleted file mode 100644 index ad73decf..00000000 --- a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0500.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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.model import UiParam, WindowFilter -import os - - -class SubStartupAppspawnHnpinstall0500(TestCase): - - def __init__(self, controllers): - 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() - - def test_step1(self): - Step("步骤1:安装测试应用") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - hnp = os.path.abspath(os.path.join( - os.path.join(path, "testFile"), 'SUB_STARTUP_APPSPAWN_NATIVE/entry-default-hnpinsall.hap')) - isHap = self.driver.has_app("com.example.hnp_test") - if (isHap): - self.driver.uninstall_app("com.example.hnp_test") - else: - pass - self.driver.install_app(hnp) - isroot = self.driver.shell("ls") - if ("Permission denied" in isroot): - Step("步骤2:修改公有目录文件内容") - result1 = self.driver.shell( - f"rm -rf /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/hnp.json") - self.driver.Assert.contains(result1, "Permission denied") - Step("步骤3:修改私有目录文件内容") - result2 = self.driver.shell( - f"rm -rf /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/hnp.json") - self.driver.Assert.contains(result2, "Permission denied") - else: - Step("步骤2:修改公有目录文件内容") - self.driver.shell(f"rm -rf /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/hnp.json") - result1 = self.driver.shell("ls /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/") - self.driver.Assert.is_true("hnp.json" not in result1) - Step("步骤3:修改私有目录文件内容") - self.driver.shell(f"rm -rf /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/hnp.json") - result2 = self.driver.shell( - "ls /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/") - self.driver.Assert.is_true("hnp.json" not in result2) - - def teardown(self): - Step("收尾工作:卸载hap") - self.driver.uninstall_app("com.example.hnp_test") diff --git a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0600.json b/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0600.json deleted file mode 100644 index 009ebc7c..00000000 --- a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0600.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_hnpinstall/SubStartupAppspawnHnpinstall0600.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0600.py b/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0600.py deleted file mode 100644 index 20657682..00000000 --- a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0600.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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.model import UiParam, WindowFilter -import os - - -class SubStartupAppspawnHnpinstall0600(TestCase): - - def __init__(self, controllers): - 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() - - def test_step1(self): - Step("步骤1:安装测试应用") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - hnp = os.path.abspath(os.path.join( - os.path.join(path, "testFile"), 'SUB_STARTUP_APPSPAWN_NATIVE/entry-default-hnpinsall.hap')) - isHap = self.driver.has_app("com.example.hnp_test") - if (isHap): - self.driver.uninstall_app("com.example.hnp_test") - else: - pass - self.driver.install_app(hnp) - isroot = self.driver.shell("ls") - if ("Permission denied" in isroot): - Step("步骤2:修改公有目录文件内容") - result1 = self.driver.shell( - f"chmod 777 /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/hnp.json") - self.driver.Assert.contains(result1, "Operation not permitted") - Step("步骤3:修改私有目录文件内容") - result2 = self.driver.shell( - f"chmod 777 /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/hnp.json") - self.driver.Assert.contains(result2, "Permission denied") - else: - Step("步骤2:修改公有目录文件内容") - self.driver.shell(f"chmod 777 /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/hnp.json") - result1 = self.driver.shell("ls -l /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/hnp.json") - self.driver.Assert.contains(result1, "rwxrwxrwx") - Step("步骤3:修改私有目录文件内容") - self.driver.shell(f"chmod 777 /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/hnp.json") - result2 = self.driver.shell( - "ls -l /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/hnp.json") - self.driver.Assert.contains(result2, "rwxrwxrwx") - - def teardown(self): - Step("收尾工作:卸载hap") - self.driver.uninstall_app("com.example.hnp_test") diff --git a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0700.json b/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0700.json deleted file mode 100644 index 94f5f127..00000000 --- a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0700.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_hnpinstall/SubStartupAppspawnHnpinstall0700.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0700.py b/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0700.py deleted file mode 100644 index e1bfc549..00000000 --- a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0700.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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.model import UiParam, WindowFilter -import os - - -class SubStartupAppspawnHnpinstall0700(TestCase): - - def __init__(self, controllers): - 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() - - def test_step1(self): - Step("步骤1:安装测试应用") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - hnp = os.path.abspath(os.path.join( - os.path.join(path, "testFile"), 'SUB_STARTUP_APPSPAWN_NATIVE/entry-default-hnpinsall.hap')) - isHap = self.driver.has_app("com.example.hnp_test") - if (isHap): - self.driver.uninstall_app("com.example.hnp_test") - else: - pass - self.driver.install_app(hnp) - isroot = self.driver.shell("ls") - if ("Permission denied" in isroot): - Step("步骤2:修改公有目录文件内容") - result1 = self.driver.shell( - f"mv /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/hnp.json /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/zsj.json") - self.driver.Assert.contains(result1, "Permission denied") - Step("步骤3:修改私有目录文件内容") - result2 = self.driver.shell( - f"mv /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/hnp.json /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/zsj.json") - self.driver.Assert.contains(result2, "Permission denied") - else: - Step("步骤2:修改公有目录文件内容") - self.driver.shell(f"mv /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/hnp.json /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/zsj.json") - result1 = self.driver.shell("ls /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/") - self.driver.Assert.contains(result1, "zsj.json") - Step("步骤3:修改私有目录文件内容") - self.driver.shell(f"mv /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/hnp.json /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/zsj.json") - result2 = self.driver.shell( - "ls /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/") - self.driver.Assert.contains(result2, "zsj.json") - - -def teardown(self): - Step("收尾工作:卸载hap") - self.driver.uninstall_app("com.example.hnp_test") diff --git a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0800.json b/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0800.json deleted file mode 100644 index 646ceb0d..00000000 --- a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0800.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_hnpinstall/SubStartupAppspawnHnpinstall0800.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0800.py b/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0800.py deleted file mode 100644 index b43d38a0..00000000 --- a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0800.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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.model import UiParam, WindowFilter -import os - - -class SubStartupAppspawnHnpinstall0800(TestCase): - - def __init__(self, controllers): - 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() - - def test_step1(self): - Step("步骤1:安装测试应用") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - hnp = os.path.abspath(os.path.join( - os.path.join(path, "testFile"), 'SUB_STARTUP_APPSPAWN_NATIVE/entry-default-hnpinsall.hap')) - isHap = self.driver.has_app("com.example.hnp_test") - if (isHap): - self.driver.uninstall_app("com.example.hnp_test") - else: - pass - self.driver.install_app(hnp) - isroot = self.driver.shell("ls") - if ("Permission denied" in isroot): - Step("步骤2:修改公有目录文件内容") - result1 = self.driver.shell( - f"cp /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/hnp.json /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/zsj.json") - self.driver.Assert.contains(result1, "Permission denied") - Step("步骤3:修改私有目录文件内容") - result2 = self.driver.shell( - f"cp /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/hnp.json /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/zsj.json") - self.driver.Assert.contains(result2, "Permission denied") - else: - Step("步骤2:修改公有目录文件内容") - self.driver.shell( - f"cp /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/hnp.json /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/zsj.json") - result1 = self.driver.shell("ls /data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/") - self.driver.Assert.contains(result1, "zsj.json") - self.driver.Assert.contains(result1, "hnp.json") - Step("步骤3:修改私有目录文件内容") - self.driver.shell( - f"cp /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/hnp.json /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/zsj.json") - result2 = self.driver.shell( - "ls /data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/") - self.driver.Assert.contains(result2, "zsj.json") - self.driver.Assert.contains(result2, "hnp.json") - - def teardown(self): - Step("收尾工作:卸载hap") - self.driver.uninstall_app("com.example.hnp_test") diff --git a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0900.json b/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0900.json deleted file mode 100644 index 6598b823..00000000 --- a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0900.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_hnpinstall/SubStartupAppspawnHnpinstall0900.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0900.py b/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0900.py deleted file mode 100644 index 24bae3ed..00000000 --- a/test/autotest/sub_startup_appspawn_hnpinstall/sub_startup_appspawn_hnpinstall_0900.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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.model import UiParam, WindowFilter -import os -from aw import Common - - -class SubStartupAppspawnHnpinstall0900(TestCase): - - def __init__(self, controllers): - 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() - - def test_step1(self): - Step("步骤1:安装测试应用") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - hnp = os.path.abspath(os.path.join( - os.path.join(path, "testFile"), 'SUB_STARTUP_APPSPAWN_NATIVE/entry-default-hnpinsall.hap')) - isHap = self.driver.has_app("com.example.hnp_test") - if (isHap): - self.driver.uninstall_app("com.example.hnp_test") - else: - pass - self.driver.install_app(hnp) - Step("是否刷root包") - isroot = self.driver.shell("ls") - if ("Permission denied" in isroot): - Step("步骤2:执行公有目录二进制文件") - th = Common.hnpexecute_async(self.driver, "/data/app/el1/bundle/100/hnppublic/bin/hnpsample 5") - th.start() - result3 = self.driver.shell("ps -ef | grep hnpsample | grep -v grep") - self.driver.Assert.contains(result3, "hnpsample") - Step("步骤3:读取私有目录列表") - result2 = self.driver.shell("./data/app/el1/bundle/100/hnp/com.example.hnp_test/node.org/node_1.0/bin/node") - self.driver.Assert.contains(result2, "inaccessible or not found") - else: - Step("步骤2:执行公有目录二进制文件") - result1 = self.driver.shell("./data/app/el1/bundle/100/hnppublic/hnpsample.org/hnpsample_1.1/bin/hnpsample") - self.driver.Assert.contains(result1, "start hnp sample") - self.driver.Assert.contains(result1, "hnp sample end") - - def teardown(self): - Step("收尾工作:卸载hap") - self.driver.uninstall_app("com.example.hnp_test") diff --git a/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0100.json b/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0100.json deleted file mode 100644 index c467494b..00000000 --- a/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0100.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_nativedmscheck/SubStartupAppspawnNativedmscheck0100.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0100.py b/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0100.py deleted file mode 100644 index a3f4c191..00000000 --- a/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0100.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium.model import UiParam, WindowFilter -import os - - -class SubStartupAppspawnNativedmscheck0100(TestCase): - - def __init__(self, controllers): - 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() - - def test_step1(self): - Step("步骤1:创建公有hnp存放目录") - self.driver.shell("mkdir -p data/no_sign/public") - Step("步骤2:导入安装包文件hnp") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - hnp = os.path.abspath(os.path.join( - os.path.join(path, "testFile"), 'SUB_STARTUP_APPSPAWN_NATIVE/no_sign/hnpsample.hnp')) - hap = os.path.abspath( - os.path.join(os.path.join(path, "testFile"), - 'SUB_STARTUP_APPSPAWN_NATIVE/no_sign/entry-default-signedArm64.hap')) - self.driver.push_file(hnp, "data/no_sign/public/") - self.driver.push_file(hap, "data/no_sign") - Step("步骤3:执行安装命令") - result = self.driver.shell( - "hnp install -u 100 -p wechat_sign -i /data/no_sign -s /data/no_sign/entry-default-signedArm64-test11.hap -a arm64 -f") - Step("步骤4:预期结果校验") - self.driver.Assert.contains(result, "hnp uninstall start now! name=hnpsample") - self.driver.Assert.contains(result, "native manager process exit. ret=8393475") - - def teardown(self): - self.driver.shell("rm -rf data/no_sign") diff --git a/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0200.json b/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0200.json deleted file mode 100644 index 676d65fa..00000000 --- a/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0200.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_nativedmscheck/SubStartupAppspawnNativedmscheck0200.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0200.py b/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0200.py deleted file mode 100644 index 6e495429..00000000 --- a/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0200.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium.model import UiParam, WindowFilter -import os - - -class SubStartupAppspawnNativedmscheck0200(TestCase): - - def __init__(self, controllers): - 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() - - def test_step1(self): - Step("步骤1:创建公有hnp存放目录") - self.driver.shell("mkdir -p data/wechat_sign/public") - Step("步骤2:导入安装包文件hnp") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - hnp = os.path.abspath(os.path.join( - os.path.join(path, "testFile"), 'SUB_STARTUP_APPSPAWN_NATIVE/sign/hnpsample.hnp')) - hap = os.path.abspath( - os.path.join(os.path.join(path, "testFile"), - 'SUB_STARTUP_APPSPAWN_NATIVE/sign/entry-default-signedArm64-test11.hap')) - self.driver.push_file(hnp, "data/wechat_sign/public/") - self.driver.push_file(hap, "data/wechat_sign") - Step("步骤3:执行安装命令") - result1 = self.driver.shell( - "hnp install -u 100 -p wechat_sign -i /data/wechat_sign -s /data/wechat_sign/entry-default-signedArm64-test11.hap -a arm64 -f") - Step("步骤4:预期结果校验") - public = self.driver.shell("ls /data/app/el1/bundle/100/hnppublic/") - self.driver.Assert.contains(public, "hnpsample.org") - result = self.driver.shell("cat /data/service/el1/startup/hnp_info.json") - self.driver.Assert.contains(result, "wechat_sign") - self.driver.Assert.contains(result1, "native manager process exit. ret=0") - self.driver.Assert.contains(result1, "hnp install start now! src file=/data/wechat_sign/public/hnpsample.hnp, dst path=/data/app/el1/bundle/100/hnppublic") - - def teardown(self): - self.driver.shell("rm -rf data/sign") - self.driver.shell("hnp uninstall -u 100 -p wechat_sign") diff --git a/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0300.json b/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0300.json deleted file mode 100644 index 7edfe4b8..00000000 --- a/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0300.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_nativedmscheck/SubStartupAppspawnNativedmscheck0300.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0300.py b/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0300.py deleted file mode 100644 index 54d9d5e7..00000000 --- a/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0300.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium.action.os_hypium.device_logger import DeviceLogger -from hypium.model import UiParam, WindowFilter -import os - - -class SubStartupAppspawnNativedmscheck0300(TestCase): - - def __init__(self, controllers): - 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('开启DEBUG日志') - self.driver.shell("hilog -b I -D 0xC02C11") - self.driver.shell("hilog -b DEBUG -T APPSPAWN") - self.driver.shell("hilog -b D -D 0xDC02C11") - self.driver.shell("hilog -G 16M") - host.shell('hdc shell "hilog -r"') - - def test_step1(self): - Step("步骤1:安装私有路径hap包") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - hap1 = os.path.abspath( - os.path.join(os.path.join(path, "testFile"), - 'SUB_STARTUP_APPSPAWN_NATIVE/entry-default-signedArm64Pri-test.hap')) - hap2 = os.path.abspath( - os.path.join(os.path.join(path, "testFile"), - 'SUB_STARTUP_APPSPAWN_NATIVE/entry-default-signed-hnpselinux.hap')) - self.driver.install_app(hap1) - self.driver.install_app(hap2) - Step("步骤2:过滤日志") - device_logger = DeviceLogger(self.driver) - device_logger.set_filter_string("MY_TAG") - Step("步骤3:开始抓取日志") - device_logger.start_log(path + '\\testFile\\log\\%s.log' % (self.TAG)) - Step("步骤4:打开测试应用") - self.driver.start_app("com.example.hnpselinuxtestapplication", "EntryAbility") - time.sleep(60) - Step("步骤4:关闭日志") - device_logger.stop_log() - time.sleep(4) - device_logger.check_log('Open public cfg file to read failed, errno=[2]') - device_logger.check_log('Open public cfg file to write failed, errno=[2]') - device_logger.check_log('Open private cfg file to read failed, errno=[2]') - device_logger.check_log('Open private cfg file to write failed, errno=[2]') - - def teardown(self): - Step("收尾工作:删除hap") - self.driver.uninstall_app("com.example.hnp_test") - self.driver.uninstall_app("com.example.hnpselinuxtestapplication") - self.driver.shell("hilog -b I") diff --git a/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0400.json b/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0400.json deleted file mode 100644 index 1aafb7c2..00000000 --- a/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0400.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_nativedmscheck/SubStartupAppspawnNativedmscheck0400.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0400.py b/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0400.py deleted file mode 100644 index 2cdbd51e..00000000 --- a/test/autotest/sub_startup_appspawn_nativedmscheck/sub_startup_appspawn_nativedmscheck_0400.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium.action.os_hypium.device_logger import DeviceLogger -from hypium.model import UiParam, WindowFilter -import os - - -class SubStartupAppspawnNativedmscheck0400(TestCase): - - def __init__(self, controllers): - 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('开启DEBUG日志') - self.driver.shell("hilog -b I -D 0xC02C11") - self.driver.shell("hilog -b DEBUG -T APPSPAWN") - self.driver.shell("hilog -b D -D 0xDC02C11") - self.driver.shell("hilog -G 16M") - host.shell('hdc shell "hilog -r"') - - def test_step1(self): - Step("步骤1:安装私有路径hap包") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - hap1 = os.path.abspath( - os.path.join(os.path.join(path, "testFile"), - 'SUB_STARTUP_APPSPAWN_NATIVE/entry-default-signedArm64-test.hap')) - hap2 = os.path.abspath( - os.path.join(os.path.join(path, "testFile"), - 'SUB_STARTUP_APPSPAWN_NATIVE/entry-default-signed-hnpselinux.hap')) - self.driver.install_app(hap1) - self.driver.install_app(hap2) - Step("步骤2:过滤日志") - device_logger = DeviceLogger(self.driver) - device_logger.set_filter_string("MY_TAG") - Step("步骤3:开始抓取日志") - device_logger.start_log(path + '\\testFile\\log\\%s.log' % (self.TAG)) - Step("步骤4:打开测试应用") - self.driver.start_app("com.example.hnpselinuxtestapplication", "EntryAbility") - time.sleep(60) - Step("步骤4:关闭日志") - device_logger.stop_log() - time.sleep(4) - Step("识别设备型号...............................") - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - if ("HYM" in device or "HAD" in device): - device_logger.check_log("cfg file content:") - device_logger.check_log("[This is hnp sample config file.].") - device_logger.check_log("cfg file end") - device_logger.check_log('Open public cfg file to write failed, errno=[13]') - else: - device_logger.check_log('Open public cfg file to read failed, errno=[2]') - device_logger.check_log('Open public cfg file to write failed, errno=[2]') - device_logger.check_log('Open private cfg file to read failed, errno=[2]') - device_logger.check_log('Open private cfg file to write failed, errno=[2]') - - def teardown(self): - Step("收尾工作:删除hap") - self.driver.uninstall_app("com.example.hnp_test") - self.driver.uninstall_app("com.example.hnpselinuxtestapplication") - self.driver.shell("hilog -b I") diff --git a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0100.json b/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0100.json deleted file mode 100644 index a8e61cc2..00000000 --- a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0100.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_nativepack/SubStartupAppspawnNativepack0100.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0100.py b/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0100.py deleted file mode 100644 index 60b3688b..00000000 --- a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0100.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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 Step, TestCase -from hypium.model import UiParam, WindowFilter -import os -import time - - -class SubStartupAppspawnNativepack0100(TestCase): - - def __init__(self, controllers): - 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('预置工作:新增一个123.txt文件') - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - file = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/sample')) - with open(file + "\\lib\\123.txt", "a+") as f1: - f1.write("12345678hdaskheiwoi4eliqwkldsajoejqooiudsisa") - - def test_step1(self): - Step("获取bat文件路径") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - bat = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/run.bat')) - Step("执行bat文件") - host.shell(bat) - Step("复制压缩文件") - out = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/out/')) - sample = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/sample/')) - file1 = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/out/hnpsample.hnp')) - file2 = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/out/hnpsample.zip')) - host.shell("copy "+file1 + " " + file2) - Step("步骤7:解压hnpsample.zip文件") - host.unzip_file(file2, out) - Step("步骤8:比较2个文件内容是否一致") - time.sleep(1) - dif1 = f.read() - with open(out+"\\sample\\cfg\\hnpsample.cfg") as f: - dif2 = f.read() - self.driver.Assert.equal(dif1, dif2) - dif1 = f.read() - dif2 = f.read() - self.driver.Assert.equal(dif1, dif2) - with open(sample + "\\lib\\123.txt") as f: - dif1 = f.read() - with open(out + "\\sample\\lib\\123.txt") as f: - dif2 = f.read() - self.driver.Assert.equal(dif1, dif2) - - def teardown(self): - Step("收尾工作:删除out目录文件") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - out = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/out/')) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0200.json b/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0200.json deleted file mode 100644 index f42ce0d5..00000000 --- a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0200.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_nativepack/SubStartupAppspawnNativepack0200.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0200.py b/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0200.py deleted file mode 100644 index 1a38d824..00000000 --- a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0200.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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 Step, TestCase -from hypium.model import UiParam, WindowFilter -import os -import time - - -class SubStartupAppspawnNativepack0200(TestCase): - - def __init__(self, controllers): - 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() - - def test_step1(self): - Step("获取bat文件路径") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - bat = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/run.bat')) - Step("执行bat文件") - host.shell(bat) - Step("复制压缩文件") - out = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/out/')) - sample = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/sample/')) - file1 = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/out/hnpsample.hnp')) - file2 = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/out/hnpsample.zip')) - host.shell("copy "+file1 + " " + file2) - Step("步骤7:解压hnpsample.zip文件") - host.unzip_file(file2, out) - Step("步骤8:比较2个文件内容是否一致") - time.sleep(1) - dif1 = f.read() - with open(out+"\\sample\\cfg\\hnpsample.cfg") as f: - dif2 = f.read() - self.driver.Assert.equal(dif1, dif2) - dif1 = f.read() - dif2 = f.read() - self.driver.Assert.equal(dif1, dif2) - - def teardown(self): - Step("收尾工作:删除out目录文件") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - out = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/out/')) \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0300.json b/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0300.json deleted file mode 100644 index 376a9a5f..00000000 --- a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0300.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_nativepack/SubStartupAppspawnNativepack0300.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0300.py b/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0300.py deleted file mode 100644 index 9a1631cc..00000000 --- a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0300.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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 Step, TestCase -from hypium.model import UiParam, WindowFilter -import os -import time - - -class SubStartupAppspawnNativepack0300(TestCase): - - def __init__(self, controllers): - 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('预置工作:修改打包的文件') - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - file = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/sample')) - with open(file+"\\cfg\\hnpsample.cfg", "a") as f1: - f1.write("weuhriqj82hs9九jisapojhwkeioqw8321093nskjdlajejnphoneklv") - time.sleep(2) - - def test_step1(self): - Step("获取bat文件路径") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - bat = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/run.bat')) - Step("执行bat文件") - host.shell(bat) - Step("复制压缩文件") - out = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/out/')) - sample = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/sample/')) - file1 = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/out/hnpsample.hnp')) - file2 = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/out/hnpsample.zip')) - host.shell("copy "+file1 + " " + file2) - Step("步骤7:解压hnpsample.zip文件") - host.unzip_file(file2, out) - Step("步骤8:比较2个文件内容是否一致") - time.sleep(1) - dif1 = f.read() - with open(out+"\\sample\\cfg\\hnpsample.cfg") as f: - dif2 = f.read() - self.driver.Assert.equal(dif1, dif2) - dif1 = f.read() - dif2 = f.read() - self.driver.Assert.equal(dif1, dif2) - - def teardown(self): - Step("收尾工作:删除out目录文件") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - out = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/window/out/')) - file = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/sample')) - with open(file + "\\cfg\\hnpsample.cfg", "w") as f1: - f1.write("This is hnp sample config file.") \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0400.json b/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0400.json deleted file mode 100644 index b615cf06..00000000 --- a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0400.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_nativepack/SubStartupAppspawnNativepack0400.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0400.py b/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0400.py deleted file mode 100644 index ed43fa77..00000000 --- a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0400.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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 Step, TestCase -from hypium.model import UiParam, WindowFilter -import os -import time - - -class SubStartupAppspawnNativepack0400(TestCase): - - def __init__(self, controllers): - 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() - - def test_step1(self): - Step("步骤1:添加读写权限") - self.driver.hdc("target mount") - Step("步骤2:导入打包所需的文件到设备data/usr目录") - self.driver.shell("mkdir data/usr") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - file1 = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/hnpcli')) - file2 = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/sample')) - self.driver.hdc("hdc file send " + file1 + " /data") - self.driver.hdc("hdc file send " + file2 + " /data/usr") - Step("步骤3:添加权限") - self.driver.shell("chmod +x /data/hnpcli") - Step("步骤4:执行打包命令") - self.driver.shell("data/hnpcli pack -i /data/usr/sample -o /data ") - Step("步骤5:复制hnp文件为zip文件") - self.driver.shell("cp /data/hnpsample.hnp /data/hnpsample.zip") - Step("步骤6:导出生成的zip包到本地") - out = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/out/')) - self.driver.hdc("hdc file recv /data/hnpsample.zip "+out) - Step("步骤7:解压hnpsample.zip文件") - Step("步骤8:比较2个文件内容是否一致") - time.sleep(1) - with open(file2+"\\cfg\\hnpsample.cfg") as f: - dif1 = f.read() - with open(out+"\\sample\\cfg\\hnpsample.cfg") as f: - dif2 = f.read() - self.driver.Assert.equal(dif1, dif2) - dif1 = f.read() - dif2 = f.read() - self.driver.Assert.equal(dif1, dif2) - - def teardown(self): - Step("收尾工作:删除out目录文件") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - out = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/out/')) - self.driver.shell("rm -rf /data/hnpsample.zip") - self.driver.shell("rm -rf /data/hnpsample.hnp") \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0500.json b/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0500.json deleted file mode 100644 index ecdac029..00000000 --- a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0500.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_nativepack/SubStartupAppspawnNativepack0500.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0500.py b/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0500.py deleted file mode 100644 index a50cf5e1..00000000 --- a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0500.py +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time - -from devicetest.core.test_case import Step, TestCase -from hypium.model import UiParam, WindowFilter -import os - - -class SubStartupAppspawnNativepack0500(TestCase): - - def __init__(self, controllers): - 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('预置工作:修改打包的文件') - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - file = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/sample')) - with open(file+"\\cfg\\hnpsample.cfg", "a") as f1: - f1.write("weuhriqj82hs9九jisapojhwkeioqw8321093nskjdlajejnphoneklv") - time.sleep(2) - - def test_step1(self): - Step("步骤1:添加读写权限") - self.driver.hdc("target mount") - Step("步骤2:导入打包所需的文件到设备data/usr目录") - self.driver.shell("mkdir data/usr") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - file1 = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/hnpcli')) - file2 = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/sample')) - self.driver.hdc("hdc file send " + file1 + " /data") - self.driver.hdc("hdc file send " + file2 + " /data/usr") - Step("步骤3:添加权限") - self.driver.shell("chmod +x /data/hnpcli") - Step("步骤4:执行打包命令") - self.driver.shell("data/hnpcli pack -i /data/usr/sample -o /data ") - Step("步骤5:复制hnp文件为zip文件") - self.driver.shell("cp /data/hnpsample.hnp /data/hnpsample.zip") - Step("步骤6:导出生成的zip包到本地") - out = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/out/')) - self.driver.hdc("hdc file recv /data/hnpsample.zip " + out) - Step("步骤7:解压hnpsample.zip文件") - host.unzip_file(out + "\\hnpsample.zip", out) - Step("步骤8:比较2个文件内容是否一致") - time.sleep(1) - dif1 = f.read() - dif2 = f.read() - self.driver.Assert.equal(dif1, dif2) - dif1 = f.read() - dif2 = f.read() - self.driver.Assert.equal(dif1, dif2) - - def teardown(self): - Step("收尾工作:删除&修改相关文件") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - out = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/out/')) - self.driver.shell("rm -rf /data/hnpsample.zip") - self.driver.shell("rm -rf /data/hnpsample.hnp") - file = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/sample')) - with open(file + "\\cfg\\hnpsample.cfg", "w") as f1: - f1.write("This is hnp sample config file.") - - diff --git a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0600.json b/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0600.json deleted file mode 100644 index 434e339a..00000000 --- a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0600.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_nativepack/SubStartupAppspawnNativepack0600.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0600.py b/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0600.py deleted file mode 100644 index 49a7f75c..00000000 --- a/test/autotest/sub_startup_appspawn_nativepack/sub_startup_appspawn_nativepack_0600.py +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time - -from devicetest.core.test_case import Step, TestCase -from hypium.model import UiParam, WindowFilter -import os - - -class SubStartupAppspawnNativepack0600(TestCase): - - def __init__(self, controllers): - 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('预置工作:新增一个123.txt文件') - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - file = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/sample')) - f1.write("12345678hdaskheiwoi4eliqwkldsajoejqooiudsisa") - - def test_step1(self): - Step("步骤1:添加读写权限") - self.driver.hdc("target mount") - Step("步骤2:导入打包所需的文件到设备data/usr目录") - self.driver.shell("mkdir data/usr") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - file1 = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/hnpcli')) - file2 = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/sample')) - self.driver.hdc("hdc file send " + file1 + " /data") - self.driver.hdc("hdc file send " + file2 + " /data/usr") - Step("步骤3:添加权限") - self.driver.shell("chmod +x /data/hnpcli") - Step("步骤4:执行打包命令") - self.driver.shell("data/hnpcli pack -i /data/usr/sample -o /data ") - Step("步骤5:复制hnp文件为zip文件") - self.driver.shell("cp /data/hnpsample.hnp /data/hnpsample.zip") - Step("步骤6:导出生成的zip包到本地") - out = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/out/')) - self.driver.hdc("hdc file recv /data/hnpsample.zip " + out) - Step("步骤7:解压hnpsample.zip文件") - host.unzip_file(out + "\\hnpsample.zip", out) - Step("步骤8:比较2个文件内容是否一致") - time.sleep(1) - dif1 = f.read() - dif2 = f.read() - self.driver.Assert.equal(dif1, dif2) - dif1 = f.read() - dif2 = f.read() - self.driver.Assert.equal(dif1, dif2) - dif1 = f.read() - with open(out + "\\sample\\lib\\123.txt") as f: - dif2 = f.read() - self.driver.Assert.equal(dif1, dif2) - - def teardown(self): - Step("收尾工作:删除相关文件") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - out = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/out/')) - file = os.path.abspath(os.path.join(os.path.join(path, "testFile"), 'sub_startup_appspawn_nativepack/sample')) - self.driver.shell("rm -rf /data/hnpsample.zip") - self.driver.shell("rm -rf /data/hnpsample.hnp") diff --git a/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess.json b/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess.json deleted file mode 100644 index 8c1a9c37..00000000 --- a/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "description": "Config for OpenHarmony app test suites", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTestSuite", - "testsuite": "sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess.py", - "suitecases": [ - "sub_startup_appspawn_nativeprocess/SubStartupAppspawnNativeprocess0100.py", - "sub_startup_appspawn_nativeprocess/SubStartupAppspawnNativeprocess0200.py", - "sub_startup_appspawn_nativeprocess/SubStartupAppspawnNativeprocess0300.py", - "sub_startup_appspawn_nativeprocess/SubStartupAppspawnNativeprocess0400.py", - "sub_startup_appspawn_nativeprocess/SubStartupAppspawnNativeprocess0500.py", - "sub_startup_appspawn_nativeprocess/SubStartupAppspawnNativeprocess0600.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess.py b/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess.py deleted file mode 100644 index 3ef49829..00000000 --- a/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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 time import sleep -from devicetest.core.test_case import Step -from devicetest.core.suite.test_suite import TestSuite -from aw import Common - - -class SubStartupAppspawnNativeprocess(TestSuite): - - def setup(self): - Step("TestCase: setup") - self.driver = UiDriver(self.device1) - Step("预置工作:初始化手机开始.................") - Step(self.devices[0].device_id) - Step("导入配置文件.................") - self.driver.hdc("target mount") - sourpath = Common.sourcepath("AppSpawnTest", "sub_startup_appspawn_nativeprocess") - destpath = "/data/AppSpawnTest" - self.driver.push_file(sourpath, destpath) - sleep(3) - Step("给测试文件AppSpawnTest可执行权限.................") - self.driver.shell('chmod +x /data/AppSpawnTest') - self.driver.shell('./data/AppSpawnTest') - - def teardown(self): - Step("收尾工作,删除文件.................") - self.driver.shell("rm /data/AppSpawnTest") diff --git a/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0100.py b/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0100.py deleted file mode 100644 index 26b96df1..00000000 --- a/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0100.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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 Step, TestCase - - -class SubStartupAppspawnNativeprocess0100(TestCase): - - def __init__(self, controllers): - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.TAG, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("TestCase: setup") - Step("预置工作:初始化手机开始.................") - Step(self.devices[0].device_id) - - def test_step1(self): - Step("执行AppSpawnTest'.................") - result = self.driver.shell('./data/AppSpawnTest') - self.driver.Assert.contains(result, "Failed spawn new app result", "默认启动孵化APPSPAWN失败") - - def teardown(self): - Step("TestCase: teardown") diff --git a/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0200.py b/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0200.py deleted file mode 100644 index 27866f8d..00000000 --- a/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0200.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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 Step, TestCase - - -class SubStartupAppspawnNativeprocess0200(TestCase): - - def __init__(self, controllers): - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.TAG, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("TestCase: setup") - Step("预置工作:初始化手机开始.................") - Step(self.devices[0].device_id) - - def test_step1(self): - Step("执行AppSpawnTest'.................") - result = self.driver.shell('./data/AppSpawnTest -s -b moduleTestProcessName') - self.driver.Assert.contains(result, "Failed spawn new app result", "带沙盒启动孵化APPSPAWN失败") - Step("执行AppSpawnTest'.................") - failresult = self.driver.shell('./data/AppSpawnTest -s') - self.driver.Assert.contains(failresult, "Failed spawn new app result -1", "模拟'带沙盒启动孵化APPSPAWN失败'失败") - - def teardown(self): - Step("TestCase: teardown") diff --git a/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0400.py b/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0400.py deleted file mode 100644 index c16add36..00000000 --- a/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0400.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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 Step, TestCase - - -class SubStartupAppspawnNativeprocess0400(TestCase): - - def __init__(self, controllers): - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.TAG, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("TestCase: setup") - Step("预置工作:初始化手机开始.................") - Step(self.devices[0].device_id) - - def test_step1(self): - Step("执行AppSpawnTest'.................") - result = self.driver.shell('./data/AppSpawnTest -b ohos.xxxxxx.xxxxxxxx') - self.driver.Assert.contains(result, "Failed spawn new app result", "模拟新app启动孵化APPSPAWN失败") - - def teardown(self): - Step("TestCase: teardown") diff --git a/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0500.py b/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0500.py deleted file mode 100644 index f10dd2c7..00000000 --- a/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0500.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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 Step, TestCase - - -class SubStartupAppspawnNativeprocess0500(TestCase): - - def __init__(self, controllers): - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.TAG, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("TestCase: setup") - Step("预置工作:初始化手机开始.................") - Step(self.devices[0].device_id) - - def test_step1(self): - Step("执行AppSpawnTest'.................") - result = self.driver.shell('./data/AppSpawnTest -b ohos.xxxxxx.xxxxxxxx -s') - self.driver.Assert.contains(result, "Failed spawn new app result -1", "指定不存在app启动孵化APPSPAWN失败") - - def teardown(self): - Step("TestCase: teardown") diff --git a/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0600.py b/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0600.py deleted file mode 100644 index dc1c2248..00000000 --- a/test/autotest/sub_startup_appspawn_nativeprocess/sub_startup_appspawn_nativeprocess_0600.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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 Step, TestCase - - -class SubStartupAppspawnNativeprocess0600(TestCase): - - def __init__(self, controllers): - self.tests = [ - "test_step1" - ] - TestCase.__init__(self, self.TAG, controllers) - self.driver = UiDriver(self.device1) - - def setup(self): - Step("TestCase: setup") - Step("预置工作:初始化手机开始.................") - Step(self.devices[0].device_id) - - def test_step1(self): - Step("执行AppSpawnTest'.................") - result = self.driver.shell('./data/AppSpawnTest -b ohos.xxxxxx.xxxxxxxx -s') - self.driver.Assert.contains(result, "Failed spawn new app result -1", "指定不存在app启动孵化APPSPAWN失败") - Step("执行AppSpawnTest'.................") - successresult = self.driver.shell('./data/AppSpawnTest -C') - self.driver.Assert.contains(result, "Failed spawn new app result", "模拟指定不存在的app启动孵化APPSPAWN失败后,重新启动测试失败") - - def teardown(self): - Step("TestCase: teardown") diff --git a/test/autotest/sub_startup_appspawn_nativesandbox/sub_startup_appspawn_nativesandbox_0100.json b/test/autotest/sub_startup_appspawn_nativesandbox/sub_startup_appspawn_nativesandbox_0100.json deleted file mode 100644 index 9f5581fd..00000000 --- a/test/autotest/sub_startup_appspawn_nativesandbox/sub_startup_appspawn_nativesandbox_0100.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_nativesandbox/SubStartupAppspawnNativesandbox0100.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_nativesandbox/sub_startup_appspawn_nativesandbox_0100.py b/test/autotest/sub_startup_appspawn_nativesandbox/sub_startup_appspawn_nativesandbox_0100.py deleted file mode 100644 index 982ae508..00000000 --- a/test/autotest/sub_startup_appspawn_nativesandbox/sub_startup_appspawn_nativesandbox_0100.py +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import Step, TestCase -from hypium.model import UiParam, WindowFilter -import os - - -class SubStartupAppspawnNativesandbox0100(TestCase): - - def __init__(self, controllers): - 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.shell("power-shell timeout -o 2147483647") - - def test_step1(self): - Step("步骤1:创建公有hnp存放目录") - self.driver.shell("mkdir -p data/UCbrowser/public") - Step("步骤2:导入安装包文件hnp") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - hnp = os.path.abspath(os.path.join( - os.path.join(path, "testFile"), 'SUB_STARTUP_APPSPAWN_NATIVE/sign/hnpsample.hnp')) - hap = os.path.abspath( - os.path.join(os.path.join(path, "testFile"), 'SUB_STARTUP_APPSPAWN_NATIVE/sign/entry-default-signedArm64-test11.hap')) - self.driver.push_file(hnp, "data/UCbrowser/public/") - self.driver.push_file(hap, "data/UCbrowser") - Step("步骤3:执行安装命令") - self.driver.shell( - "hnp install -u 100 -p uc_browser -i data/UCbrowser -s data/UCbrowser/entry-default-signedArm64-test11.hap -a arm64 -f") - Step("步骤4:查看是是否安装成功") - public = self.driver.shell("ls /data/app/el1/bundle/100/hnppublic/") - self.driver.Assert.contains(public, "hnpsample.org") - result = self.driver.shell("cat /data/service/el1/startup/hnp_info.json") - self.driver.Assert.contains(result, "uc_browser") - Step("步骤5:安装测试hap包") - ishap = self.driver.has_app("com.example.hnptestapplication") - if (ishap): - hap1 = os.path.abspath( - os.path.join(os.path.join(path, "testFile"), - 'SUB_STARTUP_APPSPAWN_NATIVE/entry-default-sandbox.hap')) - self.driver.install_app(hap1) - Step("步骤6:打开测试hap包") - self.driver.shell("aa start -a EntryAbility -b com.example.hnptestapplication") - Step("步骤7:获取测试应用pid") - time.sleep(3) - pid = self.driver.System.get_pid("com.example.hnptestapplication") - Step("步骤8:查看测试应用公有沙箱路径") - result = self.driver.shell("ls /proc/%d/root/data/service/hnp" % pid) - Step("步骤9:预期结果校验") - Step("识别设备型号...............................") - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - if ("HYM" in device or "HAD" in device): - self.driver.Assert.contains(result, "bin") - self.driver.Assert.contains(result, "hnpsample.org") - else: - self.driver.Assert.contains(result, "No such file or directory") - diff --git a/test/autotest/sub_startup_appspawn_nativesandbox/sub_startup_appspawn_nativesandbox_0200.json b/test/autotest/sub_startup_appspawn_nativesandbox/sub_startup_appspawn_nativesandbox_0200.json deleted file mode 100644 index 700785e5..00000000 --- a/test/autotest/sub_startup_appspawn_nativesandbox/sub_startup_appspawn_nativesandbox_0200.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_nativesandbox/SubStartupAppspawnNativesandbox0200.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_nativesandbox/sub_startup_appspawn_nativesandbox_0200.py b/test/autotest/sub_startup_appspawn_nativesandbox/sub_startup_appspawn_nativesandbox_0200.py deleted file mode 100644 index d26ab39d..00000000 --- a/test/autotest/sub_startup_appspawn_nativesandbox/sub_startup_appspawn_nativesandbox_0200.py +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import time -from devicetest.core.test_case import Step, TestCase -from hypium.model import UiParam, WindowFilter -import os - - -class SubStartupAppspawnNativesandbox0200(TestCase): - - def __init__(self, controllers): - 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.shell("power-shell timeout -o 2147483647") - - def test_step1(self): - Step("步骤1:创建公有hnp存放目录") - self.driver.shell("mkdir -p data/com.example.hnptestapplication/private") - Step("步骤2:导入安装包文件hnp") - path = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - hnp = os.path.abspath(os.path.join( - os.path.join(path, "testFile"), 'SUB_STARTUP_APPSPAWN_NATIVE/sign/hnpsample.hnp')) - hap = os.path.abspath( - os.path.join(os.path.join(path, "testFile"), 'SUB_STARTUP_APPSPAWN_NATIVE/sign/entry-default-signedArm64-test11.hap')) - self.driver.push_file(hnp, "data/com.example.hnptestapplication/private/") - self.driver.push_file(hap, "data/com.example.hnptestapplication") - Step("步骤3:执行安装命令") - self.driver.shell( - "hnp install -u 100 -p com.example.hnptestapplication -i data/com.example.hnptestapplication -s data/com.example.hnptestapplication/entry-default-signedArm64-test11.hap -a arm64 -f") - Step("步骤4:查看是是否安装成功") - public = self.driver.shell("ls /data/app/el1/bundle/100/hnp/com.example.hnptestapplication") - self.driver.Assert.contains(public, "hnpsample.org") - Step("步骤5:安装测试hap包") - ishap = self.driver.has_app("com.example.hnptestapplication") - if (ishap): - hap1 = os.path.abspath( - os.path.join(os.path.join(path, "testFile"), - 'SUB_STARTUP_APPSPAWN_NATIVE/entry-default-sandbox.hap')) - self.driver.install_app(hap1) - Step("步骤6:打开测试hap包") - self.driver.shell("aa start -a EntryAbility -b com.example.hnptestapplication") - Step("步骤7:获取测试应用pid") - time.sleep(1) - pid = self.driver.System.get_pid("com.example.hnptestapplication") - Step("步骤8:查看测试应用公有沙箱路径") - result = self.driver.shell("ls /proc/%d/root/data/app" % pid) - Step("步骤9:预期结果校验") - Step("识别设备型号...............................") - device = self.driver.shell("param get const.product.model") - device = device.replace("\n", "").replace(" ", "") - device = str(device) - if ("HYM" in device or "HAD" in device): - self.driver.Assert.contains(result, "bin") - self.driver.Assert.contains(result, "hnpsample.org") - else: - self.driver.Assert.contains(result, "No such file or directory") - - def teardown(self): - self.driver.shell("hnp uninstall -u 100 -p com.example.hnptestapplication") diff --git a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0100.py b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0100.py index fea78abc..e9ebe366 100644 --- a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0100.py +++ b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0100.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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 diff --git a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0200.py b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0200.py index 94df5ef8..64f2ba3c 100644 --- a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0200.py +++ b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0200.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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 diff --git a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0300.py b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0300.py index 0cbc0e3e..32195b39 100644 --- a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0300.py +++ b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0300.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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 diff --git a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0400.py b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0400.py index 05c07a60..5f0c5173 100644 --- a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0400.py +++ b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0400.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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 diff --git a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0500.py b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0500.py index 3bcaac1e..3f9a7bfc 100644 --- a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0500.py +++ b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0500.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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 diff --git a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0700.py b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0700.py index 387c4c3d..5486dd66 100644 --- a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0700.py +++ b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0700.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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 diff --git a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0900.py b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0900.py index 427097fc..af214e54 100644 --- a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0900.py +++ b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_0900.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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 diff --git a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1000.py b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1000.py index 9e0a418d..93161e24 100644 --- a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1000.py +++ b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1000.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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 diff --git a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1100.py b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1100.py index 879a0149..e31c6663 100644 --- a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1100.py +++ b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1100.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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 diff --git a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1200.py b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1200.py index 8773b0bc..53100365 100644 --- a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1200.py +++ b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1200.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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 diff --git a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1300.py b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1300.py index 0c65799e..ffb58b3e 100644 --- a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1300.py +++ b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1300.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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 diff --git a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1400.py b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1400.py index 00a0c4f2..5d72bc5b 100644 --- a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1400.py +++ b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1400.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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 diff --git a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1500.py b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1500.py index 606387c2..63c6344d 100644 --- a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1500.py +++ b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1500.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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 diff --git a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1600.py b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1600.py index 3223b60a..4c20f740 100644 --- a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1600.py +++ b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1600.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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 diff --git a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1700.py b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1700.py index 8c88da56..474485a7 100644 --- a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1700.py +++ b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1700.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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 diff --git a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1800.py b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1800.py index 14145410..a99c2ab6 100644 --- a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1800.py +++ b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1800.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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 diff --git a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1900.py b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1900.py index e6670b74..3ea853e4 100644 --- a/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1900.py +++ b/test/autotest/sub_startup_appspawn_nativespawn/sub_startup_appspawn_nativespawn_1900.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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 diff --git a/test/autotest/sub_startup_appspawn_supplementary/sub_startup_appspawn_supplementary_0100.json b/test/autotest/sub_startup_appspawn_supplementary/sub_startup_appspawn_supplementary_0100.json deleted file mode 100644 index 9a4957d4..00000000 --- a/test/autotest/sub_startup_appspawn_supplementary/sub_startup_appspawn_supplementary_0100.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_supplementary/Substartupappspawnsupplementary0100.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_supplementary/sub_startup_appspawn_supplementary_0100.py b/test/autotest/sub_startup_appspawn_supplementary/sub_startup_appspawn_supplementary_0100.py deleted file mode 100644 index fc2cad96..00000000 --- a/test/autotest/sub_startup_appspawn_supplementary/sub_startup_appspawn_supplementary_0100.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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 time import sleep -from devicetest.core.test_case import Step, TestCase -from hyp import HypiumClass1, HypiumClass2, HypiumFunction1 - -from aw import Common - - -class Substartupappspawnsupplementary0100(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("TestCase: setup") - Step("预置工作:初始化手机开始.................") - Step(self.devices[0].device_id) - Step("安装测试hap.................") - sourpath = Common.sourcepath("asan.hap", "SUB_STARTUP_APPSPAWN_SUPPLEMENTARY") - Step(sourpath) - self.driver.AppManager.install_app(sourpath) - Step("预置工作:检测屏幕是否亮.................") - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def test_step1(self): - Step("打开测试hap.................") - self.driver.start_app("com.example.myapplication", "EntryAbility") - sleep(3) - Step("校验hap显示Hello World.................") - if not self.driver.find_component(BY.text("Hello World")): - throw std::runtime_error("Failed to find component with text 'Hello'") - - - def teardown(self): - Step("收尾工作.................") - Step("收尾工作:卸载hap......................") - self.driver.AppManager.clear_app_data('com.example.myapplication') - self.driver.AppManager.uninstall_app('com.example.myapplication') \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_supplementary/sub_startup_appspawn_supplementary_0200.json b/test/autotest/sub_startup_appspawn_supplementary/sub_startup_appspawn_supplementary_0200.json deleted file mode 100644 index d17ba198..00000000 --- a/test/autotest/sub_startup_appspawn_supplementary/sub_startup_appspawn_supplementary_0200.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "sub_startup_appspawn_supplementary/Substartupappspawnsupplementary0200.py" - ] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_supplementary/sub_startup_appspawn_supplementary_0200.py b/test/autotest/sub_startup_appspawn_supplementary/sub_startup_appspawn_supplementary_0200.py deleted file mode 100644 index 4b5ec061..00000000 --- a/test/autotest/sub_startup_appspawn_supplementary/sub_startup_appspawn_supplementary_0200.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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 time import sleep -from devicetest.core.test_case import Step, TestCase -from hypium importFunction1, SpecificFunction2 - -from aw import Common - - -class Substartupappspawnsupplementary0200(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("TestCase: setup") - Step("预置工作:初始化手机开始.................") - Step(self.devices[0].device_id) - Step("安装测试hap.................") - sourpath = Common.sourcepath("sn.hap", "SUB_STARTUP_APPSPAWN_SUPPLEMENTARY") - Step(sourpath) - self.driver.AppManager.install_app(sourpath) - Step("预置工作:检测屏幕是否亮.................") - self.driver.Screen.wake_up() - self.driver.ScreenLock.unlock() - self.driver.Screen.enable_stay_awake() - - def test_step1(self): - Step("打开测试hap.................") - self.driver.start_app("com.example.myapplication", "EntryAbility") - sleep(3) - Step("检查存在device info.................") - assert self.driver.find_component(BY.text("3333333", MatchPattern.CONTAINS)) - print("点击菜单device info.................") - self.driver.touch(BY.text(" device info ")) - sleep(1) - Step("校验serial为空.................") - if not self.driver.find_component(BY.text("serial: " + "\n" + " deviceType", MatchPattern.CONTAINS)) - - def teardown(self): - Step("收尾工作.................") - Step("收尾工作:卸载hap......................") - self.driver.AppManager.clear_app_data('com.example.myapplication') - self.driver.AppManager.uninstall_app('com.example.myapplication') \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0100.json b/test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0100.json deleted file mode 100644 index 53f12fe9..00000000 --- a/test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0100.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_ubsanvariable/Substartupappspawnubsanvariable0100.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0100.py b/test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0100.py deleted file mode 100644 index f8876929..00000000 --- a/test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0100.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import os - -from devicetest.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import HypiumClass, HypiumFunction -from hypium.action.os_hypium.device_logger import DeviceLogger -from hypium.model import UiParam, WindowFilter -import time - - -class Substartupappspawnubsanvariable0100(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('开启DEBUG日志') - self.driver.shell("hilog -b D -D 0xC02C11") - self.driver.shell("hilog -b DEBUG -T APPSPAWN") - self.driver.shell("hilog -b D -D 0xDC02C11") - self.driver.shell("hilog -G 16M") - - def test_step1(self): - Step("步骤1:过滤关键日志") - device_logger = DeviceLogger(self.driver) - device_logger.set_filter_string("SetAsanEnabledEnv") - Step("步骤2:安装测试hap") - path = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) - hap = os.path.abspath(os.path.join(os.path.join(path, "testFile"), - "SUB_STARTUP_APPSPAWN_UBSANVARIABLE/ActsStartEnabledTrueProcessTest.hap")) - ishap = self.driver.has_app("com.example.actsstartenabledtrueprocesstest") - if(ishap): - self.driver.uninstall_app("com.example.actsstartenabledtrueprocesstest") - else: - pass - self.driver.install_app(hap) - Step("步骤3:开始抓取日志") - device_logger.start_log(path + '\\testFile\\log\\%s.log' % (self.TAG)) - Step("步骤4:启动测试应用") - self.driver.shell("aa start -a EntryAbility -b com.example.actsstartenabledtrueprocesstest") - time.sleep(8) - Step("步骤4:关闭日志") - device_logger.stop_log() - device_logger.check_log('SetAsanEnabledEnv 22,(null),(null),(null)') - device_logger.check_log('print_stacktrace=1:print_module_map=2:log_exe_name=1,(null)') - - def teardown(self): - Step("收尾工作:删除测试应用") - self.driver.uninstall_app("com.example.actsstartenabledtrueprocesstest") - self.driver.shell("hilog -b I") diff --git a/test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0200.json b/test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0200.json deleted file mode 100644 index 29b796cf..00000000 --- a/test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0200.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_ubsanvariable/Substartupappspawnubsanvariable0200.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0200.py b/test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0200.py deleted file mode 100644 index 83070fb5..00000000 --- a/test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0200.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import os - -from devicetest.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hyp import HypiumClass1, HypiumClass2, HypiumFunction1 -from hypium.action.os_hypium.device_logger import DeviceLogger -from hypium.model import UiParam, WindowFilter -import time - - -class Substartupappspawnubsanvariable0200(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('开启DEBUG日志') - self.driver.shell("hilog -b D") - self.driver.shell("hilog -G 16M") - - def test_step1(self): - Step("步骤1:过滤关键日志") - device_logger = DeviceLogger(self.driver) - device_logger.set_filter_string("SetAsanEnabledEnv") - Step("步骤2:安装测试hap") - path = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) - hap = os.path.abspath(os.path.join(os.path.join(path, "testFile"), - "SUB_STARTUP_APPSPAWN_UBSANVARIABLE/ActsStartEnabledFalseProcessTest.hap")) - ishap = self.driver.has_app("com.example.actsstartenabledtrueprocesstest") - if (ishap): - self.driver.uninstall_app("com.example.actsstartenabledfalseprocesstest") - else: - pass - self.driver.install_app(hap) - Step("步骤3:开始抓取日志") - device_logger.start_log(path + '\\testFile\\log\\%s.log' % (self.TAG)) - Step("步骤4:启动测试应用") - self.driver.shell("aa start -a EntryAbility -b com.example.actsstartenabledfalseprocesstest") - time.sleep(8) - Step("步骤4:关闭日志") - device_logger.stop_log() - time.sleep(2) - device_logger.check_not_exist_keyword('SetAsanEnabledEnv 22') - - def teardown(self): - Step("收尾工作:删除测试应用") - self.driver.uninstall_app("com.example.actsstartenabledfalseprocesstest") - self.driver.shell("hilog -b I") diff --git a/test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0300.json b/test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0300.json deleted file mode 100644 index e72103b0..00000000 --- a/test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0300.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "description": "Config for OpenHarmony devicetest test cases", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": ["sub_startup_appspawn_ubsanvariable/Substartupappspawnubsanvariable0300.py"] - } -} \ No newline at end of file diff --git a/test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0300.py b/test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0300.py deleted file mode 100644 index 591f529c..00000000 --- a/test/autotest/sub_startup_appspawn_ubsanvariable/sub_startup_appspawn_ubsanvariable_0300.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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. - -import os - -from devicetest.core.test_case import TestCase, Step, CheckPoint -from devicetest.core.test_case import Step, TestCase -from hypium import HypiumClass, HypiumFunction -from hypium.action.os_hypium.device_logger import DeviceLogger -from hypium.model import UiParam, WindowFilter -import time - - -class Substartupappspawnubsanvariable0300(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('开启DEBUG日志') - self.driver.shell("hilog -b D") - self.driver.shell("hilog -G 16M") - - def test_step1(self): - Step("步骤1:过滤关键日志") - device_logger = DeviceLogger(self.driver) - device_logger.set_filter_string("SetAsanEnabledEnv") - Step("步骤2:安装测试hap") - path = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) - hap = os.path.abspath(os.path.join(os.path.join(path, "testFile"), - "SUB_STARTUP_APPSPAWN_UBSANVARIABLE/ActsStartNoConfigEnabledProcessTest.hap")) - ishap = self.driver.has_app("com.example.actsstartenabledtrueprocesstest") - if (ishap): - self.driver.uninstall_app("com.example.actsstartnoconfigenabledprocesstest") - else: - pass - self.driver.install_app(hap) - Step("步骤3:开始抓取日志") - device_logger.start_log(path + '\\testFile\\log\\%s.log' % (self.TAG)) - Step("步骤4:启动测试应用") - self.driver.shell("aa start -a EntryAbility -b com.example.actsstartnoconfigenabledprocesstest") - time.sleep(8) - Step("步骤4:关闭日志") - device_logger.stop_log() - time.sleep(2) - device_logger.check_not_exist_keyword('SetAsanEnabledEnv 22') - - def teardown(self): - Step("收尾工作:删除测试应用") - self.driver.uninstall_app("com.example.actsstartnoconfigenabledprocesstest") - self.driver.shell("hilog -b I") -- Gitee