mirror of
https://gitee.com/openharmony/startup_init
synced 2024-11-24 00:30:12 +00:00
parent
c488093930
commit
b6ef25b4e5
@ -127,7 +127,8 @@ void SystemConfig(void)
|
||||
LoadDefaultParams("/system/etc/param/ohos_const", LOAD_PARAM_NORMAL);
|
||||
LoadDefaultParams("/vendor/etc/param", LOAD_PARAM_NORMAL);
|
||||
LoadDefaultParams("/system/etc/param", LOAD_PARAM_ONLY_ADD);
|
||||
|
||||
// load persist params
|
||||
LoadPersistParams();
|
||||
// read config
|
||||
ReadConfig();
|
||||
INIT_LOGI("Parse init config file done.");
|
||||
|
@ -300,7 +300,7 @@ static void DoUmountFstabFile(const struct CmdArgs *ctx, const char *cmdContent)
|
||||
}
|
||||
}
|
||||
|
||||
static const struct CmdTable CMD_TABLE[] = {
|
||||
static const struct CmdTable g_cmdTable[] = {
|
||||
{ "exec ", 1, 10, DoExec },
|
||||
{ "mknode ", 1, 5, DoMakeNode },
|
||||
{ "makedev ", 2, 2, DoMakeDevice },
|
||||
@ -317,6 +317,6 @@ static const struct CmdTable CMD_TABLE[] = {
|
||||
|
||||
const struct CmdTable *GetCmdTable(int *number)
|
||||
{
|
||||
*number = (int)ARRAY_LENGTH(CMD_TABLE);
|
||||
return CMD_TABLE;
|
||||
*number = (int)ARRAY_LENGTH(g_cmdTable);
|
||||
return g_cmdTable;
|
||||
}
|
||||
|
@ -100,9 +100,9 @@ static void ExeuteCmdParamWait(int argc, char *argv[], int start)
|
||||
}
|
||||
int ret = SystemWaitParameter(argv[start], value, timeout);
|
||||
if (ret == 0) {
|
||||
printf("Param wait success ");
|
||||
printf("Param wait success \n");
|
||||
} else {
|
||||
printf("Param wait fail");
|
||||
printf("Param wait fail \n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ typedef enum {
|
||||
|
||||
#define IS_READY_ONLY(name) \
|
||||
((strncmp((name), "const.", strlen("const.")) == 0) || (strncmp((name), "ro.", strlen("ro.")) == 0))
|
||||
#define PARAM_CONST_PREFIX "persist."
|
||||
#define PARAM_PERSIST_PREFIX "persist."
|
||||
|
||||
#define SYS_POWER_CTRL "sys.powerctrl="
|
||||
#define OHOS_CTRL_START "ohos.ctl.start="
|
||||
|
@ -47,7 +47,7 @@ static int SavePersistParam(const WorkSpace *workSpace, const ParamTrieNode *nod
|
||||
if (entry == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (strncmp(entry->data, PARAM_CONST_PREFIX, strlen(PARAM_CONST_PREFIX)) != 0) {
|
||||
if (strncmp(entry->data, PARAM_PERSIST_PREFIX, strlen(PARAM_PERSIST_PREFIX)) != 0) {
|
||||
return 0;
|
||||
}
|
||||
static char name[PARAM_NAME_LEN_MAX] = { 0 };
|
||||
@ -71,7 +71,7 @@ static int BatchSavePersistParam(const WorkSpace *workSpace)
|
||||
PERSIST_SAVE_HANDLE handle;
|
||||
int ret = g_persistWorkSpace.persistParamOps.batchSaveBegin(&handle);
|
||||
PARAM_CHECK(ret == 0, return PARAM_CODE_INVALID_NAME, "Failed to save persist");
|
||||
ParamTrieNode *root = FindTrieNode(workSpace, PARAM_CONST_PREFIX, strlen(PARAM_CONST_PREFIX), NULL);
|
||||
ParamTrieNode *root = FindTrieNode(workSpace, PARAM_PERSIST_PREFIX, strlen(PARAM_PERSIST_PREFIX), NULL);
|
||||
ret = TraversalTrieNode(workSpace, root, SavePersistParam, handle);
|
||||
g_persistWorkSpace.persistParamOps.batchSaveEnd(handle);
|
||||
PARAM_CHECK(ret == 0, return PARAM_CODE_INVALID_NAME, "Save persist param fail");
|
||||
@ -117,10 +117,10 @@ int LoadPersistParam(ParamWorkSpace *workSpace)
|
||||
if (g_persistWorkSpace.persistParamOps.load != NULL) {
|
||||
ret = g_persistWorkSpace.persistParamOps.load(AddPersistParam, &workSpace->paramSpace);
|
||||
PARAM_SET_FLAG(g_persistWorkSpace.flags, WORKSPACE_FLAGS_LOADED);
|
||||
PARAM_CHECK(ret == 0, return ret, "Failed to load persist param");
|
||||
}
|
||||
// 刷新新增的常量到persist
|
||||
BatchSavePersistParam(&workSpace->paramSpace);
|
||||
// save new persist param
|
||||
ret = BatchSavePersistParam(&workSpace->paramSpace);
|
||||
PARAM_CHECK(ret == 0, return ret, "Failed to load persist param");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -133,14 +133,14 @@ PARAM_STATIC void TimerCallbackForSave(ParamTaskPtr timer, void *context)
|
||||
if (!PARAM_TEST_FLAG(g_persistWorkSpace.flags, WORKSPACE_FLAGS_UPDATE)) {
|
||||
return;
|
||||
}
|
||||
BatchSavePersistParam((WorkSpace *)context);
|
||||
(void)BatchSavePersistParam((WorkSpace *)context);
|
||||
}
|
||||
|
||||
int WritePersistParam(ParamWorkSpace *workSpace, const char *name, const char *value)
|
||||
{
|
||||
PARAM_CHECK(workSpace != NULL, return PARAM_CODE_INVALID_PARAM, "Invalid workSpace");
|
||||
PARAM_CHECK(value != NULL && name != NULL, return PARAM_CODE_INVALID_PARAM, "Invalid param");
|
||||
if (strncmp(name, PARAM_CONST_PREFIX, strlen(PARAM_CONST_PREFIX)) != 0) {
|
||||
if (strncmp(name, PARAM_PERSIST_PREFIX, strlen(PARAM_PERSIST_PREFIX)) != 0) {
|
||||
return 0;
|
||||
}
|
||||
if (!PARAM_TEST_FLAG(g_persistWorkSpace.flags, WORKSPACE_FLAGS_LOADED)) {
|
||||
|
@ -21,9 +21,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
int g_testPermissionResult = DAC_RESULT_PERMISSION;
|
||||
static const int THREAD_NUM_TEST = 2;
|
||||
|
||||
static int g_testPermissionResult = DAC_RESULT_PERMISSION;
|
||||
static void ClientCheckParamValue(const char *name, const char *expectValue)
|
||||
{
|
||||
char tmp[PARAM_BUFFER_SIZE] = { 0 };
|
||||
@ -61,8 +59,9 @@ static void *TestSendParamWaitMsg(void *args)
|
||||
|
||||
static void TestForMultiThread()
|
||||
{
|
||||
static const int threadMaxNumer = 2;
|
||||
printf("TestForMultiThread \n");
|
||||
pthread_t tids[THREAD_NUM_TEST + THREAD_NUM_TEST];
|
||||
pthread_t tids[threadMaxNumer + threadMaxNumer];
|
||||
const char *names[] = {
|
||||
"thread.1111.2222.3333.4444.5555",
|
||||
"thread.2222.1111.2222.3333.4444",
|
||||
@ -70,13 +69,13 @@ static void TestForMultiThread()
|
||||
"thread.4444.5555.1111.2222.3333",
|
||||
"thread.5555.1111.2222.3333.4444"
|
||||
};
|
||||
for (size_t i = 0; i < THREAD_NUM_TEST; i++) {
|
||||
for (size_t i = 0; i < threadMaxNumer; i++) {
|
||||
pthread_create(&tids[i], nullptr, TestSendParamSetMsg, (void *)names[i % ARRAY_LENGTH(names)]);
|
||||
}
|
||||
for (size_t i = THREAD_NUM_TEST; i < THREAD_NUM_TEST + THREAD_NUM_TEST; i++) {
|
||||
for (size_t i = threadMaxNumer; i < threadMaxNumer + threadMaxNumer; i++) {
|
||||
pthread_create(&tids[i], nullptr, TestSendParamWaitMsg, (void *)names[i % ARRAY_LENGTH(names)]);
|
||||
}
|
||||
for (size_t i = 0; i < THREAD_NUM_TEST + THREAD_NUM_TEST; i++) {
|
||||
for (size_t i = 0; i < threadMaxNumer + threadMaxNumer; i++) {
|
||||
pthread_join(tids[i], nullptr);
|
||||
}
|
||||
}
|
||||
@ -199,11 +198,11 @@ void TestClient(int index)
|
||||
case 0: {
|
||||
ParamWorkSpace *space = GetClientParamWorkSpace();
|
||||
if (space != nullptr && space->securityLabel != nullptr) {
|
||||
space->securityLabel->cred.uid = TEST_UID;
|
||||
space->securityLabel->cred.gid = TEST_UID;
|
||||
space->securityLabel->cred.uid = 1000; // 1000 test uid
|
||||
space->securityLabel->cred.gid = 1000; // 1000 test gid
|
||||
}
|
||||
}
|
||||
case 1: { // set
|
||||
case 1: { // 1 set test
|
||||
SystemSetParameter(name.c_str(), value.c_str());
|
||||
ClientCheckParamValue(name.c_str(), value.c_str());
|
||||
SystemWaitParameter(name.c_str(), value.c_str(), 1);
|
||||
@ -213,7 +212,7 @@ void TestClient(int index)
|
||||
SystemWaitParameter(name.c_str(), nullptr, 0);
|
||||
break;
|
||||
}
|
||||
case 2: { // find
|
||||
case 2: { // 3 api test
|
||||
ParamHandle handle;
|
||||
uint32_t size = PARAM_BUFFER_SIZE;
|
||||
int ret = SystemFindParameter(name.c_str(), &handle);
|
||||
@ -231,11 +230,11 @@ void TestClient(int index)
|
||||
EXPECT_EQ(strcmp(testBuffer, value.c_str()), 0);
|
||||
break;
|
||||
}
|
||||
case 3: // Traversal
|
||||
case 3: // 3 Traversal test
|
||||
TestParamTraversal();
|
||||
SystemDumpParameters(1);
|
||||
break;
|
||||
case 4: { // watcher
|
||||
case 4: { // 4 watcher test
|
||||
int ret = WatchParamCheck(name.c_str());
|
||||
EXPECT_EQ(ret, 0);
|
||||
ret = WatchParamCheck("&&&&&.test.tttt");
|
||||
@ -246,7 +245,7 @@ void TestClient(int index)
|
||||
TestCmd();
|
||||
break;
|
||||
}
|
||||
case 5: // multi
|
||||
case 5: // 5 multi thread test
|
||||
TestForMultiThread();
|
||||
break;
|
||||
default:
|
||||
|
@ -182,19 +182,19 @@ private:
|
||||
ParamSecurityOps clientParamSercurityOps;
|
||||
};
|
||||
|
||||
HWTEST_F(ParamDacTest, TestDacGetLabel, TestSize.Level1)
|
||||
HWTEST_F(ParamDacTest, TestDacGetLabel, TestSize.Level0)
|
||||
{
|
||||
ParamDacTest test;
|
||||
test.TestDacGetLabel();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamDacTest, TestDacInitLocalLabel, TestSize.Level1)
|
||||
HWTEST_F(ParamDacTest, TestDacInitLocalLabel, TestSize.Level0)
|
||||
{
|
||||
ParamDacTest test;
|
||||
test.TestDacInitLocalLabel();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamDacTest, TestDacLabelEncode, TestSize.Level1)
|
||||
HWTEST_F(ParamDacTest, TestDacLabelEncode, TestSize.Level0)
|
||||
{
|
||||
ParamDacTest test;
|
||||
std::vector<char> buffer;
|
||||
@ -203,13 +203,13 @@ HWTEST_F(ParamDacTest, TestDacLabelEncode, TestSize.Level1)
|
||||
test.TestDecode(&label, buffer);
|
||||
}
|
||||
|
||||
HWTEST_F(ParamDacTest, TestDacCheckFilePermission, TestSize.Level1)
|
||||
HWTEST_F(ParamDacTest, TestDacCheckFilePermission, TestSize.Level0)
|
||||
{
|
||||
ParamDacTest test;
|
||||
test.TestDacCheckFilePermission(PARAM_DEFAULT_PATH"/trigger_test.cfg");
|
||||
}
|
||||
|
||||
HWTEST_F(ParamDacTest, TestDacCheckUserParaPermission, TestSize.Level1)
|
||||
HWTEST_F(ParamDacTest, TestDacCheckUserParaPermission, TestSize.Level0)
|
||||
{
|
||||
// 相同用户
|
||||
ParamDacTest test;
|
||||
@ -250,7 +250,7 @@ HWTEST_F(ParamDacTest, TestDacCheckUserParaPermission, TestSize.Level1)
|
||||
EXPECT_EQ(ret, 0);
|
||||
}
|
||||
|
||||
HWTEST_F(ParamDacTest, TestDacCheckGroupParaPermission, TestSize.Level1)
|
||||
HWTEST_F(ParamDacTest, TestDacCheckGroupParaPermission, TestSize.Level0)
|
||||
{
|
||||
// 相同组
|
||||
ParamDacTest test;
|
||||
@ -291,7 +291,7 @@ HWTEST_F(ParamDacTest, TestDacCheckGroupParaPermission, TestSize.Level1)
|
||||
EXPECT_EQ(ret, 0);
|
||||
}
|
||||
|
||||
HWTEST_F(ParamDacTest, TestDacCheckOtherParaPermission, TestSize.Level1)
|
||||
HWTEST_F(ParamDacTest, TestDacCheckOtherParaPermission, TestSize.Level0)
|
||||
{
|
||||
// 其他用户
|
||||
ParamDacTest test;
|
||||
@ -332,7 +332,7 @@ HWTEST_F(ParamDacTest, TestDacCheckOtherParaPermission, TestSize.Level1)
|
||||
EXPECT_EQ(ret, 0);
|
||||
}
|
||||
|
||||
HWTEST_F(ParamDacTest, TestClientDacCheckFilePermission, TestSize.Level1)
|
||||
HWTEST_F(ParamDacTest, TestClientDacCheckFilePermission, TestSize.Level0)
|
||||
{
|
||||
ParamDacTest test;
|
||||
test.TestClientDacCheckFilePermission(PARAM_DEFAULT_PATH"/trigger_test.cfg");
|
||||
|
@ -32,12 +32,6 @@ extern int RunParamCommand(int argc, char *argv[]);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static const int TEST_UID = 1000;
|
||||
static const int TEST_GID = 9999;
|
||||
static const int TEST_DAC_GID = 2002;
|
||||
static const int TEST_DAC_GID2 = 2003;
|
||||
static const int TEST_READ_AND_WRITE = 0666;
|
||||
|
||||
void TestClient(int index);
|
||||
int TestEncodeSecurityLabel(const ParamSecurityLabel *srcLabel, char *buffer, uint32_t *bufferSize);
|
||||
int TestDecodeSecurityLabel(ParamSecurityLabel **srcLabel, const char *buffer, uint32_t bufferSize);
|
||||
|
@ -40,10 +40,10 @@ extern void TimerCallbackForSave(ParamTaskPtr timer, void *context);
|
||||
}
|
||||
|
||||
static ParamTask *g_worker = nullptr;
|
||||
class ParamServiceTest : public ::testing::Test {
|
||||
class ParamUnitTest : public ::testing::Test {
|
||||
public:
|
||||
ParamServiceTest() {}
|
||||
virtual ~ParamServiceTest() {}
|
||||
ParamUnitTest() {}
|
||||
virtual ~ParamUnitTest() {}
|
||||
|
||||
void SetUp() {}
|
||||
void TearDown() {}
|
||||
@ -81,7 +81,7 @@ public:
|
||||
|
||||
int TestAddSecurityLabel1()
|
||||
{
|
||||
GetParamWorkSpace()->securityLabel->cred.gid = TEST_GID;
|
||||
GetParamWorkSpace()->securityLabel->cred.gid = 9999; // 9999 test gid
|
||||
const char *name = "label1.test.aaa.bbb.ccc.dddd.eee";
|
||||
const char *value = "2001";
|
||||
uint32_t labelIndex = 0;
|
||||
@ -100,15 +100,15 @@ public:
|
||||
// 添加一个label,最长匹配到这个节点
|
||||
int TestAddSecurityLabel2()
|
||||
{
|
||||
GetParamWorkSpace()->securityLabel->cred.gid = TEST_GID;
|
||||
GetParamWorkSpace()->securityLabel->cred.gid = 9999; // 9999 test gid
|
||||
const char *name = "label2.test.aaa.bbb.ccc.dddd.eee";
|
||||
const char *value = "2001";
|
||||
ParamAuditData auditData = {};
|
||||
auditData.name = "label2.test.aaa";
|
||||
auditData.label = "label2.test.aaa";
|
||||
auditData.dacData.gid = TEST_DAC_GID;
|
||||
auditData.dacData.gid = 202; // 202 test dac gid
|
||||
auditData.dacData.uid = geteuid();
|
||||
auditData.dacData.mode = TEST_READ_AND_WRITE;
|
||||
auditData.dacData.mode = 0666; // 0666 test mode
|
||||
SystemWriteParam(name, value);
|
||||
uint32_t labelIndex = 0;
|
||||
AddSecurityLabel(&auditData, GetParamWorkSpace());
|
||||
@ -124,23 +124,23 @@ public:
|
||||
// 添加一个label,最长匹配到最后一个相同节点
|
||||
int TestAddSecurityLabel3()
|
||||
{
|
||||
GetParamWorkSpace()->securityLabel->cred.gid = TEST_GID;
|
||||
GetParamWorkSpace()->securityLabel->cred.gid = 9999; // 9999 test gid
|
||||
const char *name = "label3.test.aaa.bbb.ccc.dddd.eee";
|
||||
const char *value = "2001";
|
||||
ParamAuditData auditData = {};
|
||||
auditData.name = "label3.test.aaa";
|
||||
auditData.label = "label3.test.aaa";
|
||||
auditData.dacData.gid = TEST_DAC_GID2;
|
||||
auditData.dacData.gid = 203; // 203 test gid
|
||||
auditData.dacData.uid = geteuid();
|
||||
auditData.dacData.mode = TEST_READ_AND_WRITE;
|
||||
auditData.dacData.mode = 0666; // 0666 test mode
|
||||
SystemWriteParam(name, value);
|
||||
AddSecurityLabel(&auditData, GetParamWorkSpace());
|
||||
|
||||
auditData.name = "label3.test.aaa.bbb.ccc.dddd.eee.dddd";
|
||||
auditData.label = "label3.test.aaa.bbb.ccc.dddd.eee.dddd";
|
||||
auditData.dacData.gid = TEST_DAC_GID;
|
||||
auditData.dacData.gid = 202; // 202 test dac gid
|
||||
auditData.dacData.uid = geteuid();
|
||||
auditData.dacData.mode = TEST_READ_AND_WRITE;
|
||||
auditData.dacData.mode = 0666; // 0666 test mode
|
||||
SystemWriteParam(name, value);
|
||||
AddSecurityLabel(&auditData, GetParamWorkSpace());
|
||||
|
||||
@ -150,22 +150,22 @@ public:
|
||||
if (paramNode == nullptr || node == nullptr) {
|
||||
EXPECT_EQ(1, 0);
|
||||
}
|
||||
EXPECT_EQ((int)node->gid, TEST_DAC_GID2);
|
||||
EXPECT_EQ((int)node->gid, 203); // 203 test gid
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 添加一个label,完全匹配
|
||||
int TestAddSecurityLabel4()
|
||||
{
|
||||
GetParamWorkSpace()->securityLabel->cred.gid = TEST_GID;
|
||||
GetParamWorkSpace()->securityLabel->cred.gid = 9999; // 9999 test gid
|
||||
const char *name = "label4.test.aaa.bbb.ccc.dddd.eee";
|
||||
const char *value = "2001";
|
||||
ParamAuditData auditData = {};
|
||||
auditData.name = "label4.test.aaa.bbb.ccc.dddd.eee";
|
||||
auditData.label = "label4.test.aaa.bbb.ccc.dddd.eee";
|
||||
auditData.dacData.gid = TEST_DAC_GID2;
|
||||
auditData.dacData.gid = 203; // 203 test gid
|
||||
auditData.dacData.uid = geteuid();
|
||||
auditData.dacData.mode = TEST_READ_AND_WRITE;
|
||||
auditData.dacData.mode = 0666; // 0666 test mode
|
||||
SystemWriteParam(name, value);
|
||||
uint32_t labelIndex = 0;
|
||||
AddSecurityLabel(&auditData, GetParamWorkSpace());
|
||||
@ -461,8 +461,8 @@ public:
|
||||
ParamAuditData auditData = {};
|
||||
auditData.name = "ohos.servicectrl.";
|
||||
auditData.label = "";
|
||||
auditData.dacData.gid = TEST_DAC_GID;
|
||||
auditData.dacData.uid = TEST_DAC_GID;
|
||||
auditData.dacData.gid = 202; // 202 test dac gid
|
||||
auditData.dacData.uid = 202; // 202 test dac uid
|
||||
auditData.dacData.mode = mode;
|
||||
AddSecurityLabel(&auditData, GetParamWorkSpace());
|
||||
return SystemWriteParam("ohos.ctl.start", serviceName);
|
||||
@ -474,29 +474,29 @@ public:
|
||||
ParamAuditData auditData = {};
|
||||
auditData.name = "ohos.servicectrl.";
|
||||
auditData.label = "";
|
||||
auditData.dacData.gid = TEST_DAC_GID;
|
||||
auditData.dacData.uid = TEST_DAC_GID;
|
||||
auditData.dacData.gid = 202; // 202 test dac gid
|
||||
auditData.dacData.uid = 202; // 202 test dac uid
|
||||
auditData.dacData.mode = mode;
|
||||
AddSecurityLabel(&auditData, GetParamWorkSpace());
|
||||
return SystemWriteParam("sys.powerctrl", reboot);
|
||||
}
|
||||
};
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestParamServiceInit, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestParamServiceInit, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
test.TestParamServiceInit();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestPersistParam, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestPersistParam, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
test.TestPersistParam();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestSetParam_1, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestSetParam_1, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
const char *params[][2] = { { "111.2222", "1" },
|
||||
{ "111.2222.3333", "2" },
|
||||
{ "111.2222.3333.4444", "3" },
|
||||
@ -505,9 +505,9 @@ HWTEST_F(ParamServiceTest, TestSetParam_1, TestSize.Level1)
|
||||
test.TestSetParams(params, 5);
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestSetParam_2, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestSetParam_2, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
const char *params[][2] = { { "111.2222.xxxx.xxx.xxx", "1_1" },
|
||||
{ "111.2222.3333.xxx", "1_2" },
|
||||
{ "111.2222.xxxx.3333.4444", "1_3" },
|
||||
@ -530,39 +530,39 @@ HWTEST_F(ParamServiceTest, TestSetParam_2, TestSize.Level1)
|
||||
test.TestSetParams(sysParams, 5);
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestNameIsValid, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestNameIsValid, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
test.TestNameIsValid();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestAddSecurityLabel1, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestAddSecurityLabel1, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
test.TestAddSecurityLabel1();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestAddSecurityLabel2, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestAddSecurityLabel2, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
test.TestAddSecurityLabel2();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestAddSecurityLabel3, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestAddSecurityLabel3, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
test.TestAddSecurityLabel3();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestAddSecurityLabel4, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestAddSecurityLabel4, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
test.TestAddSecurityLabel4();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestUpdateParam, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestUpdateParam, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
test.TestUpdateParam("test.aaa.bbb.ccc.ddd", "100");
|
||||
test.TestUpdateParam("test.aaa.bbb.ccc.ddd", "101");
|
||||
test.TestUpdateParam("test.aaa.bbb.ccc.ddd", "102");
|
||||
@ -570,79 +570,79 @@ HWTEST_F(ParamServiceTest, TestUpdateParam, TestSize.Level1)
|
||||
test.TestUpdateParam("net.tcp.default_init_rwnd", "60");
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestServiceProcessMessage, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestServiceProcessMessage, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
test.TestServiceProcessMessage("wertt.qqqq.wwww.rrrr", "wwww.eeeee", 1);
|
||||
test.TestServiceProcessMessage("wertt.2222.wwww.3333", "wwww.eeeee", 0);
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestAddParamWait1, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestAddParamWait1, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
test.TestAddParamWait1();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestAddParamWait2, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestAddParamWait2, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
test.TestAddParamWait2();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestAddParamWait3, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestAddParamWait3, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
test.TestAddParamWait3();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestAddParamWatch1, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestAddParamWatch1, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
test.TestAddParamWatch1();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestAddParamWatch2, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestAddParamWatch2, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
test.TestAddParamWatch2();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestAddParamWatch3, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestAddParamWatch3, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
test.TestAddParamWatch3();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestCloseTriggerWatch, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestCloseTriggerWatch, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
test.TestCloseTriggerWatch();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestParamTraversal, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestParamTraversal, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
test.TestParamTraversal();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestDumpParamMemory, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestDumpParamMemory, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
test.TestDumpParamMemory();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestServiceCtrl, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestServiceCtrl, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
int ret = test.TestServiceCtrl("server1", 0770);
|
||||
EXPECT_NE(ret, 0);
|
||||
ret = test.TestServiceCtrl("server2", 0772);
|
||||
EXPECT_EQ(ret, 0);
|
||||
}
|
||||
|
||||
HWTEST_F(ParamServiceTest, TestPowerCtrl, TestSize.Level1)
|
||||
HWTEST_F(ParamUnitTest, TestPowerCtrl, TestSize.Level0)
|
||||
{
|
||||
ParamServiceTest test;
|
||||
ParamUnitTest test;
|
||||
int ret = test.TestPowerCtrl("reboot,shutdown", 0770);
|
||||
EXPECT_NE(ret, 0);
|
||||
ret = test.TestPowerCtrl("reboot,shutdown", 0772);
|
||||
|
@ -35,10 +35,10 @@ static int SecurityLabelGet(const ParamAuditData *auditData, void *context)
|
||||
return 0;
|
||||
}
|
||||
|
||||
class ParamSelinuxTest : public ::testing::Test {
|
||||
class SelinuxUnitTest : public ::testing::Test {
|
||||
public:
|
||||
ParamSelinuxTest() {}
|
||||
virtual ~ParamSelinuxTest() {}
|
||||
SelinuxUnitTest() {}
|
||||
virtual ~SelinuxUnitTest() {}
|
||||
|
||||
void SetUp() {}
|
||||
void TearDown() {}
|
||||
@ -237,46 +237,46 @@ private:
|
||||
ParamSecurityOps clientParamSercurityOps;
|
||||
};
|
||||
|
||||
HWTEST_F(ParamSelinuxTest, TestSelinuxGetLabel, TestSize.Level1)
|
||||
HWTEST_F(SelinuxUnitTest, TestSelinuxGetLabel, TestSize.Level0)
|
||||
{
|
||||
ParamSelinuxTest test;
|
||||
SelinuxUnitTest test;
|
||||
test.TestSelinuxGetLabel();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamSelinuxTest, TestSelinuxInitLocalLabel, TestSize.Level1)
|
||||
HWTEST_F(SelinuxUnitTest, TestSelinuxInitLocalLabel, TestSize.Level0)
|
||||
{
|
||||
ParamSelinuxTest test;
|
||||
SelinuxUnitTest test;
|
||||
test.TestSelinuxInitLocalLabel();
|
||||
}
|
||||
|
||||
HWTEST_F(ParamSelinuxTest, TestSelinuxCheckFilePermission, TestSize.Level1)
|
||||
HWTEST_F(SelinuxUnitTest, TestSelinuxCheckFilePermission, TestSize.Level0)
|
||||
{
|
||||
ParamSelinuxTest test;
|
||||
SelinuxUnitTest test;
|
||||
test.TestSelinuxCheckFilePermission(PARAM_DEFAULT_PATH"/trigger_test.cfg");
|
||||
}
|
||||
|
||||
HWTEST_F(ParamSelinuxTest, TestSelinuxCheckParaPermission, TestSize.Level1)
|
||||
HWTEST_F(SelinuxUnitTest, TestSelinuxCheckParaPermission, TestSize.Level0)
|
||||
{
|
||||
ParamSelinuxTest test;
|
||||
SelinuxUnitTest test;
|
||||
test.TestSelinuxCheckParaPermission("aaa.bbb.bbb.ccc", "user:group1:r");
|
||||
}
|
||||
|
||||
HWTEST_F(ParamSelinuxTest, TestClientDacCheckFilePermission, TestSize.Level1)
|
||||
HWTEST_F(SelinuxUnitTest, TestClientDacCheckFilePermission, TestSize.Level0)
|
||||
{
|
||||
ParamSelinuxTest test;
|
||||
SelinuxUnitTest test;
|
||||
test.TestClientSelinuxCheckFilePermission(PARAM_DEFAULT_PATH"/trigger_test.cfg");
|
||||
}
|
||||
|
||||
HWTEST_F(ParamSelinuxTest, TestClientDacCheckParaPermission, TestSize.Level1)
|
||||
HWTEST_F(SelinuxUnitTest, TestClientDacCheckParaPermission, TestSize.Level0)
|
||||
{
|
||||
ParamSelinuxTest test;
|
||||
SelinuxUnitTest test;
|
||||
test.TestClientSelinuxCheckParaPermissionWrite("aaa.bbb.bbb.ccc", "user:group1:r");
|
||||
test.TestClientSelinuxCheckParaPermissionRead("aaa.bbb.bbb.ccc", "user:group1:r");
|
||||
}
|
||||
|
||||
HWTEST_F(ParamSelinuxTest, TestSeliniuxLabelEncode, TestSize.Level1)
|
||||
HWTEST_F(SelinuxUnitTest, TestSeliniuxLabelEncode, TestSize.Level0)
|
||||
{
|
||||
ParamSelinuxTest test;
|
||||
SelinuxUnitTest test;
|
||||
std::vector<char> buffer;
|
||||
ParamSecurityLabel *label;
|
||||
test.TestEncode(label, buffer);
|
||||
|
@ -66,10 +66,10 @@ static int TestTriggerExecute(TriggerNode *trigger, const char *content, uint32_
|
||||
return 0;
|
||||
}
|
||||
|
||||
class TriggerTest : public ::testing::Test {
|
||||
class TriggerUnitTest : public ::testing::Test {
|
||||
public:
|
||||
TriggerTest() {}
|
||||
virtual ~TriggerTest() {}
|
||||
TriggerUnitTest() {}
|
||||
virtual ~TriggerUnitTest() {}
|
||||
|
||||
void SetUp() {}
|
||||
void TearDown() {}
|
||||
@ -485,111 +485,111 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
HWTEST_F(TriggerTest, TestLoadTrigger, TestSize.Level1)
|
||||
HWTEST_F(TriggerUnitTest, TestLoadTrigger, TestSize.Level0)
|
||||
{
|
||||
TriggerTest test;
|
||||
TriggerUnitTest test;
|
||||
test.TestLoadTrigger();
|
||||
}
|
||||
|
||||
HWTEST_F(TriggerTest, TestBootEvent, TestSize.Level1)
|
||||
HWTEST_F(TriggerUnitTest, TestBootEvent, TestSize.Level0)
|
||||
{
|
||||
TriggerTest test;
|
||||
TriggerUnitTest test;
|
||||
test.TestBootEvent("pre-init");
|
||||
test.TestBootEvent("init");
|
||||
test.TestBootEvent("post-init");
|
||||
test.TestBootEvent("early-init");
|
||||
}
|
||||
|
||||
HWTEST_F(TriggerTest, TestAddTriggerForBoot, TestSize.Level1)
|
||||
HWTEST_F(TriggerUnitTest, TestAddTriggerForBoot, TestSize.Level0)
|
||||
{
|
||||
TriggerTest test;
|
||||
TriggerUnitTest test;
|
||||
test.TestAddTriggerForBoot();
|
||||
}
|
||||
|
||||
HWTEST_F(TriggerTest, TestAddTriggerForParm, TestSize.Level1)
|
||||
HWTEST_F(TriggerUnitTest, TestAddTriggerForParm, TestSize.Level0)
|
||||
{
|
||||
TriggerTest test;
|
||||
TriggerUnitTest test;
|
||||
test.TestAddTriggerForParm();
|
||||
}
|
||||
|
||||
HWTEST_F(TriggerTest, TestCheckParamTrigger1, TestSize.Level1)
|
||||
HWTEST_F(TriggerUnitTest, TestCheckParamTrigger1, TestSize.Level0)
|
||||
{
|
||||
TriggerTest test;
|
||||
TriggerUnitTest test;
|
||||
test.TestCheckParamTrigger1();
|
||||
}
|
||||
|
||||
HWTEST_F(TriggerTest, TestCheckParamTrigger2, TestSize.Level1)
|
||||
HWTEST_F(TriggerUnitTest, TestCheckParamTrigger2, TestSize.Level0)
|
||||
{
|
||||
TriggerTest test;
|
||||
TriggerUnitTest test;
|
||||
test.TestCheckParamTrigger2();
|
||||
}
|
||||
|
||||
HWTEST_F(TriggerTest, TestCheckParamTrigger3, TestSize.Level1)
|
||||
HWTEST_F(TriggerUnitTest, TestCheckParamTrigger3, TestSize.Level0)
|
||||
{
|
||||
TriggerTest test;
|
||||
TriggerUnitTest test;
|
||||
test.TestCheckParamTrigger3();
|
||||
}
|
||||
|
||||
HWTEST_F(TriggerTest, TestCheckParamTrigger4, TestSize.Level1)
|
||||
HWTEST_F(TriggerUnitTest, TestCheckParamTrigger4, TestSize.Level0)
|
||||
{
|
||||
TriggerTest test;
|
||||
TriggerUnitTest test;
|
||||
test.TestCheckParamTrigger4();
|
||||
}
|
||||
|
||||
HWTEST_F(TriggerTest, TestCheckParamTrigger5, TestSize.Level1)
|
||||
HWTEST_F(TriggerUnitTest, TestCheckParamTrigger5, TestSize.Level0)
|
||||
{
|
||||
TriggerTest test;
|
||||
TriggerUnitTest test;
|
||||
test.TestCheckParamTrigger5();
|
||||
}
|
||||
|
||||
HWTEST_F(TriggerTest, TestParamEvent, TestSize.Level1)
|
||||
HWTEST_F(TriggerUnitTest, TestParamEvent, TestSize.Level0)
|
||||
{
|
||||
TriggerTest test;
|
||||
TriggerUnitTest test;
|
||||
test.TestParamEvent();
|
||||
}
|
||||
|
||||
HWTEST_F(TriggerTest, ComputerCondition, TestSize.Level1)
|
||||
HWTEST_F(TriggerUnitTest, ComputerCondition, TestSize.Level0)
|
||||
{
|
||||
TriggerTest test;
|
||||
TriggerUnitTest test;
|
||||
test.TestComputeCondition("aaa=111||aaa=222||aaa=333");
|
||||
test.TestComputeCondition("aaa=111||aaa=222&&aaa=333");
|
||||
test.TestComputeCondition("(aaa=111||aaa=222)&&aaa=333");
|
||||
test.TestComputeCondition("aaa=111||(aaa=222&&aaa=333)");
|
||||
}
|
||||
|
||||
HWTEST_F(TriggerTest, TestExecuteParamTrigger1, TestSize.Level1)
|
||||
HWTEST_F(TriggerUnitTest, TestExecuteParamTrigger1, TestSize.Level0)
|
||||
{
|
||||
TriggerTest test;
|
||||
TriggerUnitTest test;
|
||||
test.TestExecuteParamTrigger1();
|
||||
}
|
||||
|
||||
HWTEST_F(TriggerTest, TestExecuteParamTrigger2, TestSize.Level1)
|
||||
HWTEST_F(TriggerUnitTest, TestExecuteParamTrigger2, TestSize.Level0)
|
||||
{
|
||||
TriggerTest test;
|
||||
TriggerUnitTest test;
|
||||
test.TestExecuteParamTrigger2();
|
||||
}
|
||||
|
||||
HWTEST_F(TriggerTest, TestExecuteParamTrigger3, TestSize.Level1)
|
||||
HWTEST_F(TriggerUnitTest, TestExecuteParamTrigger3, TestSize.Level0)
|
||||
{
|
||||
TriggerTest test;
|
||||
TriggerUnitTest test;
|
||||
test.TestExecuteParamTrigger3();
|
||||
}
|
||||
|
||||
HWTEST_F(TriggerTest, TestExecuteParamTrigger4, TestSize.Level1)
|
||||
HWTEST_F(TriggerUnitTest, TestExecuteParamTrigger4, TestSize.Level0)
|
||||
{
|
||||
TriggerTest test;
|
||||
TriggerUnitTest test;
|
||||
test.TestExecuteParamTrigger4();
|
||||
}
|
||||
|
||||
HWTEST_F(TriggerTest, TestExecuteParamTrigger5, TestSize.Level1)
|
||||
HWTEST_F(TriggerUnitTest, TestExecuteParamTrigger5, TestSize.Level0)
|
||||
{
|
||||
TriggerTest test;
|
||||
TriggerUnitTest test;
|
||||
test.TestExecuteParamTrigger5();
|
||||
}
|
||||
|
||||
HWTEST_F(TriggerTest, TestRunClient, TestSize.Level1)
|
||||
HWTEST_F(TriggerUnitTest, TestRunClient, TestSize.Level0)
|
||||
{
|
||||
TriggerTest test;
|
||||
TriggerUnitTest test;
|
||||
int ret = test.TestRunClient();
|
||||
EXPECT_EQ(ret, 0);
|
||||
}
|
@ -38,10 +38,10 @@ void TestParameterChange(const char *key, const char *value, void *context)
|
||||
printf("TestParameterChange key:%s %s", key, value);
|
||||
}
|
||||
|
||||
class WatcherAgentTest : public ::testing::Test {
|
||||
class WatcherAgentUnitTest : public ::testing::Test {
|
||||
public:
|
||||
WatcherAgentTest() {}
|
||||
virtual ~WatcherAgentTest() {}
|
||||
WatcherAgentUnitTest() {}
|
||||
virtual ~WatcherAgentUnitTest() {}
|
||||
|
||||
void SetUp() {}
|
||||
void TearDown() {}
|
||||
@ -113,26 +113,26 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
HWTEST_F(WatcherAgentTest, TestAddWatcher, TestSize.Level1)
|
||||
HWTEST_F(WatcherAgentUnitTest, TestAddWatcher, TestSize.Level0)
|
||||
{
|
||||
WatcherAgentTest test;
|
||||
WatcherAgentUnitTest test;
|
||||
test.TestAddWatcher();
|
||||
}
|
||||
|
||||
HWTEST_F(WatcherAgentTest, TestRecvMessage, TestSize.Level1)
|
||||
HWTEST_F(WatcherAgentUnitTest, TestRecvMessage, TestSize.Level0)
|
||||
{
|
||||
WatcherAgentTest test;
|
||||
WatcherAgentUnitTest test;
|
||||
test.TestRecvMessage("test.permission.watcher.agent.test1");
|
||||
}
|
||||
|
||||
HWTEST_F(WatcherAgentTest, TestDelWatcher, TestSize.Level1)
|
||||
HWTEST_F(WatcherAgentUnitTest, TestDelWatcher, TestSize.Level0)
|
||||
{
|
||||
WatcherAgentTest test;
|
||||
WatcherAgentUnitTest test;
|
||||
test.TestDelWatcher();
|
||||
}
|
||||
|
||||
HWTEST_F(WatcherAgentTest, TestResetService, TestSize.Level1)
|
||||
HWTEST_F(WatcherAgentUnitTest, TestResetService, TestSize.Level0)
|
||||
{
|
||||
WatcherAgentTest test;
|
||||
WatcherAgentUnitTest test;
|
||||
test.TestResetService();
|
||||
}
|
@ -53,10 +53,10 @@ public:
|
||||
using WatcherManagerPtr = WatcherManager *;
|
||||
WatcherManagerPtr g_watcherManager{ nullptr };
|
||||
|
||||
class WatcherProxyTest : public ::testing::Test {
|
||||
class WatcherProxyUnitTest : public ::testing::Test {
|
||||
public:
|
||||
WatcherProxyTest() {}
|
||||
virtual ~WatcherProxyTest() {}
|
||||
WatcherProxyUnitTest() {}
|
||||
virtual ~WatcherProxyUnitTest() {}
|
||||
|
||||
void SetUp() {}
|
||||
void TearDown() {}
|
||||
@ -150,57 +150,57 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
HWTEST_F(WatcherProxyTest, TestAddWatcher, TestSize.Level1)
|
||||
HWTEST_F(WatcherProxyUnitTest, TestAddWatcher, TestSize.Level0)
|
||||
{
|
||||
WatcherProxyTest test;
|
||||
WatcherProxyUnitTest test;
|
||||
uint32_t watcherId = 0;
|
||||
test.TestAddWatcher("test.permission.watcher.test1", watcherId);
|
||||
test.TestProcessWatcherMessage("test.permission.watcher.test1", watcherId);
|
||||
}
|
||||
|
||||
HWTEST_F(WatcherProxyTest, TestAddWatcher2, TestSize.Level1)
|
||||
HWTEST_F(WatcherProxyUnitTest, TestAddWatcher2, TestSize.Level0)
|
||||
{
|
||||
WatcherProxyTest test;
|
||||
WatcherProxyUnitTest test;
|
||||
uint32_t watcherId = 0;
|
||||
test.TestAddWatcher("test.permission.watcher.test2", watcherId);
|
||||
test.TestAddWatcher("test.permission.watcher.test2", watcherId);
|
||||
test.TestAddWatcher("test.permission.watcher.test2", watcherId);
|
||||
}
|
||||
|
||||
HWTEST_F(WatcherProxyTest, TestAddWatcher3, TestSize.Level1)
|
||||
HWTEST_F(WatcherProxyUnitTest, TestAddWatcher3, TestSize.Level0)
|
||||
{
|
||||
WatcherProxyTest test;
|
||||
WatcherProxyUnitTest test;
|
||||
uint32_t watcherId = 0;
|
||||
test.TestAddWatcher("test.permission.watcher.test3", watcherId);
|
||||
}
|
||||
|
||||
HWTEST_F(WatcherProxyTest, TestAddWatcher4, TestSize.Level1)
|
||||
HWTEST_F(WatcherProxyUnitTest, TestAddWatcher4, TestSize.Level0)
|
||||
{
|
||||
WatcherProxyTest test;
|
||||
WatcherProxyUnitTest test;
|
||||
uint32_t watcherId = 0;
|
||||
SystemSetParameter("test.watcher.test4", "1101");
|
||||
SystemSetParameter("test.watcher.test4.test", "1102");
|
||||
test.TestAddWatcher("test.watcher.test4*", watcherId);
|
||||
}
|
||||
|
||||
HWTEST_F(WatcherProxyTest, TestAddWatcher5, TestSize.Level1)
|
||||
HWTEST_F(WatcherProxyUnitTest, TestAddWatcher5, TestSize.Level0)
|
||||
{
|
||||
WatcherProxyTest test;
|
||||
WatcherProxyUnitTest test;
|
||||
uint32_t watcherId = 0;
|
||||
test.TestAddWatcher("test.permission.watcher.test5", watcherId);
|
||||
SystemSetParameter("test.permission.watcher.test5", "1101");
|
||||
}
|
||||
|
||||
HWTEST_F(WatcherProxyTest, TestDelWatcher, TestSize.Level1)
|
||||
HWTEST_F(WatcherProxyUnitTest, TestDelWatcher, TestSize.Level0)
|
||||
{
|
||||
WatcherProxyTest test;
|
||||
WatcherProxyUnitTest test;
|
||||
uint32_t watcherId = 0;
|
||||
test.TestAddWatcher("test.permission.watcher.testDel", watcherId);
|
||||
test.TestDelWatcher("test.permission.watcher.testDel", watcherId);
|
||||
}
|
||||
|
||||
HWTEST_F(WatcherProxyTest, TestWatchProxy, TestSize.Level1)
|
||||
HWTEST_F(WatcherProxyUnitTest, TestWatchProxy, TestSize.Level0)
|
||||
{
|
||||
WatcherProxyTest test;
|
||||
WatcherProxyUnitTest test;
|
||||
test.TestWatchProxy("test.permission.watcher.test1", "watcherId");
|
||||
}
|
@ -173,7 +173,7 @@ char **SplitStringExt(char *buffer, const char *del, int *returnCount, int maxIt
|
||||
int count = 0;
|
||||
while (p != NULL) {
|
||||
if (count > itemCounts - 1) {
|
||||
itemCounts += (itemCounts / 2) + 1; // Request to increase the original memory by half.
|
||||
itemCounts += (itemCounts / 2) + 1; // 2 Request to increase the original memory by half.
|
||||
INIT_LOGD("Too many items,expand size");
|
||||
char **expand = (char **)(realloc(items, sizeof(char *) * itemCounts));
|
||||
if (expand == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user