diff --git a/frameworks/native/source/system_ability_manager_proxy.cpp b/frameworks/native/source/system_ability_manager_proxy.cpp index 622691679ab0e859003a8b0d8cbdad2de751a1cb..3a7186e54b9068ee30cb6ce3e18cdb4de5be851b 100644 --- a/frameworks/native/source/system_ability_manager_proxy.cpp +++ b/frameworks/native/source/system_ability_manager_proxy.cpp @@ -1565,35 +1565,6 @@ int32_t SystemAbilityManagerProxy::GetCommonEventExtraDataIdlist(int32_t saId, s sptr SystemAbilityManagerProxy::GetLocalAbilityManagerProxy(int32_t systemAbilityId) { - if (!CheckInputSysAbilityId(systemAbilityId)) { - HILOGW("GetLocalAbilityManagerProxy SA invalid:%{public}d!", systemAbilityId); - return nullptr; - } - - MessageParcel data; - if (!data.WriteInterfaceToken(SAMANAGER_INTERFACE_TOKEN)) { - HILOGE("GetLocalAbilityManagerProxy write token failed!"); - return nullptr; - } - if (!data.WriteInt32(systemAbilityId)) { - HILOGE("GetLocalAbilityManagerProxy write said failed!"); - return nullptr; - } - - auto remote = Remote(); - if (remote == nullptr) { - HILOGI("GetLocalAbilityManagerProxy remote is nullptr"); - return nullptr; - } - - MessageParcel reply; - MessageOption option; - int32_t err = remote->SendRequest( - static_cast(SamgrInterfaceCode::GET_LOCAL_ABILITY_MANAGER_PROXY_TRANSCATION), data, reply, option); - if (err != ERR_NONE) { - HILOGE("GetLocalAbilityManagerProxy SendRequest error: %{public}d!", err); - return nullptr; - } - return reply.ReadRemoteObject(); + return nullptr; } } // namespace OHOS diff --git a/interfaces/innerkits/samgr_proxy/include/if_local_ability_manager.h b/interfaces/innerkits/samgr_proxy/include/if_local_ability_manager.h index bfd0749b51f86b886ed7fb96b59afd36a49f2d80..1a4f5332e183de35e75d46475018366fb1544244 100755 --- a/interfaces/innerkits/samgr_proxy/include/if_local_ability_manager.h +++ b/interfaces/innerkits/samgr_proxy/include/if_local_ability_manager.h @@ -77,8 +77,6 @@ public: virtual bool FfrtDumperProc(std::string& result) = 0; virtual int32_t SystemAbilityExtProc(const std::string& extension, int32_t said, SystemAbilityExtensionPara* callback, bool isAsync = false) = 0; - virtual int32_t ServiceControlCmd(int32_t fd, int32_t systemAbilityId, - const std::vector& args) = 0; DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.ILocalAbilityManager"); protected: static inline const std::u16string LOCAL_ABILITY_MANAGER_INTERFACE_TOKEN = u"ohos.localabilitymanager.accessToken"; diff --git a/interfaces/innerkits/samgr_proxy/include/local_ability_manager_proxy.h b/interfaces/innerkits/samgr_proxy/include/local_ability_manager_proxy.h index 127a50bb890687547e6e618f4f21f58831f7aa87..f4f9d6b9373f6de0c00bdb79296c8fcd2aad914a 100755 --- a/interfaces/innerkits/samgr_proxy/include/local_ability_manager_proxy.h +++ b/interfaces/innerkits/samgr_proxy/include/local_ability_manager_proxy.h @@ -42,7 +42,6 @@ public: bool FfrtDumperProc(std::string& ffrtDumperInfo); int32_t SystemAbilityExtProc(const std::string& extension, int32_t said, SystemAbilityExtensionPara* callback, bool isAsync = false); - int32_t ServiceControlCmd(int32_t fd, int32_t systemAbilityId, const std::vector& args); private: static inline BrokerDelegator delegator_; bool PrepareData(MessageParcel& data, int32_t said, const std::string& extension); diff --git a/interfaces/innerkits/samgr_proxy/include/safwk_ipc_interface_code.h b/interfaces/innerkits/samgr_proxy/include/safwk_ipc_interface_code.h index db0bbe25a48f58b433bfc794c9b61c31a93d2c79..8d3dff429cdf17b237477f1d13159e8fd75eacdd 100755 --- a/interfaces/innerkits/samgr_proxy/include/safwk_ipc_interface_code.h +++ b/interfaces/innerkits/samgr_proxy/include/safwk_ipc_interface_code.h @@ -27,8 +27,7 @@ enum SafwkInterfaceCode : uint32_t { IPC_STAT_CMD_TRANSACTION = 6, FFRT_DUMPER_TRANSACTION = 7, SYSTEM_ABILITY_EXT_TRANSACTION = 8, - SERVICE_CONTROL_CMD_TRANSACTION = 9, - FFRT_STAT_CMD_TRANSACTION = 10, + FFRT_STAT_CMD_TRANSACTION = 9, }; } #endif // !defined(SAFWK_IPC_INTERFACE_CODE_H) \ No newline at end of file diff --git a/interfaces/innerkits/samgr_proxy/include/samgr_ipc_interface_code.h b/interfaces/innerkits/samgr_proxy/include/samgr_ipc_interface_code.h index a37feca4f57c06a6846c7ee57b1e0a42eef2a8fc..5ca883b6cb81ce211d99cd6e1e465a97d39d1b56 100644 --- a/interfaces/innerkits/samgr_proxy/include/samgr_ipc_interface_code.h +++ b/interfaces/innerkits/samgr_proxy/include/samgr_ipc_interface_code.h @@ -50,7 +50,6 @@ enum class SamgrInterfaceCode : uint32_t { GET_EXTERNSION_SA_LIST_TRANSCATION = 34, GET_SA_EXTENSION_INFO_TRANSCATION = 35, GET_COMMON_EVENT_EXTRA_ID_LIST_TRANSCATION = 36, - GET_LOCAL_ABILITY_MANAGER_PROXY_TRANSCATION = 37, }; } // namespace OHOS #endif // !defined(INTERFACES_INNERKITS_SAMGR_INCLUDE_SAMGR_INTERFACE_CODE_H) \ No newline at end of file diff --git a/services/lsamgr/src/local_ability_manager_proxy.cpp b/services/lsamgr/src/local_ability_manager_proxy.cpp index 3d15d71e259f985a058350c7a2b477b1ee19478e..efc6210215b6ab784b18943787610a10d1ae6957 100644 --- a/services/lsamgr/src/local_ability_manager_proxy.cpp +++ b/services/lsamgr/src/local_ability_manager_proxy.cpp @@ -443,46 +443,4 @@ bool LocalAbilityManagerProxy::PrepareData(MessageParcel& data, int32_t said, co } return true; } - -int32_t LocalAbilityManagerProxy::ServiceControlCmd(int32_t fd, int32_t systemAbilityId, - const std::vector& args) -{ - if (systemAbilityId <= 0) { - HILOG_WARN(LOG_CORE, "ServiceControlCmd systemAbilityId invalid."); - return INVALID_DATA; - } - - sptr iro = Remote(); - if (iro == nullptr) { - HILOG_ERROR(LOG_CORE, "ServiceControlCmd remote return null"); - return OBJECT_NULL; - } - - MessageParcel data; - if (!data.WriteInterfaceToken(LOCAL_ABILITY_MANAGER_INTERFACE_TOKEN)) { - HILOG_WARN(LOG_CORE, "ServiceControlCmd interface token check failed"); - return INVALID_DATA; - } - if (!data.WriteInt32(systemAbilityId)) { - HILOG_WARN(LOG_CORE, "ServiceControlCmd write systemAbilityId failed"); - return INVALID_DATA; - } - if (!data.WriteFileDescriptor(fd)) { - HILOG_WARN(LOG_CORE, "ServiceControlCmd write fd failed"); - return INVALID_DATA; - } - if (!data.WriteString16Vector(args)) { - HILOG_WARN(LOG_CORE, "ServiceControlCmd write args failed"); - return INVALID_DATA; - } - - MessageParcel reply; - MessageOption option; - int32_t status = iro->SendRequest( - static_cast(SafwkInterfaceCode::SERVICE_CONTROL_CMD_TRANSACTION), data, reply, option); - if (status != NO_ERROR) { - HILOG_ERROR(LOG_CORE, "ServiceControlCmd SendRequest failed, return value : %{public}d", status); - } - return status; -} } diff --git a/services/samgr/native/include/system_ability_manager.h b/services/samgr/native/include/system_ability_manager.h index f4c672d4c3e0c5eb235f93643380f882a602399b..e1818ee5d4004cd947787b7780dff93edcffb744 100644 --- a/services/samgr/native/include/system_ability_manager.h +++ b/services/samgr/native/include/system_ability_manager.h @@ -231,12 +231,7 @@ public: sptr GetSystemProcess(const std::u16string& procName); sptr GetLocalAbilityManagerProxy(int32_t systemAbilityId) override { - CommonSaProfile saProfile; - if (!GetSaProfile(systemAbilityId, saProfile)) { - HILOGD("SA:%{public}d no profile!", systemAbilityId); - return nullptr; - } - return GetSystemProcess(saProfile.process); + return nullptr; } bool IsModuleUpdate(int32_t systemAbilityId) { diff --git a/services/samgr/native/include/system_ability_manager_stub.h b/services/samgr/native/include/system_ability_manager_stub.h index 837284a5b38bb12441159673a2cff1e5d4dd389b..0d16d3b19f9a0b853e99bf73efe248c649e244c5 100644 --- a/services/samgr/native/include/system_ability_manager_stub.h +++ b/services/samgr/native/include/system_ability_manager_stub.h @@ -179,11 +179,6 @@ private: { return stub->GetCommonEventExtraDataIdlistInner(data, reply); } - static int32_t LocalGetLocalAbilityManagerProxy(SystemAbilityManagerStub* stub, - MessageParcel& data, MessageParcel& reply) - { - return stub->GetLocalAbilityManagerProxyInner(data, reply); - } int32_t ListSystemAbilityInner(MessageParcel& data, MessageParcel& reply); int32_t SubsSystemAbilityInner(MessageParcel& data, MessageParcel& reply); int32_t UnSubsSystemAbilityInner(MessageParcel& data, MessageParcel& reply); @@ -214,7 +209,6 @@ private: int32_t GetExtensionRunningSaListInner(MessageParcel& data, MessageParcel& reply); int32_t GetRunningSaExtensionInfoListInner(MessageParcel& data, MessageParcel& reply); int32_t GetCommonEventExtraDataIdlistInner(MessageParcel& data, MessageParcel& reply); - int32_t GetLocalAbilityManagerProxyInner(MessageParcel& data, MessageParcel& reply); static int32_t GetHapIdMultiuser(int32_t uid); void SetAbilityFuncMap(); void SetProcessFuncMap(); diff --git a/services/samgr/native/source/system_ability_manager_stub.cpp b/services/samgr/native/source/system_ability_manager_stub.cpp index b5aadc863c0a0fda4d82d70ba15c6b101c426618..0a4dd921ed8e39ae769d6a38e7d5407c78506838 100644 --- a/services/samgr/native/source/system_ability_manager_stub.cpp +++ b/services/samgr/native/source/system_ability_manager_stub.cpp @@ -105,8 +105,7 @@ namespace { using namespace OHOS::Security; namespace OHOS { namespace { -const std::string EXT_TRANSACTION_PERMISSION = "ohos.permission.ACCESS_EXT_SYSTEM_ABILITY"; -const std::string PERMISSION_SVC = "ohos.permission.CONTROL_SVC_CMD"; +constexpr const char *EXT_TRANSACTION_PERMISSION = "ohos.permission.ACCESS_EXT_SYSTEM_ABILITY"; } void SystemAbilityManagerStub::SetAbilityFuncMap() @@ -179,8 +178,6 @@ SystemAbilityManagerStub::SystemAbilityManagerStub() SystemAbilityManagerStub::LocalGetRunningSaExtensionInfoList; memberFuncMap_[static_cast(SamgrInterfaceCode::GET_COMMON_EVENT_EXTRA_ID_LIST_TRANSCATION)] = SystemAbilityManagerStub::LocalGetCommonEventExtraDataIdlist; - memberFuncMap_[static_cast(SamgrInterfaceCode::GET_LOCAL_ABILITY_MANAGER_PROXY_TRANSCATION)] = - SystemAbilityManagerStub::LocalGetLocalAbilityManagerProxy; } int32_t SystemAbilityManagerStub::OnRemoteRequest(uint32_t code, @@ -1244,32 +1241,4 @@ int32_t SystemAbilityManagerStub::GetCommonEventExtraDataIdlistInner(MessageParc } return ERR_NONE; } - -int32_t SystemAbilityManagerStub::GetLocalAbilityManagerProxyInner(MessageParcel& data, MessageParcel& reply) -{ - if (!CheckPermission(PERMISSION_SVC)) { - HILOGE("GetLocalSystemAbilityProxyInner permission denied! CallSid:%{public}s", - OHOS::IPCSkeleton::GetCallingSid().c_str()); - return ERR_PERMISSION_DENIED; - } - - int32_t systemAbilityId = -1; - bool ret = data.ReadInt32(systemAbilityId); - if (!ret || !CheckInputSysAbilityId(systemAbilityId)) { - HILOGE("GetLocalSystemAbilityProxyInner get SAId failed."); - return ERR_NULL_OBJECT; - } - - sptr remoteObject = GetLocalAbilityManagerProxy(systemAbilityId); - if (remoteObject == nullptr) { - HILOGE("GetLocalSystemAbilityProxyInner SA:%{public}d GetLocalSystemAbilityProxy failed.", systemAbilityId); - return ERR_NULL_OBJECT; - } - ret = reply.WriteRemoteObject(remoteObject); - if (!ret) { - HILOGE("GetLocalSystemAbilityProxyInner SA:%{public}d write reply failed.", systemAbilityId); - return ERR_FLATTEN_OBJECT; - } - return ERR_NONE; -} } // namespace OHOS diff --git a/services/samgr/native/test/unittest/src/local_ability_manager_proxy_test.cpp b/services/samgr/native/test/unittest/src/local_ability_manager_proxy_test.cpp index 35196e4d758b4154e6742436c04e62bae5fcc696..af8b0b48b0c12dc77e0edd04e72041026ff6dfd3 100644 --- a/services/samgr/native/test/unittest/src/local_ability_manager_proxy_test.cpp +++ b/services/samgr/native/test/unittest/src/local_ability_manager_proxy_test.cpp @@ -476,42 +476,4 @@ HWTEST_F(LocalAbilityManagerProxyTest, SystemAbilityExtProc004, TestSize.Level3) int32_t result = localAbility->SystemAbilityExtProc("OnBackup", TEST_SAID_INVAILD, &callback, true); EXPECT_EQ(result, INVALID_DATA); } - -/** - * @tc.name: ServiceControlCmd001 - * @tc.desc: test ServiceControlCmd001 - * @tc.type: FUNC - * @tc.require: I9IE98 - */ -HWTEST_F(LocalAbilityManagerProxyTest, ServiceControlCmd001, TestSize.Level3) -{ - sptr testAbility(new MockIroSendrequesteStub()); - sptr localAbility(new LocalAbilityManagerProxy(testAbility)); - - int32_t fd = 1; - int32_t systemAbilityId = -1; - std::vector args (1, Str8ToStr16(std::string("help"))); - - int32_t result = localAbility->ServiceControlCmd(fd, systemAbilityId, args); - EXPECT_EQ(result, INVALID_DATA); -} - -/** - * @tc.name: ServiceControlCmd002 - * @tc.desc: test ServiceControlCmd002 - * @tc.type: FUNC - * @tc.require: I9IE98 - */ -HWTEST_F(LocalAbilityManagerProxyTest, ServiceControlCmd002, TestSize.Level3) -{ - sptr testAbility(new MockIroSendrequesteStub()); - sptr localAbility(new LocalAbilityManagerProxy(testAbility)); - - int32_t fd = 1; - int32_t systemAbilityId = 1; - std::vector args (1, Str8ToStr16(std::string("help"))); - - int32_t result = localAbility->ServiceControlCmd(fd, systemAbilityId, args); - EXPECT_EQ(result, NO_ERROR); -} } \ No newline at end of file diff --git a/services/samgr/native/test/unittest/src/system_ability_mgr_proxy_test.cpp b/services/samgr/native/test/unittest/src/system_ability_mgr_proxy_test.cpp index 1d9c6f59994e67131e40e67937328e0fc4323ed5..edd34499350199365fd0322c2a88a06defcb43ad 100644 --- a/services/samgr/native/test/unittest/src/system_ability_mgr_proxy_test.cpp +++ b/services/samgr/native/test/unittest/src/system_ability_mgr_proxy_test.cpp @@ -1260,40 +1260,4 @@ HWTEST_F(SystemAbilityMgrProxyTest, OnLoadSystemAbilityFail005, TestSize.Level3) callback->OnLoadSystemAbilityFail(-1); EXPECT_EQ(nullptr, callback->loadproxy_); } - -/** - * @tc.name: GetLocalAbilityManagerProxy001 - * @tc.desc: test GetLocalAbilityManagerProxy - * @tc.type: FUNC - */ -HWTEST_F(SystemAbilityMgrProxyTest, GetLocalAbilityManagerProxy001, TestSize.Level3) -{ - sptr samgrProxy = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - - auto ret = samgrProxy->GetLocalAbilityManagerProxy(TEST_ID_NORANGE_SAID); - EXPECT_TRUE(ret == nullptr); -} - -/** - * @tc.name: GetLocalAbilityManagerProxy002 - * @tc.desc: test GetLocalAbilityManagerProxy - * @tc.type: FUNC - */ -HWTEST_F(SystemAbilityMgrProxyTest, GetLocalAbilityManagerProxy002, TestSize.Level3) -{ - sptr samgrProxy = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - - auto ret = samgrProxy->GetLocalAbilityManagerProxy(TEST_SAID_INVALID); - EXPECT_TRUE(ret == nullptr); -} - -HWTEST_F(SystemAbilityMgrProxyTest, GetLocalAbilityManagerProxy003, TestSize.Level3) -{ - DTEST_LOG << " GetLocalAbilityManagerProxy003 begin " << std::endl; - sptr samgrMock = new ISystemAbilityManagerMock; - EXPECT_TRUE(samgrMock != nullptr); - auto ret = samgrMock->GetLocalAbilityManagerProxy(TEST_SAID_INVALID); - EXPECT_TRUE(ret == nullptr); - DTEST_LOG << " GetLocalAbilityManagerProxy003 end " << std::endl; -} } \ No newline at end of file diff --git a/services/samgr/native/test/unittest/src/system_ability_mgr_stub_test.cpp b/services/samgr/native/test/unittest/src/system_ability_mgr_stub_test.cpp index 4ffbfae42d8f3666b9f21fe7b78a03ddfe9ffbb1..c1b00a6ef571bf25669c250566491da0e5814b0b 100644 --- a/services/samgr/native/test/unittest/src/system_ability_mgr_stub_test.cpp +++ b/services/samgr/native/test/unittest/src/system_ability_mgr_stub_test.cpp @@ -808,51 +808,4 @@ HWTEST_F(SystemAbilityMgrStubTest, SendStrategyInner001, TestSize.Level3) int32_t result = saMgr->SendStrategyInner(data, reply); EXPECT_EQ(result, ERR_FLATTEN_OBJECT); } - -/** - * @tc.name: GetLocalAbilityManagerProxyInner001 - * @tc.desc: test GetLocalAbilityManagerProxyInner - * @tc.type: FUNC - * @tc.require: I6XB42 - */ -HWTEST_F(SystemAbilityMgrStubTest, GetLocalAbilityManagerProxyInner001, TestSize.Level3) -{ - sptr saMgr = SystemAbilityManager::GetInstance(); - MessageParcel data; - MessageParcel reply; - int32_t ret = saMgr->GetLocalAbilityManagerProxyInner(data, reply); - EXPECT_EQ(ret, ERR_NULL_OBJECT); -} - -/** - * @tc.name: GetLocalAbilityManagerProxyInner002 - * @tc.desc: test GetLocalAbilityManagerProxyInner - * @tc.type: FUNC - * @tc.require: I6XB42 - */ -HWTEST_F(SystemAbilityMgrStubTest, GetLocalAbilityManagerProxyInner002, TestSize.Level3) -{ - sptr saMgr = SystemAbilityManager::GetInstance(); - MessageParcel data; - MessageParcel reply; - EXPECT_TRUE(data.WriteInt32(INVALID_SAID)); - int32_t ret = saMgr->GetLocalAbilityManagerProxyInner(data, reply); - EXPECT_EQ(ret, ERR_NULL_OBJECT); -} - -/** - * @tc.name: GetLocalAbilityManagerProxyInner003 - * @tc.desc: test GetLocalAbilityManagerProxyInner - * @tc.type: FUNC - * @tc.require: I6XB42 - */ -HWTEST_F(SystemAbilityMgrStubTest, GetLocalAbilityManagerProxyInner003, TestSize.Level3) -{ - sptr saMgr = SystemAbilityManager::GetInstance(); - MessageParcel data; - MessageParcel reply; - EXPECT_TRUE(data.WriteInt32(SAID)); - int32_t ret = saMgr->GetLocalAbilityManagerProxyInner(data, reply); - EXPECT_EQ(ret, ERR_NULL_OBJECT); -} } \ No newline at end of file diff --git a/services/samgr/native/test/unittest/src/system_ability_mgr_test.cpp b/services/samgr/native/test/unittest/src/system_ability_mgr_test.cpp index f8fa49094839f5d71561167cb62cbec8ece7c12e..6974325439c445376116ee88f6151aa8d8bbf3b7 100644 --- a/services/samgr/native/test/unittest/src/system_ability_mgr_test.cpp +++ b/services/samgr/native/test/unittest/src/system_ability_mgr_test.cpp @@ -1623,47 +1623,4 @@ HWTEST_F(SystemAbilityMgrTest, OnRemoteDied002, TestSize.Level3) saMgr->remoteCallbackDeath_->OnRemoteDied(nullptr); DTEST_LOG<<"OnRemoteDied002 END"; } - -/** - * @tc.name: Test GetLocalAbilityManagerProxy001 - * @tc.desc: GetLocalAbilityManagerProxy001 - * @tc.type: FUNC - * @tc.require: I7VQQG - */ -HWTEST_F(SystemAbilityMgrTest, GetLocalAbilityManagerProxy001, TestSize.Level3) -{ - DTEST_LOG << "GetLocalAbilityManagerProxy001 BEGIN" << std::endl; - - sptr saMgr = new SystemAbilityManager; - saMgr->saProfileMap_.clear(); - auto ret = saMgr->GetLocalAbilityManagerProxy(SAID); - EXPECT_TRUE(ret == nullptr); - DTEST_LOG << "GetLocalAbilityManagerProxy001 END" << std::endl; -} - -/** - * @tc.name: Test GetLocalAbilityManagerProxy002 - * @tc.desc: GetLocalAbilityManagerProxy001 - * @tc.type: FUNC - * @tc.require: I7VQQG - */ -HWTEST_F(SystemAbilityMgrTest, GetLocalAbilityManagerProxy002, TestSize.Level3) -{ - DTEST_LOG << "GetLocalAbilityManagerProxy002 BEGIN" << std::endl; - - sptr saMgr = new SystemAbilityManager; - CommonSaProfile saProfile; - saProfile.process = u"test"; - saProfile.saId = SAID; - saMgr->saProfileMap_[SAID] = saProfile; - - sptr testAbility = new TestTransactionService(); - EXPECT_FALSE(testAbility == nullptr); - saMgr->systemProcessMap_[u"test"] = testAbility; - - auto ret = saMgr->GetLocalAbilityManagerProxy(SAID); - EXPECT_FALSE(ret == nullptr); - - DTEST_LOG << "GetLocalAbilityManagerProxy002 END" << std::endl; -} } // namespace OHOS \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_001.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_001.py index c944f2b5dd82235138351e7b9ab43f0911cfd9f3..40b0880492081eca02e61f95162dc3119dbdf62f 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_001.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_001.py @@ -14,104 +14,6 @@ # 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, get_report_dir, ACTUAL -from hypium import UiExplorer -from hypium.action.host import host -from hypium.action.os_hypium.checker import Assert -from hypium.action.os_hypium.device_logger import DeviceLogger, AsyncCommand -sa_lib_test_path = get_resource_path( - "resource/SO_RESOURCE/liblisten_test.z.so", - isdir=None) -sa_lib_ability_c_path = get_resource_path( - "resource/SO_RESOURCE/libtest_audio_ability.z.so", - isdir=None) -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) -sa_listen_cfg_path = get_resource_path( - "resource/level/lifecycle_state_001/listen_test.cfg", - isdir=None) -sa_listen_json_path = get_resource_path( - "resource/level/lifecycle_state_001/listen_test.json", - isdir=None) -sa_ondemand_path = get_resource_path( - "resource/SO_RESOURCE/ondemand", - isdir=None) -sa_tool_path = get_resource_path( - "resource/SO_RESOURCE/TestTool", - isdir=None) -class LifeCycle_State_001(TestCase): - - def __init__(self, controllers): - sele.TAG = self.__class__.__name__ - TestCase.__init__(self, self.TAG, controllers) - self.tests = [ - "test_step" - ] - self.driver = UiExplore(self.driver1) - self.sn = self.driver1.device_sn - - def setup(self): - driver = self.driver - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) - host.shell("hdc -t {} target mount".format(self.sn)) - driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) - - driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) - - driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) - - driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) - - driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) - - driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) - - driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") - host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) - driver.System.reboot() - - def test_step(self): - driver = self.driver - # 用例步骤 - # 1、执行push_bat脚本, 推入测试资源 - # 2、执行"hdc shell"命令, 进入shell命令行 - # 3、执行"ondemand"命令, 执行测试程序 - # 4、输入"ondemand", 进入测试模式 - # 5、输入任意字符后回车, 开始执行test case - # 6、再打开一个cmd用来查看hilog, 执行hilog | grep "Scheduler SA" - # 预期结果 - # 控制台打印: OnLoadSystemAbilitySuccesss systemAbilityId:1494 - # Hilog打印: [SA Scheduler][SA: 1494] loaded - #清理日志 - driver.shell('hilog -r') - # 开始保存日志 - device_logger = DeviceLogger(driver).set_filter_string("Scheduler SA:1494") - device_logger.start_log(get_report_dir() + 'lifecycle_state_001_txt') - result = driver.System.execute_command("ondemand test 1") - assert "OnLoadSystemAbilitySuccesss systemAbilityId:1494" in result - # 停止日志 - device_logger.stop_log() - # 检查日志输出 - device_logger.check_log("Scheduler SA:1494 loaded", EXCEPTION=True) - - def teardown(self): - self.driver.System.execute_command("kill -9 `pidof listen_test`") - # self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - # self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - # self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - # self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") - # self.driver.Storage.remove_file("/system/etc/init/listen_test.json") - # self.driver.Storage.remove_file("/system/bin/ondemand") - self.log.info("done") diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_002.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_002.json index c3436e69fd627ea78b4597bf50aaffd4942846c8..67b186e59bd9a2fe8ea209d01ba73906efe43128 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_002.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_002.json @@ -1,16 +1,3 @@ { - "description": "hypium自测试用例", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "testcases/level1/lifecycle/lifecycle_state_002.py" - ] - }, - "kits":[] - } \ No newline at end of file + "description": "hypium自测试用例" +} \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_002.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_002.py index f232d452d2cb86d2e82affc00946dc2c115ad270..68bc19fc93e4e1b543d6ddf7af0861bb3678a787 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_002.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_002.py @@ -12,112 +12,4 @@ # 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, get_report_dir -from hypium import UiExplorer -from hypium.action.host import host -from hypium.action.os_hypium.checker import Assert -from hypium.action.os_hypium.device_logger import DeviceLogger, AsyncCommand -from devicetest.utils.file_util import get_resource_path - -sa_lib_test_path = get_resource_path( - "resource/SO_RESOURCE/liblisten_test.z.so", - isdir=None) -sa_lib_ability_c_path = get_resource_path( - "resource/SO_RESOURCE/libtest_audio_ability.z.so", - isdir=None) -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) -sa_listen_cfg_path = get_resource_path( - "resource/level/lifecycle_state_002/listen_test.cfg", - isdir=None) -sa_listen_json_path = get_resource_path( - "resource/level/lifecycle_state_002/listen_test.json", - isdir=None) -sa_ondemand_path = get_resource_path( - "resource/SO_RESOURCE/ondemand", - isdir=None) -sa_tool_path = get_resource_path( - "resource/SO_RESOURCE/TestTool", - isdir=None) -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) - -class LifeCycle_State_002(TestCase): - - def __init__(self, controllers): - sele.TAG = self.__class__.__name__ - TestCase.__init__(self, self.TAG, controllers) - self.tests = [ - "test_step" - ] - self.driver = UiExplore(self.driver1) - self.sn = self.driver1.device_sn - - def setup(self): - driver = self.driver - # 清理日志 - driver.shell('hilog -r') - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) - # host.shell("hdc -t {} target mount".format(self.sn)) - # driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - # host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - # host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) - # driver.System.reboot() - - def test_step(self): - driver = self.driver - # 用例步骤 - # 1、执行push_bat脚本, 推入测试资源 - # 2、执行"hdc shell"命令, 进入shell命令行 - # 3、执行"ondemand"命令, 执行测试程序 - # 4、输入"ondemand", 进入测试模式 - # 5、输入任意字符后回车, 开始执行test case - # 6、再打开一个cmd用来查看hilog, 执行hilog | grep "SA Scheduler" - # 预期结果 - # 控制台打印: OnLoadSystemAbilitySuccesss systemAbilityId:1494 - # Hilog打印: [SA Scheduler][SA: 1494] loaded - #清理日志 - driver.shell('hilog -r') - # 开始保存日志 - device_logger = DeviceLogger(driver).set_filter_string("Scheduler SA:1494") - device_logger.start_log(get_report_dir() + 'lifecycle_state_002_txt') - result = driver.System.execute_command("ondemand test 2") - assert "OnLoadSystemAbilitySuccesss systemAbilityId:1494" in result - # 停止日志 - device_logger.stop_log() - # 检查日志输出 - device_logger.check_log("Scheduler SA:1494 loaded", EXCEPTION=True) - - def teardown(self): - # self.driver.System.execute_command("kill -9 `pidof listen_test`") - # self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - # self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - # self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - # self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") - # self.driver.Storage.remove_file("/system/etc/init/listen_test.json") - # self.driver.Storage.remove_file("/system/bin/ondemand") - self.log.info("done") +# limitations under the License. \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_003.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_003.json index 8a5d5d03fd13ad5889c4ff5244c89337d9d5f9f7..67b186e59bd9a2fe8ea209d01ba73906efe43128 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_003.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_003.json @@ -1,16 +1,3 @@ { - "description": "hypium自测试用例", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "testcases/level1/lifecycle/lifecycle_state_003.py" - ] - }, - "kits":[] - } \ No newline at end of file + "description": "hypium自测试用例" +} \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_003.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_003.py index c54f6c951ee13efdc97350ca67c32d2597c42d66..68bc19fc93e4e1b543d6ddf7af0861bb3678a787 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_003.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_003.py @@ -12,114 +12,4 @@ # 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, get_report_dir -from hypium import UiExplorer -from hypium.action.host import host -from hypium.action.os_hypium.checker import Assert -from hypium.action.os_hypium.device_logger import DeviceLogger, AsyncCommand -from devicetest.utils.file_util import get_resource_path - -sa_lib_test_path = get_resource_path( - "resource/SO_RESOURCE/liblisten_test.z.so", - isdir=None) -sa_lib_ability_c_path = get_resource_path( - "resource/SO_RESOURCE/libtest_audio_ability.z.so", - isdir=None) -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) -sa_listen_cfg_path = get_resource_path( - "resource/level/lifecycle_state_003/listen_test.cfg", - isdir=None) -sa_listen_json_path = get_resource_path( - "resource/level/lifecycle_state_003/listen_test.json", - isdir=None) -sa_ondemand_path = get_resource_path( - "resource/SO_RESOURCE/ondemand", - isdir=None) -sa_tool_path = get_resource_path( - "resource/SO_RESOURCE/TestTool", - isdir=None) -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) - -class LifeCycle_State_003(TestCase): - - def __init__(self, controllers): - sele.TAG = self.__class__.__name__ - TestCase.__init__(self, self.TAG, controllers) - self.tests = [ - "test_step" - ] - self.driver = UiExplore(self.driver1) - self.sn = self.driver1.device_sn - - def setup(self): - driver = self.driver - # 清理日志 - driver.shell('hilog -r') - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) - # host.shell("hdc -t {} target mount".format(self.sn)) - # driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - # host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - # host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) - # driver.System.reboot() - - def test_step(self): - driver = self.driver - # 用例步骤 - # 1、执行push_bat脚本, 推入测试资源 - # 2、执行"hdc shell"命令, 进入shell命令行 - # 3、执行"ondemand"命令, 执行测试程序 - # 4、输入"ondemand", 进入测试模式 - # 5、输入任意字符后回车, 开始执行test case - # 6、再打开一个cmd用来查看hilog, 执行hilog | grep "SA Scheduler" - # 预期结果 - # 控制台打印: OnLoadSystemAbilitySuccesss systemAbilityId:1494 - # Hilog打印: - # [SA Scheduler][SA: 1494] remove pending unload event - # [SA Scheduler][SA: 1494] loaded - #清理日志 - driver.shell('hilog -r') - # 开始保存日志 - device_logger = DeviceLogger(driver).set_filter_string("Scheduler SA:1494") - device_logger.start_log(get_report_dir() + 'lifecycle_state_003_txt') - result = driver.System.execute_command("ondemand test 3") - assert "OnLoadSystemAbilitySuccesss systemAbilityId:1494" in result - # 停止日志 - device_logger.stop_log() - # 检查日志输出 - device_logger.check_log("Scheduler SA:1494 loaded", EXCEPTION=True) - - def teardown(self): - self.driver.System.execute_command("kill -9 `pidof listen_test`") - # self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - # self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - # self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - # self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") - # self.driver.Storage.remove_file("/system/etc/init/listen_test.json") - # self.driver.Storage.remove_file("/system/bin/ondemand") - self.log.info("done") +# limitations under the License. \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_004.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_004.json index eee728d9cfec02f18f045d47975e81e905851071..67b186e59bd9a2fe8ea209d01ba73906efe43128 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_004.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_004.json @@ -1,16 +1,3 @@ { - "description": "hypium自测试用例", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "testcases/level1/lifecycle/lifecycle_state_004.py" - ] - }, - "kits":[] - } \ No newline at end of file + "description": "hypium自测试用例" +} \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_004.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_004.py index de607dfd2fdcb07af09622ce2a43ce5d22103a99..68bc19fc93e4e1b543d6ddf7af0861bb3678a787 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_004.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_004.py @@ -12,112 +12,4 @@ # 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, get_report_dir -from hypium import UiExplorer -from hypium.action.host import host -from hypium.action.os_hypium.checker import Assert -from hypium.action.os_hypium.device_logger import DeviceLogger, AsyncCommand -from devicetest.utils.file_util import get_resource_path - -sa_lib_test_path = get_resource_path( - "resource/SO_RESOURCE/liblisten_test.z.so", - isdir=None) -sa_lib_ability_c_path = get_resource_path( - "resource/SO_RESOURCE/libtest_audio_ability.z.so", - isdir=None) -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) -sa_listen_cfg_path = get_resource_path( - "resource/level/lifecycle_state_004/listen_test.cfg", - isdir=None) -sa_listen_json_path = get_resource_path( - "resource/level/lifecycle_state_004/listen_test.json", - isdir=None) -sa_ondemand_path = get_resource_path( - "resource/SO_RESOURCE/ondemand", - isdir=None) -sa_tool_path = get_resource_path( - "resource/SO_RESOURCE/TestTool", - isdir=None) -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) - -class LifeCycle_State_004(TestCase): - - def __init__(self, controllers): - sele.TAG = self.__class__.__name__ - TestCase.__init__(self, self.TAG, controllers) - self.tests = [ - "test_step" - ] - self.driver = UiExplore(self.driver1) - self.sn = self.driver1.device_sn - - def setup(self): - driver = self.driver - # 清理日志 - driver.shell('hilog -r') - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) - host.shell("hdc -t {} target mount".format(self.sn)) - driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) - - driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) - - driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) - - driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) - - driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) - - driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) - - driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") - host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) - driver.System.reboot() - - def test_step(self): - driver = self.driver - # 用例步骤 - # 1、执行push_bat脚本, 推入测试资源 - # 2、执行"hdc shell"命令, 进入shell命令行 - # 3、执行"ondemand"命令, 执行测试程序 - # 4、输入"ondemand", 进入测试模式 - # 5、输入任意字符后回车, 开始执行test case - # 6、再打开一个cmd用来查看hilog, 执行hilog | grep "SA Scheduler" - # 预期结果 - # 控制台打印: OnLoadSystemAbilitySuccesss systemAbilityId:1494 - # Hilog打印: [SA Scheduler][SA: 1494] loaded - #清理日志 - driver.shell('hilog -r') - # 开始保存日志 - device_logger = DeviceLogger(driver).set_filter_string("Scheduler SA:1494") - device_logger.start_log(get_report_dir() + 'lifecycle_state_004_txt') - result = driver.System.execute_command("ondemand test 4") - assert "OnLoadSystemAbilitySuccesss systemAbilityId:1494" in result - # 停止日志 - device_logger.stop_log() - # 检查日志输出 - device_logger.check_log("Scheduler SA:1494 loaded", EXCEPTION=True) - - def teardown(self): - self.driver.System.execute_command("kill -9 `pidof listen_test`") - # self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - # self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - # self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - # self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") - # self.driver.Storage.remove_file("/system/etc/init/listen_test.json") - # self.driver.Storage.remove_file("/system/bin/ondemand") - self.log.info("done") +# limitations under the License. \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_005.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_005.json index 820d3e241ff427d9f25dcff1b4d51a26e0f6a6c7..67b186e59bd9a2fe8ea209d01ba73906efe43128 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_005.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_005.json @@ -1,16 +1,3 @@ { - "description": "hypium自测试用例", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "testcases/level1/lifecycle/lifecycle_state_005.py" - ] - }, - "kits":[] - } \ No newline at end of file + "description": "hypium自测试用例" +} \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_005.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_005.py index eeacd655d643017e816e487df70f311ae583680b..68bc19fc93e4e1b543d6ddf7af0861bb3678a787 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_005.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_005.py @@ -12,113 +12,4 @@ # 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, get_report_dir -from hypium import UiExplorer -from hypium.action.host import host -from hypium.action.os_hypium.checker import Assert -from hypium.action.os_hypium.device_logger import DeviceLogger -from devicetest.utils.file_util import get_resource_path - -sa_lib_test_path = get_resource_path( - "resource/SO_RESOURCE/liblisten_test.z.so", - isdir=None) -sa_lib_ability_c_path = get_resource_path( - "resource/SO_RESOURCE/libtest_audio_ability.z.so", - isdir=None) -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) -sa_listen_cfg_path = get_resource_path( - "resource/level/lifecycle_state_005/listen_test.cfg", - isdir=None) -sa_listen_json_path = get_resource_path( - "resource/level/lifecycle_state_005/listen_test.json", - isdir=None) -sa_ondemand_path = get_resource_path( - "resource/SO_RESOURCE/ondemand", - isdir=None) -sa_tool_path = get_resource_path( - "resource/SO_RESOURCE/TestTool", - isdir=None) -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) - -class LifeCycle_State_005(TestCase): - - def __init__(self, controllers): - sele.TAG = self.__class__.__name__ - TestCase.__init__(self, self.TAG, controllers) - self.tests = [ - "test_step" - ] - self.driver = UiExplore(self.driver1) - self.sn = self.driver1.device_sn - - def setup(self): - # driver = self.driver - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) - # host.shell("hdc -t {} target mount".format(self.sn)) - # driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - # host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - # host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) - # driver.System.reboot() - - def test_step(self): - driver = self.driver - # 用例步骤 - # 1、执行push_bat脚本, 推入测试资源 - # 2、执行"hdc shell"命令, 进入shell命令行 - # 3、执行"ondemand"命令, 执行测试程序 - # 4、输入"ondemand", 进入测试模式 - # 5、输入任意字符后回车, 开始执行test case - # 6、再打开一个cmd用来查看hilog, 执行hilog | grep "SA Scheduler" - # 预期结果 - # 控制台打印: OnLoadSystemAbilitySuccesss systemAbilityId:1494 - # Hilog打印: - # [SA Scheduler][SA: 1494] remove pending unload event - # [SA Scheduler][SA: 1494] loaded - #清理日志 - driver.shell('hilog -r') - # 开始保存日志 - device_logger = DeviceLogger(driver).set_filter_string("Scheduler SA:1494") - device_logger.start_log(get_report_dir() + 'lifecycle_state_005_txt') - result = driver.System.execute_command("ondemand test 5") - assert "OnLoadSystemAbilitySuccesss systemAbilityId:1494" in result - # 停止日志 - device_logger.stop_log() - # 检查日志输出 - device_logger.check_log("Scheduler SA:1494 unloadable", EXCEPTION=True) - device_logger.check_log("Scheduler SA:1494 loaded", EXCEPTION=True) - - def teardown(self): - self.driver.System.execute_command("kill -9 `pidof listen_test`") - # self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - # self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - # self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - # self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") - # self.driver.Storage.remove_file("/system/etc/init/listen_test.json") - # self.driver.Storage.remove_file("/system/bin/ondemand") - self.log.info("done") +# limitations under the License. \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_006.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_006.json index 100b3027920982ce187702e69f56a40983938cb4..67b186e59bd9a2fe8ea209d01ba73906efe43128 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_006.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_006.json @@ -1,16 +1,3 @@ { - "description": "hypium自测试用例", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "testcases/level1/lifecycle/lifecycle_state_006.py" - ] - }, - "kits":[] - } \ No newline at end of file + "description": "hypium自测试用例" +} \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_006.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_006.py index 0c220736f5e3e1c950a05c57451e323b101c4420..4c677816309a3d588bc49ae8fb519b0d3a9232b8 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_006.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_006.py @@ -14,110 +14,4 @@ # 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, get_report_dir -from hypium import UiExplorer -from hypium.action.host import host -from hypium.action.os_hypium.checker import Assert -from hypium.action.os_hypium.device_logger import DeviceLogger -from devicetest.utils.file_util import get_resource_path - -sa_lib_test_path = get_resource_path( - "resource/SO_RESOURCE/liblisten_test.z.so", - isdir=None) -sa_lib_ability_c_path = get_resource_path( - "resource/SO_RESOURCE/libtest_audio_ability.z.so", - isdir=None) -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) -sa_listen_cfg_path = get_resource_path( - "resource/level/lifecycle_state_006/listen_test.cfg", - isdir=None) -sa_listen_json_path = get_resource_path( - "resource/level/lifecycle_state_006/listen_test.json", - isdir=None) -sa_ondemand_path = get_resource_path( - "resource/SO_RESOURCE/ondemand", - isdir=None) -sa_tool_path = get_resource_path( - "resource/SO_RESOURCE/TestTool", - isdir=None) - -class LifeCycle_State_006(TestCase): - - def __init__(self, controllers): - sele.TAG = self.__class__.__name__ - TestCase.__init__(self, self.TAG, controllers) - self.tests = [ - "test_step" - ] - self.driver = UiExplore(self.driver1) - self.sn = self.driver1.device_sn - - def setup(self): - # driver = self.driver - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) - # host.shell("hdc -t {} target mount".format(self.sn)) - # driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - # host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - # host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) - # driver.System.reboot() - - def test_step(self): - driver = self.driver - # 用例步骤 - # 1、执行push_bat脚本, 推入测试资源 - # 2、执行"hdc shell"命令, 进入shell命令行 - # 3、执行"ondemand"命令, 执行测试程序 - # 4、输入"ondemand", 进入测试模式 - # 5、输入任意字符后回车, 开始执行test case - # 6、再打开一个cmd用来查看hilog, 执行hilog | grep "SA Scheduler" - # 预期结果 - # 控制台打印: OnLoadSystemAbilitySuccesss systemAbilityId:1494 - # Hilog打印: - # [SA Scheduler][SA: 1494] save load event - # [SA Scheduler][process: listen_test] stopped - # [SA Scheduler][SA: 1494] loaded - #清理日志 - driver.shell('hilog -r') - # 开始保存日志 - device_logger = DeviceLogger(driver).set_filter_string("I C018") - device_logger.start_log(get_report_dir() + 'lifecycle_state_006_txt') - result = driver.System.execute_command("ondemand test 6") - assert "OnLoadSystemAbilitySuccesss systemAbilityId:1494" in result - # 停止日志 - device_logger.stop_log() - # 检查日志输出 - device_logger.check_log("Scheduler SA:1494 save load event", EXCEPTION=True) - device_logger.check_log("Scheduler proc:listen_test stopped", EXCEPTION=True) - device_logger.check_log("Scheduler SA:1494 loaded", EXCEPTION=True) - - def teardown(self): - self.driver.System.execute_command("kill -9 `pidof listen_test`") - # self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - # self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - # self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - # self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") - # self.driver.Storage.remove_file("/system/etc/init/listen_test.json") - # self.driver.Storage.remove_file("/system/bin/ondemand") - self.log.info("done") +import os \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_007.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_007.json index 9314daf249e1e20f673b4c59db18f706d553bd2b..67b186e59bd9a2fe8ea209d01ba73906efe43128 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_007.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_007.json @@ -1,16 +1,3 @@ { - "description": "hypium自测试用例", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "testcases/level1/lifecycle/lifecycle_state_007.py" - ] - }, - "kits":[] - } \ No newline at end of file + "description": "hypium自测试用例" +} \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_007.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_007.py index 73f8cf0b3c9babf2c83362e3c9a26461cb846a96..4c677816309a3d588bc49ae8fb519b0d3a9232b8 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_007.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_007.py @@ -14,111 +14,4 @@ # 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, get_report_dir -from hypium import UiExplorer -from hypium.action.host import host -from hypium.action.os_hypium.checker import Assert -from hypium.action.os_hypium.device_logger import DeviceLogger -from devicetest.utils.file_util import get_resource_path - -sa_lib_test_path = get_resource_path( - "resource/SO_RESOURCE/liblisten_test.z.so", - isdir=None) -sa_lib_ability_c_path = get_resource_path( - "resource/SO_RESOURCE/libtest_audio_ability.z.so", - isdir=None) -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) -sa_listen_cfg_path = get_resource_path( - "resource/level/lifecycle_state_007/listen_test.cfg", - isdir=None) -sa_listen_json_path = get_resource_path( - "resource/level/lifecycle_state_007/listen_test.json", - isdir=None) -sa_ondemand_path = get_resource_path( - "resource/SO_RESOURCE/ondemand", - isdir=None) -sa_tool_path = get_resource_path( - "resource/SO_RESOURCE/TestTool", - isdir=None) - -class LifeCycle_State_007(TestCase): - - def __init__(self, controllers): - sele.TAG = self.__class__.__name__ - TestCase.__init__(self, self.TAG, controllers) - self.tests = [ - "test_step" - ] - self.driver = UiExplore(self.driver1) - self.sn = self.driver1.device_sn - - def setup(self): - driver = self.driver - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) - host.shell("hdc -t {} target mount".format(self.sn)) - driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) - - driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) - - driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) - - driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) - - driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) - - driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) - - driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") - host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) - driver.System.reboot() - - def test_step(self): - driver = self.driver - # 用例步骤 - # 1、执行push_bat脚本, 推入测试资源 - # 2、执行"hdc shell"命令, 进入shell命令行 - # 3、执行"ondemand"命令, 执行测试程序 - # 4、输入"ondemand", 进入测试模式 - # 5、输入任意字符后回车, 开始执行test case - # 6、再打开一个cmd用来查看hilog, 执行hilog | grep "SA Scheduler" - # 预期结果 - # 控制台打印: OnLoadSystemAbilitySuccesss systemAbilityId:1494 - # Hilog打印: - # [SA Scheduler][SA: 1494] save load event - # [SA Scheduler][process: listen_test] stopped - # [SA Scheduler][SA: 1497] loaded - #清理日志 - driver.shell('hilog -r') - # 开始保存日志 - device_logger = DeviceLogger(driver).set_filter_string("I C018") - device_logger.start_log(get_report_dir() + '//lifecycle_state_007_txt') - # 通过ondemand手动加载sa - driver.System.execute_command("ondemand test") - time.sleep(20) - # 停止日志 - device_logger.stop_log() - # 断言 - log_check_result = device_logger.check_log("Scheduler SA:1494 save load event", EXCEPTION=True) - log_check_result = device_logger.check_log("Scheduler proc:listen_test stopped", EXCEPTION=True) - log_check_result = device_logger.check_log("Scheduler SA:1494 loaded", EXCEPTION=True) - - def teardown(self): - self.driver.System.execute_command("kill -9 `pidof listen_test`") - self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") - self.driver.Storage.remove_file("/system/etc/init/listen_test.json") - self.driver.Storage.remove_file("/system/bin/ondemand") - self.log.info("done") +import os \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_008.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_008.json index c5338ddc3be25e532b1bff6f55115f2663b9fdab..67b186e59bd9a2fe8ea209d01ba73906efe43128 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_008.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_008.json @@ -1,16 +1,3 @@ { - "description": "hypium自测试用例", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "testcases/level1/lifecycle/lifecycle_state_008.py" - ] - }, - "kits":[] - } \ No newline at end of file + "description": "hypium自测试用例" +} \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_008.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_008.py index 5065b7199b55f006d6fe4296bf7da8de4c3fa48e..4c677816309a3d588bc49ae8fb519b0d3a9232b8 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_008.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_008.py @@ -14,109 +14,4 @@ # 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, get_report_dir -from hypium import UiExplorer -from hypium.action.host import host -from hypium.action.os_hypium.checker import Assert -from hypium.action.os_hypium.device_logger import DeviceLogger, AsyncCommand -from devicetest.utils.file_util import get_resource_path - -sa_lib_test_path = get_resource_path( - "resource/SO_RESOURCE/liblisten_test.z.so", - isdir=None) -sa_lib_ability_c_path = get_resource_path( - "resource/SO_RESOURCE/libtest_audio_ability.z.so", - isdir=None) -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) -sa_listen_cfg_path = get_resource_path( - "resource/level/lifecycle_state_008/listen_test.cfg", - isdir=None) -sa_listen_json_path = get_resource_path( - "resource/level/lifecycle_state_008/listen_test.json", - isdir=None) -sa_ondemand_path = get_resource_path( - "resource/SO_RESOURCE/ondemand", - isdir=None) -sa_tool_path = get_resource_path( - "resource/SO_RESOURCE/TestTool", - isdir=None) - -class LifeCycle_State_008(TestCase): - - def __init__(self, controllers): - sele.TAG = self.__class__.__name__ - TestCase.__init__(self, self.TAG, controllers) - self.tests = [ - "test_step" - ] - self.driver = UiExplore(self.driver1) - self.sn = self.driver1.device_sn - - def setup(self): - driver = self.driver - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) - # host.shell("hdc -t {} target mount".format(self.sn)) - # driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - # host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - # host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) - # driver.System.reboot() - - def test_step(self): - driver = self.driver - # 用例步骤 - # 1、执行push_bat脚本, 推入测试资源 - # 2、执行"hdc shell"命令, 进入shell命令行 - # 3、执行"ondemand"命令, 执行测试程序 - # 4、输入"ondemand", 进入测试模式 - # 5、输入任意字符后回车, 开始执行test case - # 6、再打开一个cmd用来查看hilog, 执行hilog | grep "SA Scheduler" - # 预期结果 - # 控制台打印: OnLoadSystemAbilitySuccesss systemAbilityId:1494 - # Hilog打印: - # [SA Scheduler][SA: 1494] save load event - # [SA Scheduler][process: listen_test] stopped - # [SA Scheduler][SA: 1497] loaded - #清理日志 - driver.shell('hilog -r') - # 开始保存日志 - device_logger = DeviceLogger(driver).set_filter_string("I C018") - device_logger.start_log(get_report_dir() + '//lifecycle_state_008_txt') - result = driver.System.execute_command("ondemand test 8") - assert "OnLoadSystemAbilitySuccesss systemAbilityId:1494" in result - # 停止日志 - device_logger.stop_log() - # 检查日志输出 - device_logger.check_log("Scheduler SA:1499 handle load failed event", EXCEPTION=True) - device_logger.check_log("Scheduler SA:1494 loaded", EXCEPTION=True) - - def teardown(self): - self.driver.System.execute_command("kill -9 `pidof listen_test`") - # self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - # self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - # self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - # self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") - # self.driver.Storage.remove_file("/system/etc/init/listen_test.json") - # self.driver.Storage.remove_file("/system/bin/ondemand") - self.log.info("done") +import os \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_009.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_009.json index 95a1978d0fd6cbaa79c97f54b77dfc9d40e4a291..67b186e59bd9a2fe8ea209d01ba73906efe43128 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_009.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_009.json @@ -1,16 +1,3 @@ { - "description": "hypium自测试用例", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "testcases/level1/lifecycle/lifecycle_state_009.py" - ] - }, - "kits":[] - } \ No newline at end of file + "description": "hypium自测试用例" +} \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_009.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_009.py index fce5ff724f362d4c7f9764703d14316ea1ee2744..4c677816309a3d588bc49ae8fb519b0d3a9232b8 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_009.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_009.py @@ -14,115 +14,4 @@ # 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, get_report_dir -from hypium import UiExplorer -from hypium.action.host import host -from hypium.action.os_hypium.checker import Assert -from hypium.action.os_hypium.device_logger import DeviceLogger, AsyncCommand -from devicetest.utils.file_util import get_resource_path - -sa_lib_test_path = get_resource_path( - "resource/SO_RESOURCE/liblisten_test.z.so", - isdir=None) -sa_lib_ability_c_path = get_resource_path( - "resource/SO_RESOURCE/libtest_audio_ability.z.so", - isdir=None) -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) -sa_listen_cfg_path = get_resource_path( - "resource/level/lifecycle_state_009/listen_test.cfg", - isdir=None) -sa_listen_json_path = get_resource_path( - "resource/level/lifecycle_state_009/listen_test.json", - isdir=None) -sa_ondemand_path = get_resource_path( - "resource/SO_RESOURCE/ondemand", - isdir=None) -sa_tool_path = get_resource_path( - "resource/SO_RESOURCE/TestTool", - isdir=None) - -class LifeCycle_State_009(TestCase): - - def __init__(self, controllers): - sele.TAG = self.__class__.__name__ - TestCase.__init__(self, self.TAG, controllers) - self.tests = [ - "test_step" - ] - self.driver = UiExplore(self.driver1) - self.sn = self.driver1.device_sn - - def setup(self): - driver = self.driver - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) - host.shell("hdc -t {} target mount".format(self.sn)) - driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) - - driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) - - driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) - - driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) - - driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) - - driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) - - driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") - host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) - driver.System.reboot() - - def test_step(self): - driver = self.driver - # 用例步骤 - # 1、执行push_bat脚本, 推入测试资源 - # 2、执行"hdc shell"命令, 进入shell命令行 - # 3、执行"ondemand"命令, 执行测试程序 - # 4、输入"ondemand", 进入测试模式 - # 5、输入任意字符后回车, 开始执行test case - # 6、再打开一个cmd用来查看hilog, 执行hilog | grep "SA Scheduler" - # 预期结果 - # 控制台打印: OnLoadSystemAbilitySuccesss systemAbilityId:1494 打印五次 - # Hilog打印: - # [SA Scheduler][SA: 1494] save load event - # [SA Scheduler][SA: 1494] loaded - #清理日志 - driver.shell('hilog -r') - # 开始保存日志 - device_logger = DeviceLogger(driver).set_filter_string("Scheduler SA:1494") - device_logger.start_log(get_report_dir() + '//lifecycle_state_009_txt') - result = driver.System.execute_command("ondemand test 9") - # 统计控制台字符串出现次数 - countWindowResult = result.count("OnLoadSystemAbilitySuccesss systemAbilityId:1494") - assert countWindowResult == 5 - # 停止日志 - device_logger.stop_log() - # 检查日志输出 - device_logger.check_log("Scheduler SA:1494 loaded", EXCEPTION=True) - device_logger.check_log("Scheduler SA:1494 not loaded", EXCEPTION=True) - - log_check_result1 = device_logger.check_log("Scheduler SA:1494 loaded", EXCEPTION=True) - Assert.equal(self, log_check_result1, True) - log_check_result2 = device_logger.check_log("Scheduler SA:1494 save load event", EXCEPTION=True) - Assert.equal(self, log_check_result2, True) - - def teardown(self): - self.driver.System.execute_command("kill -9 `pidof listen_test`") - self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") - self.driver.Storage.remove_file("/system/etc/init/listen_test.json") - self.driver.Storage.remove_file("/system/bin/ondemand") - self.log.info("done") +import os \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_010.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_010.json index f9fe11d66bd7049b7b6f7850e8a08adede5eb2f0..67b186e59bd9a2fe8ea209d01ba73906efe43128 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_010.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_010.json @@ -1,16 +1,3 @@ { - "description": "hypium自测试用例", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "testcases/level1/lifecycle/lifecycle_state_010.py" - ] - }, - "kits":[] - } \ No newline at end of file + "description": "hypium自测试用例" +} \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_010.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_010.py index 34d53b2b971b0abd20aea7873afa8e498fcfa71e..4c677816309a3d588bc49ae8fb519b0d3a9232b8 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_010.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_010.py @@ -14,118 +14,4 @@ # 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, get_report_dir -from hypium import UiExplorer -from hypium.action.host import host -from hypium.action.os_hypium.checker import Assert -from hypium.action.os_hypium.device_logger import DeviceLogger, AsyncCommand -from devicetest.utils.file_util import get_resource_path - -sa_lib_test_path = get_resource_path( - "resource/SO_RESOURCE/liblisten_test.z.so", - isdir=None) -sa_lib_ability_c_path = get_resource_path( - "resource/SO_RESOURCE/libtest_audio_ability.z.so", - isdir=None) -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) -sa_listen_cfg_path = get_resource_path( - "resource/level/lifecycle_state_010/listen_test.cfg", - isdir=None) -sa_listen_json_path = get_resource_path( - "resource/level/lifecycle_state_010/listen_test.json", - isdir=None) -sa_ondemand_path = get_resource_path( - "resource/SO_RESOURCE/ondemand", - isdir=None) -sa_tool_path = get_resource_path( - "resource/SO_RESOURCE/TestTool", - isdir=None) - -class LifeCycle_State_010(TestCase): - - def __init__(self, controllers): - sele.TAG = self.__class__.__name__ - TestCase.__init__(self, self.TAG, controllers) - self.tests = [ - "test_step" - ] - self.driver = UiExplore(self.driver1) - self.sn = self.driver1.device_sn - - def setup(self): - driver = self.driver - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) - host.shell("hdc -t {} target mount".format(self.sn)) - driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) - - driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) - - driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) - - driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) - - driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) - - driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) - - driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") - host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) - driver.System.reboot() - - def test_step(self): - driver = self.driver - # 用例步骤 - # 1、执行push_bat脚本, 推入测试资源 - # 2、执行"hdc shell"命令, 进入shell命令行 - # 3、执行"ondemand"命令, 执行测试程序 - # 4、输入"ondemand", 进入测试模式 - # 5、输入任意字符后回车, 开始执行test case - # 6、再打开一个cmd用来查看hilog, 执行hilog | grep "SA Scheduler" - # 预期结果 - # 控制台打印: OnLoadSystemAbilitySuccesss systemAbilityId:1494 打印五次 - # Hilog打印: - # [SA Scheduler][SA: 1494] loaded - #清理日志 - driver.shell('hilog -r') - # 开始保存日志 - device_logger = DeviceLogger(driver).set_filter_string("Scheduler SA:1494") - device_logger.start_log(get_report_dir() + '//lifecycle_state_010_txt') - log_path = os.path.join(self.get_case_report_path(), "lifecycle_state_010_txt") - command = AsyncCommand(driver).set_output_file(log_path) - command.start_device_command("ondemand test") - time.sleep(130) - # 停止后台命令 - command.stop() - # 停止日志 - device_logger.stop_log() - # 断言 - # 检查日志输出 - countResult = Disk_drop_log.count_keys_disk_dropping_logs(self.get_case_report_path(), - "OnLoadSystemAbilitySuccesss systemAbilityId:1494") - assert countResult >= 23 - device_logger.check_log("Scheduler SA:1494 loaded", EXCEPTION=True) - device_logger.check_log("Scheduler SA:1494 not loaded", EXCEPTION=True) - - log_check_result = device_logger.check_log("Scheduler SA:1494 loaded", EXCEPTION=True) - Assert.equal(self, log_check_result1, True) - - def teardown(self): - self.driver.System.execute_command("kill -9 `pidof listen_test`") - self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") - self.driver.Storage.remove_file("/system/etc/init/listen_test.json") - self.driver.Storage.remove_file("/system/bin/ondemand") - self.log.info("done") +import os \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_021.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_021.json index 565d75c5a124fe59b98133de13ec3c5ea6c23c39..67b186e59bd9a2fe8ea209d01ba73906efe43128 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_021.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_021.json @@ -1,16 +1,3 @@ { - "description": "hypium自测试用例", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "testcases/level1/lifecycle/lifecycle_state_021.py" - ] - }, - "kits":[] - } \ No newline at end of file + "description": "hypium自测试用例" +} \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_021.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_021.py index 9b8cd3cb5f625a2c5c18d4d8ea4ed4e0cbd385d1..df1907304fa6a39aa31e34838c86bfb0c4e9e3b8 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_021.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_021.py @@ -15,97 +15,7 @@ # limitations under the License. import os -import time -from devicetest.core.test_case import TestCase, get_report_dir -from hypium import UiExplore -from hypium.action.host import host -from hypium.action.os_hypium.checker import Assert -from hypium.action.os_hypium.device_logger import DeviceLogger, AsyncCommand -from devicetest.utils.file.file_util import get_resource_path -sa_lib_test_path = get_resource_path( - "resource/SO_RESOURCE/liblisten_test.z.so", - isdir=None) - -sa_lib_ability_c_path = get_resource_path( - "resource/SO_RESOURCE/libtest_audio_ability.z.so", - isdir=None) - -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) - -sa_listen_cfg_path = get_resource_path( - "resource/level/lifecycle_state_021/listen_test.cfg", - isdir=None) - -sa_listen_json_path = get_resource_path( - "resource/level/lifecycle_state_021/listen_test.json", - isdir=None) - -sa_ondemand_path = get_resource_path( - "resource/SO_RESOURCE/ondemand", - isdir=None) - -sa_tool_path = get_resource_path( - "resource/SO_RESOURCE/TestTool", - isdir=None) - - -class LifeCycle_State_021(TestCase): - - def __init__(self, controllers): - sele.TAG = self.__class__.__name__ - TestCase.__init__(self, self.TAG, controllers) - self.tests = [ - "test_step" - ] - self.driver = UiExplore(self.driver1) - self.sn = self.driver1.device_sn - - def setup(self): - driver = self.driver - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) - # host.shell("hdc -t {} target mount".format(self.sn)) - # driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - # host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - # host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) - # driver.System.reboot() - - def test_step(self): - # 步骤 "ondemand test 21"命令,执行测试程序 - # 预期结果 - # 控制台打印: GetSystemAbility systemAbilityId:1494 faild - driver = self.driver - result = driver.System.execute_command("ondemand test 21") - assert "GetSystemAbility systemAbilityId:1494 faild" in result - - def teardown(self): - self.driver.System.execute_command("kill -9 `pidof listen_test`") - #self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - #self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - #self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - #self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") - #self.driver.Storage.remove_file("/system/etc/init/listen_test.json") - #self.driver.Storage.remove_file("/system/bin/ondemand") - self.log.info("done") diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_022.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_022.json index 0a6fbf9b920e8231c0101fa087607926c1a4135f..67b186e59bd9a2fe8ea209d01ba73906efe43128 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_022.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_022.json @@ -1,16 +1,3 @@ { - "description": "hypium自测试用例", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "testcases/level1/lifecycle/lifecycle_state_022.py" - ] - }, - "kits":[] - } \ No newline at end of file + "description": "hypium自测试用例" +} \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_022.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_022.py index e38b132e20e00fcd1669491cf4190221e795ab33..df1907304fa6a39aa31e34838c86bfb0c4e9e3b8 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_022.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_022.py @@ -15,110 +15,6 @@ # limitations under the License. import os -import time - -from devicetest.core.test_case import TestCase, get_report_dir -from hypium import UiExplore -from hypium.action.host import host - -from hypium.action.os_hypium.checker import Assert -from hypium.action.os_hypium.device_logger import DeviceLogger, AsyncCommand -from devicetest.utils.file.file_util import get_resource_path - - -sa_lib_test_path = get_resource_path( - "resource/SO_RESOURCE/liblisten_test.z.so", - isdir=None) - -sa_lib_ability_c_path = get_resource_path( - "resource/SO_RESOURCE/libtest_audio_ability.z.so", - isdir=None) - -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) - -sa_listen_cfg_path = get_resource_path( - "resource/level/lifecycle_state_022/listen_test.cfg", - isdir=None) - -sa_listen_json_path = get_resource_path( - "resource/level/lifecycle_state_022/listen_test.json", - isdir=None) - -sa_ondemand_path = get_resource_path( - "resource/SO_RESOURCE/ondemand", - isdir=None) - -sa_tool_path = get_resource_path( - "resource/SO_RESOURCE/TestTool", - isdir=None) - - -class LifeCycle_State_022(TestCase): - - def __init__(self, controllers): - sele.TAG = self.__class__.__name__ - TestCase.__init__(self, self.TAG, controllers) - self.tests = [ - "test_step" - ] - self.driver = UiExplore(self.driver1) - self.sn = self.driver1.device_sn - - def setup(self): - driver = self.driver - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) - # host.shell("hdc -t {} target mount".format(self.sn)) - # driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - # host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - # host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) - # driver.System.reboot() - - def test_step(self): - driver = self.driver - # 用例同步 - # 执行"ondemand test 24"命令, 执行测试程序 - # 预期结果 - # 控制台打印: - # GetSystemAbility result: success - driver.shell('hilog -r') - # 开始保存日志 - device_logger = DeviceLogger(driver).set_filter_string("Scheduler SA:1494") - device_logger.start_log(get_report_dir() + 'lifecycle_state_022_txt') - result = driver.System.execute_command("ondemand test 22") - assert "GetSystemAbility systemAbilityId:1494 faild" in result - # 停止日志 - device_logger.stop_log() - # 检查日志输出 - device_logger.check_log("Scheduler SA:1494 loaded", EXCEPTION=True) - - def teardown(self): - self.driver.System.execute_command("kill -9 `pidof listen_test`") - #self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - #self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - #self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - #self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") - #self.driver.Storage.remove_file("/system/etc/init/listen_test.json") - #self.driver.Storage.remove_file("/system/bin/ondemand") - self.log.info("done") diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_023.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_023.json index 6f311ec00a68f39157d38bcb806209ac1767c11a..67b186e59bd9a2fe8ea209d01ba73906efe43128 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_023.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_023.json @@ -1,16 +1,3 @@ { - "description": "hypium自测试用例", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "testcases/level1/lifecycle/lifecycle_state_023.py" - ] - }, - "kits":[] - } \ No newline at end of file + "description": "hypium自测试用例" +} \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_023.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_023.py index 7a158da7b1e262a04ff6c1e3d782fd5b7add037a..df1907304fa6a39aa31e34838c86bfb0c4e9e3b8 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_023.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_023.py @@ -15,97 +15,7 @@ # limitations under the License. import os -import time -from devicetest.core.test_case import TestCase -from devicetest.utils.file.file_util import get_resource_path -from hypium import UiExplore -from hypium.action.host import host -from hypium.action.os_hypium.device_logger import AsyncCommand -sa_lib_test_path = get_resource_path( - "resource/SO_RESOURCE/liblisten_test.z.so", - isdir=None) -sa_lib_ability_c_path = get_resource_path( - "resource/SO_RESOURCE/libtest_audio_ability.z.so", - isdir=None) - -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) - -sa_listen_cfg_path = get_resource_path( - "resource/level/lifecycle_state_023/listen_test.cfg", - isdir=None) - -sa_listen_json_path = get_resource_path( - "resource/level/lifecycle_state_023/listen_test.json", - isdir=None) - -sa_ondemand_path = get_resource_path( - "resource/SO_RESOURCE/ondemand", - isdir=None) - -sa_tool_path = get_resource_path( - "resource/SO_RESOURCE/TestTool", - isdir=None) - - -class LifeCycle_State_023(TestCase): - - def __init__(self, controllers): - sele.TAG = self.__class__.__name__ - TestCase.__init__(self, self.TAG, controllers) - self.tests = [ - "test_step" - ] - self.driver = UiExplore(self.driver1) - self.sn = self.driver1.device_sn - - def setup(self): - driver = self.driver - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) - # host.shell("hdc -t {} target mount".format(self.sn)) - # driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - # host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - # host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) - # driver.System.reboot() - - def test_step(self): - driver = self.driver - # 用例同步 - # 执行"ondemand test 24"命令, 执行测试程序 - # 预期结果 - # 控制台打印: - # GetSystemAbility result: success - result = driver.System.execute_command("ondemand test 23") - assert "GetSystemAbility systemAbilityId:1494 faild" in result - - def teardown(self): - self.driver.System.execute_command("kill -9 `pidof listen_test`") - self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") - self.driver.Storage.remove_file("/system/etc/init/listen_test.json") - self.driver.Storage.remove_file("/system/bin/ondemand") - self.log.info("done") \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_024.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_024.json index fc00a077713132b64422303d0c5f2128c931810a..67b186e59bd9a2fe8ea209d01ba73906efe43128 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_024.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_024.json @@ -1,16 +1,3 @@ { - "description": "hypium自测试用例", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "testcases/level1/lifecycle/lifecycle_state_024.py" - ] - }, - "kits":[] - } \ No newline at end of file + "description": "hypium自测试用例" +} \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_024.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_024.py index 6bfb7238986bdff08efb1c9189fa1cc3670df8f2..df1907304fa6a39aa31e34838c86bfb0c4e9e3b8 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_024.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_024.py @@ -15,97 +15,7 @@ # limitations under the License. import os -import time -from devicetest.core.test_case import TestCase -from devicetest.utils.file.file_util import get_resource_path -from hypium import UiExplore -from hypium.action.host import host -from hypium.action.os_hypium.device_logger import AsyncCommand -sa_lib_test_path = get_resource_path( - "resource/SO_RESOURCE/liblisten_test.z.so", - isdir=None) -sa_lib_ability_c_path = get_resource_path( - "resource/SO_RESOURCE/libtest_audio_ability.z.so", - isdir=None) - -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) - -sa_listen_cfg_path = get_resource_path( - "resource/level/lifecycle_state_024/listen_test.cfg", - isdir=None) - -sa_listen_json_path = get_resource_path( - "resource/level/lifecycle_state_024/listen_test.json", - isdir=None) - -sa_ondemand_path = get_resource_path( - "resource/SO_RESOURCE/ondemand", - isdir=None) - -sa_tool_path = get_resource_path( - "resource/SO_RESOURCE/TestTool", - isdir=None) - - -class LifeCycle_State_024(TestCase): - - def __init__(self, controllers): - sele.TAG = self.__class__.__name__ - TestCase.__init__(self, self.TAG, controllers) - self.tests = [ - "test_step" - ] - self.driver = UiExplore(self.driver1) - self.sn = self.driver1.device_sn - - def setup(self): - driver = self.driver - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) - # host.shell("hdc -t {} target mount".format(self.sn)) - # driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - # host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - # host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) - # driver.System.reboot() - - def test_step(self): - driver = self.driver - # 用例同步 - # 执行"ondemand test 24"命令, 执行测试程序 - # 预期结果 - # 控制台打印: - # GetSystemAbility result: success - result = driver.System.execute_command("ondemand test 24") - assert "GetSystemAbility systemAbilityId:1494 faild" in result - - def teardown(self): - self.driver.System.execute_command("kill -9 `pidof listen_test`") - self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") - self.driver.Storage.remove_file("/system/etc/init/listen_test.json") - self.driver.Storage.remove_file("/system/bin/ondemand") - self.log.info("done") \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_025.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_025.json index 20c0df83f35c78f70696d705740d314116a8e6c7..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_025.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_025.json @@ -1,16 +0,0 @@ -{ - "description": "hypium自测试用例", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "testcases/level1/lifecycle/lifecycle_state_025.py" - ] - }, - "kits":[] - } \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_025.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_025.py index 0a7419e5e39b09810ed208018b7181a4c1780c1f..df1907304fa6a39aa31e34838c86bfb0c4e9e3b8 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_025.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_025.py @@ -16,99 +16,6 @@ import os -from devicetest.core.test_case import TestCase -#导入时间 -import time -from devicetest.utils.file.file_util import get_resource_path -from hypium import UiExplore -from hypium.action.host import host -from hypium.action.os_hypium.device_logger import AsyncCommand -sa_lib_test_path = get_resource_path( - "resource/SO_RESOURCE/liblisten_test.z.so", - isdir=None) - -sa_lib_ability_c_path = get_resource_path( - "resource/SO_RESOURCE/libtest_audio_ability.z.so", - isdir=None) - -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) - -sa_listen_cfg_path = get_resource_path( - "resource/level/lifecycle_state_025/listen_test.cfg", - isdir=None) - -sa_listen_json_path = get_resource_path( - "resource/level/lifecycle_state_025/listen_test.json", - isdir=None) - -sa_ondemand_path = get_resource_path( - "resource/SO_RESOURCE/ondemand", - isdir=None) - -sa_tool_path = get_resource_path( - "resource/SO_RESOURCE/TestTool", - isdir=None) - - -class LifeCycle_State_025(TestCase): - - def __init__(self, controllers): - sele.TAG = self.__class__.__name__ - TestCase.__init__(self, self.TAG, controllers) - self.tests = [ - "test_step" - ] - self.driver = UiExplore(self.driver1) - self.sn = self.driver1.device_sn - - def setup(self): - driver = self.driver - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) - # host.shell("hdc -t {} target mount".format(self.sn)) - # driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - # host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - # host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) - # driver.System.reboot() - - def test_step(self): - driver = self.driver - # 用例同步 - # 执行"ondemand test 24"命令, 执行测试程序 - # 预期结果 - # 控制台打印: - # GetSystemAbility result: success - result = driver.System.execute_command("ondemand test 25") - assert "GetSystemAbility systemAbilityId:1494 faild" in result - - def teardown(self): - self.driver.System.execute_command("kill -9 `pidof listen_test`") - self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") - self.driver.Storage.remove_file("/system/etc/init/listen_test.json") - self.driver.Storage.remove_file("/system/bin/ondemand") - self.log.info("done") - diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_026.json b/test/autotest/testcases/level1/lifecycle/lifecycle_state_026.json index 0a781e3a3e7c51ffcc100cb628a143edfe0e35a6..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_026.json +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_026.json @@ -1,16 +0,0 @@ -{ - "description": "hypium自测试用例", - "environment": [ - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "testcases/level1/lifecycle/lifecycle_state_026.py" - ] - }, - "kits":[] - } \ No newline at end of file diff --git a/test/autotest/testcases/level1/lifecycle/lifecycle_state_026.py b/test/autotest/testcases/level1/lifecycle/lifecycle_state_026.py index 50caf381e802558bd288537dc5e59e627398dc95..df1907304fa6a39aa31e34838c86bfb0c4e9e3b8 100644 --- a/test/autotest/testcases/level1/lifecycle/lifecycle_state_026.py +++ b/test/autotest/testcases/level1/lifecycle/lifecycle_state_026.py @@ -19,160 +19,3 @@ import os -#!/usr/bin/env python3 -#-*- coding: utf-8 -*- - -# Copyright (c) 2024 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import time - -from hypium import UiExplore -from hypium.action.host import host -from hypium.action.os_hypium.device_logger import DeviceLogger -from devicetest.core.test_case import TestCase, CheckPoint, get_report_dir -from devicetest.utils.file.file_util import get_resource_path - -sa_lib_test_path = get_resource_path( - "resource/SO_RESOURCE/liblisten_test.z.so", - isdir=None) - -sa_lib_ability_c_path = get_resource_path( - "resource/SO_RESOURCE/libtest_audio_ability.z.so", - isdir=None) - -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) - -sa_listen_cfg_path = get_resource_path( - "resource/level/lifecycle_state_026/listen_test.cfg", - isdir=None) - -sa_listen_json_path = get_resource_path( - "resource/level/lifecycle_state_026/listen_test.json", - isdir=None) - -sa_ondemand_path = get_resource_path( - "resource/SO_RESOURCE/ondemand", - isdir=None) - -sa_tool_path = get_resource_path( - "resource/SO_RESOURCE/TestTool", - isdir=None) - -sa_samgr_path = get_resource_path( - "resource/level/lifecycle/lifecycle_state_026/samgr.para", - isdir=None) - -sa_samgr_dac_path = get_resource_path( - "resource/level/lifecycle/lifecycle_state_026/samgr.para.dac", - isdir=None) - -sa_para_origin = get_resource_path( - "resource/origin_file/samgr.para", isdir=None) - -sa_para_dac_origin = get_resource_path( - "resource/origin_file/samgr.para.dac", isdir=None) - -class LifeCycle_State_026(TestCase): - - def __init__(self, controllers): - sele.TAG = self.__class__.__name__ - TestCase.__init__(self, self.TAG, controllers) - self.tests = [ - "test_step" - ] - self.driver = UiExplore(self.driver1) - self.sn = self.driver1.device_sn - - def setup(self): - driver = self.driver - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn)) - # host.shell("hdc -t {} target mount".format(self.sn)) - # driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") - # host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - # host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - # host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_tool_path, device_path="/systemlib/bin/") - # host.shell("hdc -t {} shell chmod 755 /system/bin/TestTool".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_samgr_path, device_path="/systemlib/etc/param") - # host.shell("hdc -t {} shell chmod 755 /system/etc/param/samgr.para".format(self.sn)) - - # driver.Storage.push_file(local_path=sa_samgr_dac_path, device_path="/systemlib/etc/param") - # host.shell("hdc -t {} shell chmod 755 /system/etc/param/samgr.para.dac".format(self.sn)) - # driver.System.reboot() - - def test_step(self): - driver = self.driver - # 用例同步 - # 执行"ondemand test 24"命令, 执行测试程序 - # 预期结果 - # 控制台打印: - # GetSystemAbility result: success - result = driver.System.execute_command("ondemand test 26") - assert "GetSystemAbility systemAbilityId:1494 faild" in result - # 1、打开日志目录 - # 2、关闭wifi (20s后卸载) - # 3、等待5s, hidumper -ls查看1494存在 - # 4、打开wifi出发加载, 移除延时卸载 - # 5、等待15s后hidumper -ls查看1494是否存在 - # 6、停止日志落盘, 查看Scheduler SA:1494 rm delay unlaod event - # - # driver = selef.driver - #device_logger = DeviceLogger(driver).set_filter_string("Scheduler") - #device_logger.start_log(get_report_dir() + '//lifecycle_state_026.txt') - # 打开WiFi - #driver.wifi.enable() - #time.sleep(10) - # #关闭WiFi - #driver.wifi.disable() - #time.sleep(5) - # #打开WiFi - #driver.wifi.enable() - #time.sleep(15) - #device_logger.stop_log() - #log_check_result = device_logger.check_log("Scheduler SA:1494 rm delay unlaod event", EXCEPTION=False) - #assert log_check_result is True - #result = driver.System.execute_command("hidumper -ls") - #assert "1494" in result - - def teardown(self): - self.driver.System.execute_command("kill -9 `pidof listen_test`") - self.driver.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - self.driver.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - self.driver.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - self.driver.Storage.remove_file("/system/etc/init/listen_test.cfg") - self.driver.Storage.remove_file("/system/etc/init/listen_test.json") - self.driver.Storage.remove_file("/system/bin/ondemand") - self.driver.Storage.remove_file("/system/etc/param/samgr.para") - self.driver.Storage.remove_file("/system/etc/param/samgr.para.dac") - self.driver.Storage.push_file(local_path=sa_para_origin, device_path="/systemlib/etc/param") - self.driver.Storage.push_file(local_path=sa_para_dac_origin, device_path="/systemlib/etc/param") - self.log.info("清理动作: 关闭设置") - diff --git a/test/autotest/testcases/level1/networking/sub_samgr_sa_load_002.json b/test/autotest/testcases/level1/networking/sub_samgr_sa_load_002.json index c66143c40996e1b4fad1b316d9d0fcc5150bd939..67b186e59bd9a2fe8ea209d01ba73906efe43128 100644 --- a/test/autotest/testcases/level1/networking/sub_samgr_sa_load_002.json +++ b/test/autotest/testcases/level1/networking/sub_samgr_sa_load_002.json @@ -1,20 +1,3 @@ { - "description": "hypium自测试用例", - "environment": [ - { - "type": "device", - "label": "phone" - }, - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "testcases/level1/lifecycle/sub_samgr_sa_load_002.py" - ] - }, - "kits":[] - } \ No newline at end of file + "description": "hypium自测试用例" +} \ No newline at end of file diff --git a/test/autotest/testcases/level1/networking/sub_samgr_sa_load_002.py b/test/autotest/testcases/level1/networking/sub_samgr_sa_load_002.py index fd28f67891131fb739e8be11043e6c45a798816e..075418a7866520ab28b61f638694cf5b5f677bc0 100644 --- a/test/autotest/testcases/level1/networking/sub_samgr_sa_load_002.py +++ b/test/autotest/testcases/level1/networking/sub_samgr_sa_load_002.py @@ -15,136 +15,3 @@ # limitations under the License. import os -import time - -from devicetest.core.test_case import TestCase, setup, CheckPoint -from devicetest.utils.file.file_util import get_resource_path -from hypium import * -from hypium.action.host import host - -from aw import NetWorking - -sa_listen_cfg_path = get_resource_path( - "resource/level/networking/sub_samgr_sa_load_002/listen_test.cfg", - isdir=None) - -sa_listen_json_path = get_resource_path( - "resource/level/networking/sub_samgr_sa_load_002/listen_test.json", - isdir=None) - -sa_lib_test_path = get_resource_path( - "resource/SO_RESOURCE/liblisten_test.z.so", - isdir=None) - -sa_lib_ability_c_path = get_resource_path( - "resource/SO_RESOURCE/libtest_audio_ability.z.so", - isdir=None) - -sa_ondemand_path = get_resource_path( - "resource/SO_RESOURCE/ondemand", - isdir=None) - -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) - - -class Sub_Samgr_SA_Load_002(TestCase): - - def __init__(self, configs): - sele.TAG = self.__class__.__name__ - TestCase.__init__(self, self.TAG, configs) - self.driver1 = UiDriver(self.device1) - self.driver1 = UiDriver(self.device2) - self.sn1 = self.device1.device_sn - self.sn1 = self.device2.device_sn - - def setup(self): - driver1 = self.driver1 - driver1 = self.driver1 - # host.shell()用来在pc端执行shell命令,亦可直接执行bat脚本(bat脚本中是push所需要的测试文件) - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn1)) - host.shell("hdc -t {} target mount".format(self.sn1)) - driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn1)) - - driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn1)) - - driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn1) - - driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn1)) - - driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn1)) - - driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn1)) - - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn2)) - host.shell("hdc -t {} target mount".format(self.sn2)) - driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn2)) - - driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn2)) - - driver.Storage.push_file(local_path=sa_lib_ability_c_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_audio_ability.z.so".format(self.sn2) - - driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn2)) - - driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn2)) - - driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn2)) - - # # 设备A登录华为账号 - NetWorking.login_account(driver1) - # # 设备b登录华为账号 - NetWorking.login_account(driver2) - time.sleep(3) - #判断组网成功 - NetWorking.determine_newwork(driver1) - - def process(self): - driver1 = self.driver1 - driver2 = self.driver2 - # 步骤 - # 1、准备两台手机,通过wifi组上网络(自己手机开热点) - # 2、执行ondemand小包分别推测试文件到手机中 - # 3、执行hdc shell - # 4、执行ondemand, 然后执行sa,load, 1494 - - #预期结果 - # 5、本端设备cmd窗口显示succed, 远端设备通过hidumper -ls查找1494 - - driver1.System.execute_command("ondemand sa load 1494") - result1 = driver1.System.execute_command("hidumper -ls ") - assert "1494" in result1 - # 远端设备也查询到 - result2 = driver1.System.execute_command("hidumper -ls ") - assert "1494" in result2 - - def teardown(self): - self.driver.System.execute_command("kill -9 `pidof listen_test`") - host.shell("hdc -t {} target mount".format(self.sn1)) - self.driver1.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - self.driver1.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - self.driver1Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - self.driver1.Storage.remove_file("/system/etc/init/listen_test.cfg") - self.driver1.Storage.remove_file("/system/etc/init/listen_test.json") - self.driver1.Storage.remove_file("/system/bin/ondemand") - - host.shell("hdc -t {} target mount".format(self.sn2)) - self.driver2.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - self.driver2.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - self.driver2.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - self.driver2.Storage.remove_file("/system/etc/init/listen_test.cfg") - self.driver2.Storage.remove_file("/system/etc/init/listen_test.json") - self.driver2.Storage.remove_file("/system/bin/ondemand") - self.log.info("done") \ No newline at end of file diff --git a/test/autotest/testcases/level1/networking/sub_samgr_sa_once_001.json b/test/autotest/testcases/level1/networking/sub_samgr_sa_once_001.json index 947357d19cc33393e108e5259149492b63593173..67b186e59bd9a2fe8ea209d01ba73906efe43128 100644 --- a/test/autotest/testcases/level1/networking/sub_samgr_sa_once_001.json +++ b/test/autotest/testcases/level1/networking/sub_samgr_sa_once_001.json @@ -1,20 +1,3 @@ { - "description": "hypium自测试用例", - "environment": [ - { - "type": "device", - "label": "phone" - }, - { - "type": "device", - "label": "phone" - } - ], - "driver": { - "type": "DeviceTest", - "py_file": [ - "testcases/level1/lifecycle/sub_samgr_sa_once_001.py" - ] - }, - "kits":[] - } \ No newline at end of file + "description": "hypium自测试用例" +} \ No newline at end of file diff --git a/test/autotest/testcases/level1/networking/sub_samgr_sa_once_001.py b/test/autotest/testcases/level1/networking/sub_samgr_sa_once_001.py index dda9e322525706ff20fb6c583f89ca496fd42e79..075418a7866520ab28b61f638694cf5b5f677bc0 100644 --- a/test/autotest/testcases/level1/networking/sub_samgr_sa_once_001.py +++ b/test/autotest/testcases/level1/networking/sub_samgr_sa_once_001.py @@ -15,153 +15,3 @@ # limitations under the License. import os -import time - -from devicetest.core.test_case import TestCase -from devicetest.utils.file.file_util import get_resource_path -from hypium import * -from hypium.action.host import host - -from aw import NetWorking - -sa_listen_cfg_path = get_resource_path( - "resource/level/networking/sub_samgr_sa_load_002/listen_test.cfg", - isdir=None) - -sa_listen_json_path = get_resource_path( - "resource/level/networking/sub_samgr_sa_load_002/listen_test.json", - isdir=None) - -sa_lib_test_path = get_resource_path( - "resource/SO_RESOURCE/liblisten_test.z.so", - isdir=None) - -sa_lib_ability_c_path = get_resource_path( - "resource/SO_RESOURCE/libtest_audio_ability.z.so", - isdir=None) - -sa_ondemand_path = get_resource_path( - "resource/SO_RESOURCE/ondemand", - isdir=None) - -sa_proxy_path = get_resource_path( - "resource/SO_RESOURCE/libtest_sa_proxy_cache.z.so", - isdir=None) - - -class Sub_Samgr_SA_Load_002(TestCase): - - def __init__(self, configs): - sele.TAG = self.__class__.__name__ - TestCase.__init__(self, self.TAG, configs) - self.driver1 = UiDriver(self.device1) - self.driver1 = UiDriver(self.device2) - self.sn1 = self.device1.device_sn - self.sn1 = self.device2.device_sn - - def setup(self): - driver = self.driver1 - driver.Wifi.disable() - driver.Bluetooth.disable() #避免开始就组网成功 - # host.shell()用来在pc端执行shell命令,亦可直接执行bat脚本(bat脚本中是push所需要的测试文件) - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn1)) - # 推入资源文件进入设备 - host.shell("hdc -t {} target mount".format(self.sn1)) - driver.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn1)) - - driver.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn1)) - - driver.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn1)) - - driver.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn2)) - - driver.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn1)) - - driver2 = self.driver2 - host.shell("hdc -t {} shell kill -9 `pidof listen_test`".format(self.sn2)) - # 推入资源文件进入设备 - host.shell("hdc -t {} target mount".format(self.sn2)) - driver2.Storage.push_file(local_path=sa_lib_test_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/liblisten_test.z.so".format(self.sn2)) - - driver2.Storage.push_file(local_path=sa_listen_cfg_path, device_path="/system/etc/init/") - host.shell("hdc -t {} shell chmod 644 /system/etc/init/listen_test.cfg".format(self.sn2)) - - driver2.Storage.push_file(local_path=sa_listen_json_path, device_path="/system/profile/") - host.shell("hdc -t {} shell chmod 644 /system/profile/listen_test.json".format(self.sn2)) - - driver2.Storage.push_file(local_path=sa_ondemand_path, device_path="/systemlib/bin/") - host.shell("hdc -t {} shell chmod 755 /system/bin/ondemand".format(self.sn2)) - - driver2.Storage.push_file(local_path=sa_proxy_path, device_path="/systemlib/lib/") - host.shell("hdc -t {} shell chmod 644 /system/lib/lib/libtest_sa_proxy_cache.z.so".format(self.sn2)) - - driver.System.reboot() - driver2.System.reboot() - - - def process(self): - # 执行步骤 - #1、执行push.bat脚本, 推入once - online测试资源 - #2、组网后hidumper-ls查看 - #3、wifi断开后hidumper -ls再次查看 - #4、组网后hidumper-ls再次查看 - #5、wifi断开后hidumper -ls再次查看 - - # 预期结果 - #1、DistributedDeviceProfile存在 - #2、20s后DistributedDeviceProfile不存在 - #3、DistributedDeviceProfile存在 - #4、DistributedDeviceProfile存在 - - #3 - # 设备A断开wifi蓝牙 - driver.wifi.disable() - driver.Bluetooth.disable() - time.sleep(25) - # 判断组网成功 - NetWorking.determine_newwork(driver) - result = driver1.System.execute_command("hidumper -ls ") - assert "1494" in result - - #4 - driver.wifi.disable() - driver.Bluetooth.disable() - time.sleep(50) - # 判断组网成功 - NetWorking.determine_newwork(driver) - result = driver1.System.execute_command("hidumper -ls ") - assert "1494" in result - - #5 - # 设备A断开蓝牙wifi - driver.wifi.disable() - driver.Bluetooth.disable() - time.sleep(25) - result = driver1.System.execute_command("hidumper -ls ") - assert "1494" in result - - def teardown(self): - self.driver1.System.execute_command("kill -9 `pidof listen_test`") - host.shell("hdc -t {} target mount".format(self.sn1)) - self.driver1.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - self.driver1.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - self.driver1Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - self.driver1.Storage.remove_file("/system/etc/init/listen_test.cfg") - self.driver1.Storage.remove_file("/system/etc/init/listen_test.json") - self.driver1.Storage.remove_file("/system/bin/ondemand") - - self.driver2.System.execute_command("kill -9 `pidof listen_test`") - host.shell("hdc -t {} target mount".format(self.sn2)) - self.driver2.Storage.remove_file("/system/lib/lib/liblisten_test.z.so") - self.driver2.Storage.remove_file("/system/lib/lib/libtest_sa_proxy_cache.z.so") - self.driver2.Storage.remove_file("/system/lib/lib/libtest_audio_ability.z.so") - self.driver2.Storage.remove_file("/system/etc/init/listen_test.cfg") - self.driver2.Storage.remove_file("/system/etc/init/listen_test.json") - self.driver2.Storage.remove_file("/system/bin/ondemand") - self.log.info("done") \ No newline at end of file