!1147 解决continue_manager异常

Merge pull request !1147 from 师皓杰/master
This commit is contained in:
openharmony_ci 2024-10-28 09:31:49 +00:00 committed by Gitee
commit bfee80e7cf
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 90 additions and 4 deletions

View File

@ -657,8 +657,6 @@ ohos_unittest("dschedcontinuestatetest") {
module_out_path = module_output_path
cflags = [ "-Dprivate=public" ]
sources = [
"unittest/continue/dsched_continue_event_test.cpp",
"unittest/continue/dsched_continue_manager_test.cpp",
"unittest/continue/dsched_continue_state_test.cpp",
"unittest/continue/dsched_continue_test.cpp",
"unittest/continue/mock_dtbschedmgr_device_info.cpp",
@ -680,6 +678,31 @@ ohos_unittest("dschedcontinuestatetest") {
subsystem_name = "ability"
}
ohos_unittest("dschedcontinuemanagerstatetest") {
module_out_path = module_output_path
cflags = [ "-Dprivate=public" ]
sources = [
"unittest/continue/dsched_continue_event_test.cpp",
"unittest/continue/dsched_continue_manager_test.cpp",
"unittest/continue/mock_dtbschedmgr_device_info.cpp",
"unittest/mock_distributed_sched.cpp",
]
sources += dtbschedmgr_sources
configs = [
":test_config",
"${dms_path}/services/dtbschedmgr/test/resource:coverage_flags",
]
configs += dsched_configs
deps = []
if (is_standard_system) {
external_deps = dsched_external_deps
public_deps = dsched_public_deps
}
external_deps += [ "googletest:gmock" ]
part_name = "dmsfwk"
subsystem_name = "ability"
}
ohos_unittest("distributedeventtest") {
sanitize = {
cfi = true
@ -751,6 +774,7 @@ group("unittest") {
":dmsbasetest",
":dmsfreeinstallcbtest",
":dschedconnecttest",
":dschedcontinuemanagerstatetest",
":dschedcontinuestatetest",
":dschedcontinuetest",
":dschedswitchstatustest",

View File

@ -413,6 +413,9 @@ HWTEST_F(DSchedContinueDataStateTest, SinkExecuteTest001, TestSize.Level3)
};
int32_t ret = dataStateTest_->Execute(nullptr, AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_EQ(ret, CONTINUE_STATE_MACHINE_INVALID_STATE);
ret = dataStateTest_->Execute(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueDataStateTest SinkExecuteTest001 end" << std::endl;
}
@ -471,6 +474,9 @@ HWTEST_F(DSchedContinueDataStateTest, SinkDoContinueDataTask001, TestSize.Level3
};
int32_t ret = dataStateTest_->DoContinueDataTask(nullptr, AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_NE(ret, DSCHED_CONTINUE_DATA_STATE);
ret = dataStateTest_->DoContinueDataTask(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueDataStateTest SinkDoContinueDataTask001 end" << std::endl;
}
@ -493,6 +499,9 @@ HWTEST_F(DSchedContinueDataStateTest, SinkDoContinueEndTask001, TestSize.Level3)
};
int32_t ret = dataStateTest_->DoContinueEndTask(nullptr, AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_NE(ret, ERR_OK);
ret = dataStateTest_->DoContinueEndTask(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueDataStateTest SinkDoContinueEndTask001 end" << std::endl;
}
@ -515,6 +524,9 @@ HWTEST_F(DSchedContinueDataStateTest, SinkDoContinueErrorTask001, TestSize.Level
};
int32_t ret = dataStateTest_->DoContinueErrorTask(nullptr, AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_NE(ret, ERR_OK);
ret = dataStateTest_->DoContinueErrorTask(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueDataStateTest SinkDoContinueErrorTask001 end" << std::endl;
}
@ -766,6 +778,9 @@ HWTEST_F(DSchedContinueSinkWaitEndStateTest, SinkExecute001, TestSize.Level3)
};
int32_t ret = sinkWaitEndTest_->Execute(nullptr, AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_EQ(ret, CONTINUE_STATE_MACHINE_INVALID_STATE);
ret = sinkWaitEndTest_->Execute(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueSinkWaitEndStateTest SinkExecute001 end" << std::endl;
}
@ -826,6 +841,9 @@ HWTEST_F(DSchedContinueSinkWaitEndStateTest, SinkDoNotifyCompleteTask001, TestSi
int32_t ret = sinkWaitEndTest_->DoNotifyCompleteTask(nullptr,
AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
ret = sinkWaitEndTest_->DoNotifyCompleteTask(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueSinkWaitEndStateTest SinkDoNotifyCompleteTask001 end" << std::endl;
}
@ -849,6 +867,9 @@ HWTEST_F(DSchedContinueSinkWaitEndStateTest, SinkDoContinueEndTask001, TestSize.
int32_t ret = sinkWaitEndTest_->DoContinueEndTask(nullptr,
AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
ret = sinkWaitEndTest_->DoContinueEndTask(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueSinkWaitEndStateTest SinkDoContinueEndTask001 end" << std::endl;
}
@ -871,6 +892,9 @@ HWTEST_F(DSchedContinueAbilityStateTest, SrcExecuteTest001, TestSize.Level3)
};
int32_t ret = abilityStateTest_->Execute(nullptr, AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_EQ(ret, CONTINUE_STATE_MACHINE_INVALID_STATE);
ret = abilityStateTest_->Execute(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueAbilityStateTest SrcExecuteTest001 end" << std::endl;
}
@ -929,6 +953,9 @@ HWTEST_F(DSchedContinueAbilityStateTest, SrcDoContinueSendTask001, TestSize.Leve
};
int32_t ret = abilityStateTest_->DoContinueSendTask(nullptr, AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
ret = abilityStateTest_->DoContinueSendTask(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueAbilityStateTest SrcDoContinueSendTask001 end" << std::endl;
}
@ -951,6 +978,9 @@ HWTEST_F(DSchedContinueAbilityStateTest, SrcDoContinueEndTask001, TestSize.Level
};
int32_t ret = abilityStateTest_->DoContinueEndTask(nullptr, AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
ret = abilityStateTest_->DoContinueEndTask(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueAbilityStateTest SrcDoContinueEndTask001 end" << std::endl;
}
@ -973,6 +1003,9 @@ HWTEST_F(DSchedContinueAbilityStateTest, SrcDoContinueErrorTask001, TestSize.Lev
};
int32_t ret = abilityStateTest_->DoContinueErrorTask(nullptr, AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_NE(ret, ERR_OK);
ret = abilityStateTest_->DoContinueErrorTask(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueAbilityStateTest SrcDoContinueErrorTask001 end" << std::endl;
}
@ -995,6 +1028,9 @@ HWTEST_F(DSchedContinueEndStateTest, SrcExecuteTest001, TestSize.Level3)
};
int32_t ret = srcEndStateTest_->Execute(nullptr, AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_EQ(ret, CONTINUE_STATE_MACHINE_INVALID_STATE);
ret = srcEndStateTest_->Execute(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueEndStateTest SrcExecuteTest001 end" << std::endl;
}
@ -1053,6 +1089,9 @@ HWTEST_F(DSchedContinueEndStateTest, SrcDoContinueEndTaskTest001, TestSize.Level
};
int32_t ret = srcEndStateTest_->DoContinueEndTask(nullptr, AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
ret = srcEndStateTest_->DoContinueEndTask(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueEndStateTest SrcDoContinueEndTaskTest001 end" << std::endl;
}
@ -1075,6 +1114,9 @@ HWTEST_F(DSchedContinueSourceStartStateTest, SrcExecuteTest_001, TestSize.Level3
};
int32_t ret = srcStartStateTest_->Execute(nullptr, AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_EQ(ret, CONTINUE_STATE_MACHINE_INVALID_STATE);
ret = srcStartStateTest_->Execute(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueSourceStartStateTest SrcExecuteTest_001 end" << std::endl;
}
@ -1134,6 +1176,9 @@ HWTEST_F(DSchedContinueSourceStartStateTest, SrcDoContinuePushReqTaskTest_001, T
int32_t ret = srcStartStateTest_->DoContinuePushReqTask(nullptr,
AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
ret = srcStartStateTest_->DoContinuePushReqTask(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueSourceStartStateTest SrcDoContinuePushReqTaskTest_001 end" << std::endl;
}
@ -1157,6 +1202,9 @@ HWTEST_F(DSchedContinueSourceStartStateTest, SrcDoContinueAbilityTaskTest_001, T
int32_t ret = srcStartStateTest_->DoContinueAbilityTask(nullptr,
AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
ret = srcStartStateTest_->DoContinueAbilityTask(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueSourceStartStateTest SrcDoContinueAbilityTaskTest_001 end" << std::endl;
}
@ -1180,6 +1228,9 @@ HWTEST_F(DSchedContinueSourceStartStateTest, SrcDoContinueEndTaskTest_001, TestS
int32_t ret = srcStartStateTest_->DoContinueEndTask(nullptr,
AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
ret = srcStartStateTest_->DoContinueEndTask(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueSourceStartStateTest SrcDoContinueEndTaskTest_001 end" << std::endl;
}
@ -1202,6 +1253,9 @@ HWTEST_F(DSchedContinueSourceStartStateTest, SrcDoContinueErrorTask001, TestSize
};
int32_t ret = srcStartStateTest_->DoContinueErrorTask(nullptr, AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_NE(ret, ERR_OK);
ret = srcStartStateTest_->DoContinueEndTask(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueSourceStartStateTest SrcDoContinueErrorTask001 end" << std::endl;
}
@ -1224,6 +1278,9 @@ HWTEST_F(DSchedContinueWaitEndStateTest, SrcExecute_001, TestSize.Level3)
};
int32_t ret = srcWaitEndTest_->Execute(nullptr, AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_EQ(ret, CONTINUE_STATE_MACHINE_INVALID_STATE);
ret = srcWaitEndTest_->Execute(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueWaitEndStateTest SrcExecute_001 end" << std::endl;
}
@ -1283,6 +1340,9 @@ HWTEST_F(DSchedContinueWaitEndStateTest, SrcDoNotifyCompleteTask_001, TestSize.L
int32_t ret = srcWaitEndTest_->DoNotifyCompleteTask(nullptr,
AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
ret = srcWaitEndTest_->DoNotifyCompleteTask(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueWaitEndStateTest SrcDoNotifyCompleteTask_001 end" << std::endl;
}
@ -1306,6 +1366,9 @@ HWTEST_F(DSchedContinueWaitEndStateTest, SrcDoContinueEndTask_001, TestSize.Leve
int32_t ret = srcWaitEndTest_->DoContinueEndTask(nullptr,
AppExecFwk::InnerEvent::Pointer(event, destructor));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
ret = srcWaitEndTest_->DoContinueEndTask(nullptr, AppExecFwk::InnerEvent::Pointer(nullptr, nullptr));
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueWaitEndStateTest SrcDoContinueEndTask_001 end" << std::endl;
}
@ -1415,4 +1478,4 @@ HWTEST_F(DSchedContinueStateMachineTest, GetStateType_001, TestSize.Level3)
DTEST_LOG << "DSchedContinueStateMachineTest GetStateType_001 end" << std::endl;
}
}
}
}

View File

@ -2311,7 +2311,6 @@ HWTEST_F(DMSMissionManagerTest, testStartSyncMissionsFromRemote002, TestSize.Lev
DistributedSchedMissionManager::GetInstance().missonChangeListener_ = new DistributedMissionChangeListener();
DistributedSchedMissionManager::GetInstance().GenerateCallerInfo(callerInfo);
DistributedSchedMissionManager::GetInstance().isRegMissionChange_ = true;
EXPECT_CALL(*mockDmsAdapter, GetLocalMissionSnapshotInfo(_, _, _)).WillOnce(Return(true));
auto ret = DistributedSchedMissionManager::GetInstance().StartSyncMissionsFromRemote(callerInfo, missionInfos);
EXPECT_EQ(ret, ERR_NONE);
DTEST_LOG << "testStartSyncMissionsFromRemote002 end" << std::endl;