1f6603c60Sopenharmony_ci/* 2f6603c60Sopenharmony_ci * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3f6603c60Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4f6603c60Sopenharmony_ci * you may not use this file except in compliance with the License. 5f6603c60Sopenharmony_ci * You may obtain a copy of the License at 6f6603c60Sopenharmony_ci * 7f6603c60Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8f6603c60Sopenharmony_ci * 9f6603c60Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10f6603c60Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11f6603c60Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12f6603c60Sopenharmony_ci * See the License for the specific language governing permissions and 13f6603c60Sopenharmony_ci * limitations under the License. 14f6603c60Sopenharmony_ci * 15f6603c60Sopenharmony_ci * Description : common function for samgr api test cases 16f6603c60Sopenharmony_ci * Create : 2020/07/23 17f6603c60Sopenharmony_ci */ 18f6603c60Sopenharmony_ci 19f6603c60Sopenharmony_ci#include "SamgrApiTest.h" 20f6603c60Sopenharmony_ci#include "gtest/gtest.h" 21f6603c60Sopenharmony_ci#include "log.h" 22f6603c60Sopenharmony_ci#include <unistd.h> 23f6603c60Sopenharmony_ci#include <cstdio> 24f6603c60Sopenharmony_ci#include <csignal> 25f6603c60Sopenharmony_ci#include <feature.h> 26f6603c60Sopenharmony_ci#include <ohos_init.h> 27f6603c60Sopenharmony_ci#include <samgr_lite.h> 28f6603c60Sopenharmony_ci#include <securec.h> 29f6603c60Sopenharmony_ci 30f6603c60Sopenharmony_ciusing namespace std; 31f6603c60Sopenharmony_ciusing namespace testing::ext; 32f6603c60Sopenharmony_ci 33f6603c60Sopenharmony_cistatic int g_initIndex = 0; 34f6603c60Sopenharmony_cistatic int g_coreInit[API_PRI_MAX] = {0}; 35f6603c60Sopenharmony_cistatic int g_sysRun[API_PRI_MAX] = {0}; 36f6603c60Sopenharmony_cistatic int g_sysServiceInit[API_PRI_MAX] = {0}; 37f6603c60Sopenharmony_cistatic int g_sysFeatureInit[API_PRI_MAX] = {0}; 38f6603c60Sopenharmony_cistatic int g_sysExServiceInit[API_PRI_MAX] = {0}; 39f6603c60Sopenharmony_cistatic int g_sysExFeatureInit[API_PRI_MAX] = {0}; 40f6603c60Sopenharmony_cistatic int g_appServiceInit[API_PRI_MAX] = {0}; 41f6603c60Sopenharmony_cistatic int g_appFeatureInit[API_PRI_MAX] = {0}; 42f6603c60Sopenharmony_ci 43f6603c60Sopenharmony_cistatic void PrintInitIndex(const int initArr[]) 44f6603c60Sopenharmony_ci{ 45f6603c60Sopenharmony_ci for (int i = 0; i < API_PRI_MAX; i++) { 46f6603c60Sopenharmony_ci if (i == API_PRI_DEFAULT) { 47f6603c60Sopenharmony_ci HILOG_INFO(HILOG_MODULE_HIVIEW, "default: %d", initArr[i]); 48f6603c60Sopenharmony_ci continue; 49f6603c60Sopenharmony_ci } 50f6603c60Sopenharmony_ci HILOG_INFO(HILOG_MODULE_HIVIEW, "%d: %d", i, initArr[i]); 51f6603c60Sopenharmony_ci } 52f6603c60Sopenharmony_ci} 53f6603c60Sopenharmony_ci 54f6603c60Sopenharmony_cistatic void CoreInitDef(void) 55f6603c60Sopenharmony_ci{ 56f6603c60Sopenharmony_ci g_coreInit[API_PRI_DEFAULT] = g_initIndex++; 57f6603c60Sopenharmony_ci} 58f6603c60Sopenharmony_ci 59f6603c60Sopenharmony_cistatic void CoreInit0(void) 60f6603c60Sopenharmony_ci{ 61f6603c60Sopenharmony_ci g_coreInit[API_PRI0] = g_initIndex++; 62f6603c60Sopenharmony_ci} 63f6603c60Sopenharmony_cistatic void CoreInit1(void) 64f6603c60Sopenharmony_ci{ 65f6603c60Sopenharmony_ci g_coreInit[API_PRI1] = g_initIndex++; 66f6603c60Sopenharmony_ci} 67f6603c60Sopenharmony_cistatic void CoreInit2(void) 68f6603c60Sopenharmony_ci{ 69f6603c60Sopenharmony_ci g_coreInit[API_PRI2] = g_initIndex++; 70f6603c60Sopenharmony_ci} 71f6603c60Sopenharmony_cistatic void CoreInit3(void) 72f6603c60Sopenharmony_ci{ 73f6603c60Sopenharmony_ci g_coreInit[API_PRI3] = g_initIndex++; 74f6603c60Sopenharmony_ci} 75f6603c60Sopenharmony_cistatic void CoreInit4(void) 76f6603c60Sopenharmony_ci{ 77f6603c60Sopenharmony_ci g_coreInit[API_PRI4] = g_initIndex++; 78f6603c60Sopenharmony_ci} 79f6603c60Sopenharmony_ci 80f6603c60Sopenharmony_cistatic void SysRunDef(void) 81f6603c60Sopenharmony_ci{ 82f6603c60Sopenharmony_ci g_sysRun[API_PRI_DEFAULT] = g_initIndex++; 83f6603c60Sopenharmony_ci} 84f6603c60Sopenharmony_cistatic void SysRun0(void) 85f6603c60Sopenharmony_ci{ 86f6603c60Sopenharmony_ci g_sysRun[API_PRI0] = g_initIndex++; 87f6603c60Sopenharmony_ci} 88f6603c60Sopenharmony_cistatic void SysRun1(void) 89f6603c60Sopenharmony_ci{ 90f6603c60Sopenharmony_ci g_sysRun[API_PRI1] = g_initIndex++; 91f6603c60Sopenharmony_ci} 92f6603c60Sopenharmony_cistatic void SysRun2(void) 93f6603c60Sopenharmony_ci{ 94f6603c60Sopenharmony_ci g_sysRun[API_PRI2] = g_initIndex++; 95f6603c60Sopenharmony_ci} 96f6603c60Sopenharmony_cistatic void SysRun3(void) 97f6603c60Sopenharmony_ci{ 98f6603c60Sopenharmony_ci g_sysRun[API_PRI3] = g_initIndex++; 99f6603c60Sopenharmony_ci} 100f6603c60Sopenharmony_cistatic void SysRun4(void) 101f6603c60Sopenharmony_ci{ 102f6603c60Sopenharmony_ci g_sysRun[API_PRI4] = g_initIndex++; 103f6603c60Sopenharmony_ci} 104f6603c60Sopenharmony_ci 105f6603c60Sopenharmony_cistatic void SysServiceInitDef(void) 106f6603c60Sopenharmony_ci{ 107f6603c60Sopenharmony_ci g_sysServiceInit[API_PRI_DEFAULT] = g_initIndex++; 108f6603c60Sopenharmony_ci} 109f6603c60Sopenharmony_cistatic void SysServiceInit0(void) 110f6603c60Sopenharmony_ci{ 111f6603c60Sopenharmony_ci g_sysServiceInit[API_PRI0] = g_initIndex++; 112f6603c60Sopenharmony_ci} 113f6603c60Sopenharmony_cistatic void SysServiceInit1(void) 114f6603c60Sopenharmony_ci{ 115f6603c60Sopenharmony_ci g_sysServiceInit[API_PRI1] = g_initIndex++; 116f6603c60Sopenharmony_ci} 117f6603c60Sopenharmony_cistatic void SysServiceInit2(void) 118f6603c60Sopenharmony_ci{ 119f6603c60Sopenharmony_ci g_sysServiceInit[API_PRI2] = g_initIndex++; 120f6603c60Sopenharmony_ci} 121f6603c60Sopenharmony_cistatic void SysServiceInit3(void) 122f6603c60Sopenharmony_ci{ 123f6603c60Sopenharmony_ci g_sysServiceInit[API_PRI3] = g_initIndex++; 124f6603c60Sopenharmony_ci} 125f6603c60Sopenharmony_cistatic void SysServiceInit4(void) 126f6603c60Sopenharmony_ci{ 127f6603c60Sopenharmony_ci g_sysServiceInit[API_PRI4] = g_initIndex++; 128f6603c60Sopenharmony_ci} 129f6603c60Sopenharmony_ci 130f6603c60Sopenharmony_cistatic void SysFeatureInitDef(void) 131f6603c60Sopenharmony_ci{ 132f6603c60Sopenharmony_ci g_sysFeatureInit[API_PRI_DEFAULT] = g_initIndex++; 133f6603c60Sopenharmony_ci} 134f6603c60Sopenharmony_cistatic void SysFeatureInit0(void) 135f6603c60Sopenharmony_ci{ 136f6603c60Sopenharmony_ci g_sysFeatureInit[API_PRI0] = g_initIndex++; 137f6603c60Sopenharmony_ci} 138f6603c60Sopenharmony_cistatic void SysFeatureInit1(void) 139f6603c60Sopenharmony_ci{ 140f6603c60Sopenharmony_ci g_sysFeatureInit[API_PRI1] = g_initIndex++; 141f6603c60Sopenharmony_ci} 142f6603c60Sopenharmony_cistatic void SysFeatureInit2(void) 143f6603c60Sopenharmony_ci{ 144f6603c60Sopenharmony_ci g_sysFeatureInit[API_PRI2] = g_initIndex++; 145f6603c60Sopenharmony_ci} 146f6603c60Sopenharmony_cistatic void SysFeatureInit3(void) 147f6603c60Sopenharmony_ci{ 148f6603c60Sopenharmony_ci g_sysFeatureInit[API_PRI3] = g_initIndex++; 149f6603c60Sopenharmony_ci} 150f6603c60Sopenharmony_cistatic void SysFeatureInit4(void) 151f6603c60Sopenharmony_ci{ 152f6603c60Sopenharmony_ci g_sysFeatureInit[API_PRI4] = g_initIndex++; 153f6603c60Sopenharmony_ci} 154f6603c60Sopenharmony_ci 155f6603c60Sopenharmony_cistatic void SysExSerInitDef(void) 156f6603c60Sopenharmony_ci{ 157f6603c60Sopenharmony_ci g_sysExServiceInit[API_PRI_DEFAULT] = g_initIndex++; 158f6603c60Sopenharmony_ci} 159f6603c60Sopenharmony_cistatic void SysExSerInit0(void) 160f6603c60Sopenharmony_ci{ 161f6603c60Sopenharmony_ci g_sysExServiceInit[API_PRI0] = g_initIndex++; 162f6603c60Sopenharmony_ci} 163f6603c60Sopenharmony_cistatic void SysExSerInit1(void) 164f6603c60Sopenharmony_ci{ 165f6603c60Sopenharmony_ci g_sysExServiceInit[API_PRI1] = g_initIndex++; 166f6603c60Sopenharmony_ci} 167f6603c60Sopenharmony_cistatic void SysExSerInit2(void) 168f6603c60Sopenharmony_ci{ 169f6603c60Sopenharmony_ci g_sysExServiceInit[API_PRI2] = g_initIndex++; 170f6603c60Sopenharmony_ci} 171f6603c60Sopenharmony_cistatic void SysExSerInit3(void) 172f6603c60Sopenharmony_ci{ 173f6603c60Sopenharmony_ci g_sysExServiceInit[API_PRI3] = g_initIndex++; 174f6603c60Sopenharmony_ci} 175f6603c60Sopenharmony_cistatic void SysExSerInit4(void) 176f6603c60Sopenharmony_ci{ 177f6603c60Sopenharmony_ci g_sysExServiceInit[API_PRI4] = g_initIndex++; 178f6603c60Sopenharmony_ci} 179f6603c60Sopenharmony_ci 180f6603c60Sopenharmony_cistatic void SysExFeaInitDef(void) 181f6603c60Sopenharmony_ci{ 182f6603c60Sopenharmony_ci g_sysExFeatureInit[API_PRI_DEFAULT] = g_initIndex++; 183f6603c60Sopenharmony_ci} 184f6603c60Sopenharmony_cistatic void SysExFeaInit0(void) 185f6603c60Sopenharmony_ci{ 186f6603c60Sopenharmony_ci g_sysExFeatureInit[API_PRI0] = g_initIndex++; 187f6603c60Sopenharmony_ci} 188f6603c60Sopenharmony_cistatic void SysExFeaInit1(void) 189f6603c60Sopenharmony_ci{ 190f6603c60Sopenharmony_ci g_sysExFeatureInit[API_PRI1] = g_initIndex++; 191f6603c60Sopenharmony_ci} 192f6603c60Sopenharmony_cistatic void SysExFeaInit2(void) 193f6603c60Sopenharmony_ci{ 194f6603c60Sopenharmony_ci g_sysExFeatureInit[API_PRI2] = g_initIndex++; 195f6603c60Sopenharmony_ci} 196f6603c60Sopenharmony_cistatic void SysExFeaInit3(void) 197f6603c60Sopenharmony_ci{ 198f6603c60Sopenharmony_ci g_sysExFeatureInit[API_PRI3] = g_initIndex++; 199f6603c60Sopenharmony_ci} 200f6603c60Sopenharmony_cistatic void SysExFeaInit4(void) 201f6603c60Sopenharmony_ci{ 202f6603c60Sopenharmony_ci g_sysExFeatureInit[API_PRI4] = g_initIndex++; 203f6603c60Sopenharmony_ci} 204f6603c60Sopenharmony_ci 205f6603c60Sopenharmony_cistatic void AppServiceInitDef(void) 206f6603c60Sopenharmony_ci{ 207f6603c60Sopenharmony_ci g_appServiceInit[API_PRI_DEFAULT] = g_initIndex++; 208f6603c60Sopenharmony_ci} 209f6603c60Sopenharmony_cistatic void AppServiceInit0(void) 210f6603c60Sopenharmony_ci{ 211f6603c60Sopenharmony_ci g_appServiceInit[API_PRI0] = g_initIndex++; 212f6603c60Sopenharmony_ci} 213f6603c60Sopenharmony_cistatic void AppServiceInit1(void) 214f6603c60Sopenharmony_ci{ 215f6603c60Sopenharmony_ci g_appServiceInit[API_PRI1] = g_initIndex++; 216f6603c60Sopenharmony_ci} 217f6603c60Sopenharmony_cistatic void AppServiceInit2(void) 218f6603c60Sopenharmony_ci{ 219f6603c60Sopenharmony_ci g_appServiceInit[API_PRI2] = g_initIndex++; 220f6603c60Sopenharmony_ci} 221f6603c60Sopenharmony_cistatic void AppServiceInit3(void) 222f6603c60Sopenharmony_ci{ 223f6603c60Sopenharmony_ci g_appServiceInit[API_PRI3] = g_initIndex++; 224f6603c60Sopenharmony_ci} 225f6603c60Sopenharmony_cistatic void AppServiceInit4(void) 226f6603c60Sopenharmony_ci{ 227f6603c60Sopenharmony_ci g_appServiceInit[API_PRI4] = g_initIndex++; 228f6603c60Sopenharmony_ci} 229f6603c60Sopenharmony_ci 230f6603c60Sopenharmony_cistatic void AppFeatureInitDef(void) 231f6603c60Sopenharmony_ci{ 232f6603c60Sopenharmony_ci g_appFeatureInit[API_PRI_DEFAULT] = g_initIndex++; 233f6603c60Sopenharmony_ci} 234f6603c60Sopenharmony_cistatic void AppFeatureInit0(void) 235f6603c60Sopenharmony_ci{ 236f6603c60Sopenharmony_ci g_appFeatureInit[API_PRI0] = g_initIndex++; 237f6603c60Sopenharmony_ci} 238f6603c60Sopenharmony_cistatic void AppFeatureInit1(void) 239f6603c60Sopenharmony_ci{ 240f6603c60Sopenharmony_ci g_appFeatureInit[API_PRI1] = g_initIndex++; 241f6603c60Sopenharmony_ci} 242f6603c60Sopenharmony_cistatic void AppFeatureInit2(void) 243f6603c60Sopenharmony_ci{ 244f6603c60Sopenharmony_ci g_appFeatureInit[API_PRI2] = g_initIndex++; 245f6603c60Sopenharmony_ci} 246f6603c60Sopenharmony_cistatic void AppFeatureInit3(void) 247f6603c60Sopenharmony_ci{ 248f6603c60Sopenharmony_ci g_appFeatureInit[API_PRI3] = g_initIndex++; 249f6603c60Sopenharmony_ci} 250f6603c60Sopenharmony_cistatic void AppFeatureInit4(void) 251f6603c60Sopenharmony_ci{ 252f6603c60Sopenharmony_ci g_appFeatureInit[API_PRI4] = g_initIndex++; 253f6603c60Sopenharmony_ci} 254f6603c60Sopenharmony_ci 255f6603c60Sopenharmony_ci// 接口注册后的启动顺序依赖hos_init.h中的定义的数字大小 256f6603c60Sopenharmony_ci 257f6603c60Sopenharmony_ci// 第0个执行,内部按照0~4优先级执行,default优先级为2 258f6603c60Sopenharmony_ciCORE_INIT(CoreInitDef); 259f6603c60Sopenharmony_ciCORE_INIT_PRI(CoreInit0, 0); 260f6603c60Sopenharmony_ciCORE_INIT_PRI(CoreInit1, 1); 261f6603c60Sopenharmony_ciCORE_INIT_PRI(CoreInit4, 4); 262f6603c60Sopenharmony_ciCORE_INIT_PRI(CoreInit2, 2); 263f6603c60Sopenharmony_ciCORE_INIT_PRI(CoreInit3, 3); 264f6603c60Sopenharmony_ci 265f6603c60Sopenharmony_ci// 最后一个执行,内部按照0~4优先级执行,default优先级为2 266f6603c60Sopenharmony_ciSYS_RUN(SysRunDef); 267f6603c60Sopenharmony_ciSYS_RUN_PRI(SysRun0, 0); 268f6603c60Sopenharmony_ciSYS_RUN_PRI(SysRun1, 1); 269f6603c60Sopenharmony_ciSYS_RUN_PRI(SysRun4, 4); 270f6603c60Sopenharmony_ciSYS_RUN_PRI(SysRun2, 2); 271f6603c60Sopenharmony_ciSYS_RUN_PRI(SysRun3, 3); 272f6603c60Sopenharmony_ci 273f6603c60Sopenharmony_ci// 第1个执行,内部按照0~4优先级执行,default优先级为2 274f6603c60Sopenharmony_ciSYS_SERVICE_INIT(SysServiceInitDef); 275f6603c60Sopenharmony_ciSYS_SERVICE_INIT_PRI(SysServiceInit0, 0); 276f6603c60Sopenharmony_ciSYS_SERVICE_INIT_PRI(SysServiceInit1, 1); 277f6603c60Sopenharmony_ciSYS_SERVICE_INIT_PRI(SysServiceInit4, 4); 278f6603c60Sopenharmony_ciSYS_SERVICE_INIT_PRI(SysServiceInit2, 2); 279f6603c60Sopenharmony_ciSYS_SERVICE_INIT_PRI(SysServiceInit3, 3); 280f6603c60Sopenharmony_ci 281f6603c60Sopenharmony_ci// 第2个执行,内部按照0~4优先级执行,default优先级为2 282f6603c60Sopenharmony_ciSYS_FEATURE_INIT(SysFeatureInitDef); 283f6603c60Sopenharmony_ciSYS_FEATURE_INIT_PRI(SysFeatureInit0, 0); 284f6603c60Sopenharmony_ciSYS_FEATURE_INIT_PRI(SysFeatureInit2, 2); 285f6603c60Sopenharmony_ciSYS_FEATURE_INIT_PRI(SysFeatureInit1, 1); 286f6603c60Sopenharmony_ciSYS_FEATURE_INIT_PRI(SysFeatureInit3, 3); 287f6603c60Sopenharmony_ciSYS_FEATURE_INIT_PRI(SysFeatureInit4, 4); 288f6603c60Sopenharmony_ci 289f6603c60Sopenharmony_ci// 第3个执行,注意和APP_SERVICE_INIT_XXX并列,谁先注册先执行谁,内部按照0~4优先级执行,default优先级为2 290f6603c60Sopenharmony_ciSYSEX_SERVICE_INIT(SysExSerInitDef); 291f6603c60Sopenharmony_ciSYSEX_SERVICE_INIT_PRI(SysExSerInit0, 0); 292f6603c60Sopenharmony_ciSYSEX_SERVICE_INIT_PRI(SysExSerInit1, 1); 293f6603c60Sopenharmony_ciSYSEX_SERVICE_INIT_PRI(SysExSerInit2, 2); 294f6603c60Sopenharmony_ciSYSEX_SERVICE_INIT_PRI(SysExSerInit3, 3); 295f6603c60Sopenharmony_ciSYSEX_SERVICE_INIT_PRI(SysExSerInit4, 4); 296f6603c60Sopenharmony_ci 297f6603c60Sopenharmony_ci// 第4个执行,注意和APP_FEATURE_INIT_XXX并列,谁先注册先执行谁,内部按照0~4优先级执行,default优先级为2 298f6603c60Sopenharmony_ciSYSEX_FEATURE_INIT(SysExFeaInitDef); 299f6603c60Sopenharmony_ciSYSEX_FEATURE_INIT_PRI(SysExFeaInit0, 0); 300f6603c60Sopenharmony_ciSYSEX_FEATURE_INIT_PRI(SysExFeaInit1, 1); 301f6603c60Sopenharmony_ciSYSEX_FEATURE_INIT_PRI(SysExFeaInit2, 2); 302f6603c60Sopenharmony_ciSYSEX_FEATURE_INIT_PRI(SysExFeaInit3, 3); 303f6603c60Sopenharmony_ciSYSEX_FEATURE_INIT_PRI(SysExFeaInit4, 4); 304f6603c60Sopenharmony_ci 305f6603c60Sopenharmony_ci// 第3个执行,注意和SYSEX_SERVICE_INIT_XXX并列,谁先注册先执行谁,内部按照0~4优先级执行,default优先级为2 306f6603c60Sopenharmony_ciAPP_SERVICE_INIT(AppServiceInitDef); 307f6603c60Sopenharmony_ciAPP_SERVICE_INIT_PRI(AppServiceInit0, 0); 308f6603c60Sopenharmony_ciAPP_SERVICE_INIT_PRI(AppServiceInit4, 4); 309f6603c60Sopenharmony_ciAPP_SERVICE_INIT_PRI(AppServiceInit3, 3); 310f6603c60Sopenharmony_ciAPP_SERVICE_INIT_PRI(AppServiceInit2, 2); 311f6603c60Sopenharmony_ciAPP_SERVICE_INIT_PRI(AppServiceInit1, 1); 312f6603c60Sopenharmony_ci 313f6603c60Sopenharmony_ci// 第4个执行,注意和SYSEX_FEATURE_INIT_XXX并列,谁先注册先执行谁,内部按照0~4优先级执行,default优先级为2 314f6603c60Sopenharmony_ciAPP_FEATURE_INIT(AppFeatureInitDef); 315f6603c60Sopenharmony_ciAPP_FEATURE_INIT_PRI(AppFeatureInit0, 0); 316f6603c60Sopenharmony_ciAPP_FEATURE_INIT_PRI(AppFeatureInit1, 1); 317f6603c60Sopenharmony_ciAPP_FEATURE_INIT_PRI(AppFeatureInit3, 3); 318f6603c60Sopenharmony_ciAPP_FEATURE_INIT_PRI(AppFeatureInit4, 4); 319f6603c60Sopenharmony_ciAPP_FEATURE_INIT_PRI(AppFeatureInit2, 2); 320f6603c60Sopenharmony_ci 321f6603c60Sopenharmony_ciclass SamgrApiTest : public testing::Test { 322f6603c60Sopenharmony_ciprotected: 323f6603c60Sopenharmony_ci static void SetUpTestCase(void) {} 324f6603c60Sopenharmony_ci static void TearDownTestCase(void) {} 325f6603c60Sopenharmony_ci virtual void SetUp() {} 326f6603c60Sopenharmony_ci virtual void TearDown() {} 327f6603c60Sopenharmony_ci}; 328f6603c60Sopenharmony_ci 329f6603c60Sopenharmony_ci/** 330f6603c60Sopenharmony_ci * @tc.number : SUB_START_Bootstrap_Samgr_0100 331f6603c60Sopenharmony_ci * @tc.name : check total init index 332f6603c60Sopenharmony_ci * @tc.desc : check total init index, return success 333f6603c60Sopenharmony_ci */ 334f6603c60Sopenharmony_ciHWTEST_F(SamgrApiTest, SUB_START_Bootstrap_Samgr_0100, Function | MediumTest | Level0) 335f6603c60Sopenharmony_ci{ 336f6603c60Sopenharmony_ci HILOG_INFO(HILOG_MODULE_HIVIEW, "[SUB_START_Bootstrap_Samgr_0100:%d]", g_initIndex); 337f6603c60Sopenharmony_ci EXPECT_EQ(g_initIndex, SAMGR_API_GROUP_NUM*SAMGR_API_CALL_NUM); 338f6603c60Sopenharmony_ci} 339f6603c60Sopenharmony_ci 340f6603c60Sopenharmony_ci/** 341f6603c60Sopenharmony_ci * @tc.number : SUB_START_Bootstrap_Samgr_0200 342f6603c60Sopenharmony_ci * @tc.name : check core init index 343f6603c60Sopenharmony_ci * @tc.desc : check core init, return success 344f6603c60Sopenharmony_ci */ 345f6603c60Sopenharmony_ciHWTEST_F(SamgrApiTest, SUB_START_Bootstrap_Samgr_0200, Function | MediumTest | Level0) 346f6603c60Sopenharmony_ci{ 347f6603c60Sopenharmony_ci HILOG_INFO(HILOG_MODULE_HIVIEW, "g_coreInit"); 348f6603c60Sopenharmony_ci PrintInitIndex(g_coreInit); 349f6603c60Sopenharmony_ci EXPECT_EQ(g_coreInit[API_PRI0], GET_INIT_INDEX(CORE_INIT_E, API_PRI0)); 350f6603c60Sopenharmony_ci EXPECT_EQ(g_coreInit[API_PRI1], GET_INIT_INDEX(CORE_INIT_E, API_PRI1)); 351f6603c60Sopenharmony_ci EXPECT_EQ(g_coreInit[API_PRI_DEFAULT], GET_INIT_INDEX(CORE_INIT_E, API_PRI_DEFAULT)); 352f6603c60Sopenharmony_ci EXPECT_EQ(g_coreInit[API_PRI2], GET_INIT_INDEX(CORE_INIT_E, API_PRI2)); 353f6603c60Sopenharmony_ci EXPECT_EQ(g_coreInit[API_PRI3], GET_INIT_INDEX(CORE_INIT_E, API_PRI3)); 354f6603c60Sopenharmony_ci EXPECT_EQ(g_coreInit[API_PRI4], GET_INIT_INDEX(CORE_INIT_E, API_PRI4)); 355f6603c60Sopenharmony_ci} 356f6603c60Sopenharmony_ci 357f6603c60Sopenharmony_ci/** 358f6603c60Sopenharmony_ci * @tc.number : SUB_START_Bootstrap_Samgr_0300 359f6603c60Sopenharmony_ci * @tc.name : check system service init index 360f6603c60Sopenharmony_ci * @tc.desc : check system service init, return success 361f6603c60Sopenharmony_ci */ 362f6603c60Sopenharmony_ciHWTEST_F(SamgrApiTest, SUB_START_Bootstrap_Samgr_0300, Function | MediumTest | Level0) 363f6603c60Sopenharmony_ci{ 364f6603c60Sopenharmony_ci HILOG_INFO(HILOG_MODULE_HIVIEW, "g_sysServiceInit"); 365f6603c60Sopenharmony_ci PrintInitIndex(g_sysServiceInit); 366f6603c60Sopenharmony_ci EXPECT_EQ(g_sysServiceInit[API_PRI0], GET_INIT_INDEX(SYS_SERVICE_INIT_E, API_PRI0)); 367f6603c60Sopenharmony_ci EXPECT_EQ(g_sysServiceInit[API_PRI1], GET_INIT_INDEX(SYS_SERVICE_INIT_E, API_PRI1)); 368f6603c60Sopenharmony_ci EXPECT_EQ(g_sysServiceInit[API_PRI_DEFAULT], GET_INIT_INDEX(SYS_SERVICE_INIT_E, API_PRI_DEFAULT)); 369f6603c60Sopenharmony_ci EXPECT_EQ(g_sysServiceInit[API_PRI2], GET_INIT_INDEX(SYS_SERVICE_INIT_E, API_PRI2)); 370f6603c60Sopenharmony_ci EXPECT_EQ(g_sysServiceInit[API_PRI3], GET_INIT_INDEX(SYS_SERVICE_INIT_E, API_PRI3)); 371f6603c60Sopenharmony_ci EXPECT_EQ(g_sysServiceInit[API_PRI4], GET_INIT_INDEX(SYS_SERVICE_INIT_E, API_PRI4)); 372f6603c60Sopenharmony_ci} 373f6603c60Sopenharmony_ci 374f6603c60Sopenharmony_ci/** 375f6603c60Sopenharmony_ci * @tc.number : SUB_START_Bootstrap_Samgr_0400 376f6603c60Sopenharmony_ci * @tc.name : check system feature init index 377f6603c60Sopenharmony_ci * @tc.desc : check system feature init, return success 378f6603c60Sopenharmony_ci */ 379f6603c60Sopenharmony_ciHWTEST_F(SamgrApiTest, SUB_START_Bootstrap_Samgr_0400, Function | MediumTest | Level0) 380f6603c60Sopenharmony_ci{ 381f6603c60Sopenharmony_ci HILOG_INFO(HILOG_MODULE_HIVIEW, "g_sysFeatureInit"); 382f6603c60Sopenharmony_ci PrintInitIndex(g_sysFeatureInit); 383f6603c60Sopenharmony_ci EXPECT_EQ(g_sysFeatureInit[API_PRI0], GET_INIT_INDEX(SYS_FEATURE_INIT_E, API_PRI0)); 384f6603c60Sopenharmony_ci EXPECT_EQ(g_sysFeatureInit[API_PRI1], GET_INIT_INDEX(SYS_FEATURE_INIT_E, API_PRI1)); 385f6603c60Sopenharmony_ci EXPECT_EQ(g_sysFeatureInit[API_PRI_DEFAULT], GET_INIT_INDEX(SYS_FEATURE_INIT_E, API_PRI_DEFAULT)); 386f6603c60Sopenharmony_ci EXPECT_EQ(g_sysFeatureInit[API_PRI2], GET_INIT_INDEX(SYS_FEATURE_INIT_E, API_PRI2)); 387f6603c60Sopenharmony_ci EXPECT_EQ(g_sysFeatureInit[API_PRI3], GET_INIT_INDEX(SYS_FEATURE_INIT_E, API_PRI3)); 388f6603c60Sopenharmony_ci EXPECT_EQ(g_sysFeatureInit[API_PRI4], GET_INIT_INDEX(SYS_FEATURE_INIT_E, API_PRI4)); 389f6603c60Sopenharmony_ci} 390f6603c60Sopenharmony_ci 391f6603c60Sopenharmony_ci/** 392f6603c60Sopenharmony_ci * @tc.number : SUB_START_Bootstrap_Samgr_0500 393f6603c60Sopenharmony_ci * @tc.name : check system extend service and app service init index 394f6603c60Sopenharmony_ci * @tc.desc : check system extend service and app service init, return success 395f6603c60Sopenharmony_ci */ 396f6603c60Sopenharmony_ciHWTEST_F(SamgrApiTest, SUB_START_Bootstrap_Samgr_0500, Function | MediumTest | Level0) 397f6603c60Sopenharmony_ci{ 398f6603c60Sopenharmony_ci HILOG_INFO(HILOG_MODULE_HIVIEW, "g_sysExServiceInit"); 399f6603c60Sopenharmony_ci PrintInitIndex(g_sysExServiceInit); 400f6603c60Sopenharmony_ci HILOG_INFO(HILOG_MODULE_HIVIEW, "g_appServiceInit"); 401f6603c60Sopenharmony_ci PrintInitIndex(g_appServiceInit); 402f6603c60Sopenharmony_ci EXPECT_EQ(g_sysExServiceInit[API_PRI0], GET_INIT_INDEX(APP_SERVICE_INIT_E, 0)); 403f6603c60Sopenharmony_ci EXPECT_EQ(g_appServiceInit[API_PRI0], GET_INIT_INDEX(APP_SERVICE_INIT_E, 1)); 404f6603c60Sopenharmony_ci EXPECT_EQ(g_sysExServiceInit[API_PRI1], GET_INIT_INDEX(APP_SERVICE_INIT_E, 2)); 405f6603c60Sopenharmony_ci EXPECT_EQ(g_appServiceInit[API_PRI1], GET_INIT_INDEX(APP_SERVICE_INIT_E, 3)); 406f6603c60Sopenharmony_ci EXPECT_EQ(g_sysExServiceInit[API_PRI_DEFAULT], GET_INIT_INDEX(APP_SERVICE_INIT_E, 4)); 407f6603c60Sopenharmony_ci EXPECT_EQ(g_sysExServiceInit[API_PRI2], GET_INIT_INDEX(APP_SERVICE_INIT_E, 5)); 408f6603c60Sopenharmony_ci EXPECT_EQ(g_appServiceInit[API_PRI_DEFAULT], GET_INIT_INDEX(APP_SERVICE_INIT_E, 6)); 409f6603c60Sopenharmony_ci EXPECT_EQ(g_appServiceInit[API_PRI2], GET_INIT_INDEX(APP_SERVICE_INIT_E, 7)); 410f6603c60Sopenharmony_ci EXPECT_EQ(g_sysExServiceInit[API_PRI3], GET_INIT_INDEX(APP_SERVICE_INIT_E, 8)); 411f6603c60Sopenharmony_ci EXPECT_EQ(g_appServiceInit[API_PRI3], GET_INIT_INDEX(APP_SERVICE_INIT_E, 9)); 412f6603c60Sopenharmony_ci EXPECT_EQ(g_sysExServiceInit[API_PRI4], GET_INIT_INDEX(APP_SERVICE_INIT_E, 10)); 413f6603c60Sopenharmony_ci EXPECT_EQ(g_appServiceInit[API_PRI4], GET_INIT_INDEX(APP_SERVICE_INIT_E, 11)); 414f6603c60Sopenharmony_ci} 415f6603c60Sopenharmony_ci 416f6603c60Sopenharmony_ci/** 417f6603c60Sopenharmony_ci * @tc.number : SUB_START_Bootstrap_Samgr_0600 418f6603c60Sopenharmony_ci * @tc.name : check system extend feature and app feature init index 419f6603c60Sopenharmony_ci * @tc.desc : check system extend feature and app feature init, return success 420f6603c60Sopenharmony_ci */ 421f6603c60Sopenharmony_ciHWTEST_F(SamgrApiTest, SUB_START_Bootstrap_Samgr_0600, Function | MediumTest | Level0) 422f6603c60Sopenharmony_ci{ 423f6603c60Sopenharmony_ci HILOG_INFO(HILOG_MODULE_HIVIEW, "g_sysExFeatureInit"); 424f6603c60Sopenharmony_ci PrintInitIndex(g_sysExFeatureInit); 425f6603c60Sopenharmony_ci HILOG_INFO(HILOG_MODULE_HIVIEW, "g_appFeatureInit"); 426f6603c60Sopenharmony_ci PrintInitIndex(g_appFeatureInit); 427f6603c60Sopenharmony_ci EXPECT_EQ(g_sysExFeatureInit[API_PRI0], GET_INIT_INDEX(APP_FEATURE_INIT_E, 0)); 428f6603c60Sopenharmony_ci EXPECT_EQ(g_appFeatureInit[API_PRI0], GET_INIT_INDEX(APP_FEATURE_INIT_E, 1)); 429f6603c60Sopenharmony_ci EXPECT_EQ(g_sysExFeatureInit[API_PRI1], GET_INIT_INDEX(APP_FEATURE_INIT_E, 2)); 430f6603c60Sopenharmony_ci EXPECT_EQ(g_appFeatureInit[API_PRI1], GET_INIT_INDEX(APP_FEATURE_INIT_E, 3)); 431f6603c60Sopenharmony_ci EXPECT_EQ(g_sysExFeatureInit[API_PRI_DEFAULT], GET_INIT_INDEX(APP_FEATURE_INIT_E, 4)); 432f6603c60Sopenharmony_ci EXPECT_EQ(g_sysExFeatureInit[API_PRI2], GET_INIT_INDEX(APP_FEATURE_INIT_E, 5)); 433f6603c60Sopenharmony_ci EXPECT_EQ(g_appFeatureInit[API_PRI_DEFAULT], GET_INIT_INDEX(APP_FEATURE_INIT_E, 6)); 434f6603c60Sopenharmony_ci EXPECT_EQ(g_appFeatureInit[API_PRI2], GET_INIT_INDEX(APP_FEATURE_INIT_E, 7)); 435f6603c60Sopenharmony_ci EXPECT_EQ(g_sysExFeatureInit[API_PRI3], GET_INIT_INDEX(APP_FEATURE_INIT_E, 8)); 436f6603c60Sopenharmony_ci EXPECT_EQ(g_appFeatureInit[API_PRI3], GET_INIT_INDEX(APP_FEATURE_INIT_E, 9)); 437f6603c60Sopenharmony_ci EXPECT_EQ(g_sysExFeatureInit[API_PRI4], GET_INIT_INDEX(APP_FEATURE_INIT_E, 10)); 438f6603c60Sopenharmony_ci EXPECT_EQ(g_appFeatureInit[API_PRI4], GET_INIT_INDEX(APP_FEATURE_INIT_E, 11)); 439f6603c60Sopenharmony_ci} 440f6603c60Sopenharmony_ci 441f6603c60Sopenharmony_ci/** 442f6603c60Sopenharmony_ci * @tc.number : SUB_START_Bootstrap_Samgr_0700 443f6603c60Sopenharmony_ci * @tc.name : check system run index 444f6603c60Sopenharmony_ci * @tc.desc : check system run, return success 445f6603c60Sopenharmony_ci */ 446f6603c60Sopenharmony_ciHWTEST_F(SamgrApiTest, SUB_START_Bootstrap_Samgr_0700, Function | MediumTest | Level0) 447f6603c60Sopenharmony_ci{ 448f6603c60Sopenharmony_ci HILOG_INFO(HILOG_MODULE_HIVIEW, "g_sysRun"); 449f6603c60Sopenharmony_ci PrintInitIndex(g_sysRun); 450f6603c60Sopenharmony_ci EXPECT_EQ(g_sysRun[API_PRI0], GET_INIT_INDEX(SYS_RUN_E, API_PRI0)); 451f6603c60Sopenharmony_ci EXPECT_EQ(g_sysRun[API_PRI1], GET_INIT_INDEX(SYS_RUN_E, API_PRI1)); 452f6603c60Sopenharmony_ci EXPECT_EQ(g_sysRun[API_PRI_DEFAULT], GET_INIT_INDEX(SYS_RUN_E, API_PRI_DEFAULT)); 453f6603c60Sopenharmony_ci EXPECT_EQ(g_sysRun[API_PRI2], GET_INIT_INDEX(SYS_RUN_E, API_PRI2)); 454f6603c60Sopenharmony_ci EXPECT_EQ(g_sysRun[API_PRI3], GET_INIT_INDEX(SYS_RUN_E, API_PRI3)); 455f6603c60Sopenharmony_ci EXPECT_EQ(g_sysRun[API_PRI4], GET_INIT_INDEX(SYS_RUN_E, API_PRI4)); 456f6603c60Sopenharmony_ci} 457