xts用例概率性失败

Signed-off-by: wuxiaodan <wuxiaodan5@huawei.com>
This commit is contained in:
wuxiaodan 2022-09-21 16:17:56 +08:00
parent 748e3e8f61
commit f6de50cfae
2 changed files with 12 additions and 4 deletions

View File

@ -113,10 +113,12 @@ int readDataFromShmNoClear(char* buf)
int waitDataWithCode(char* code, char* data) int waitDataWithCode(char* code, char* data)
{ {
LOG("waitDataWithCode begin...");
int i = 0; int i = 0;
int timeout = 10; int timeout = 10;
char str[MAX_DATA_LENGTH] = { 0 }; char str[MAX_DATA_LENGTH] = { 0 };
if (code == nullptr || data == nullptr) { if (code == nullptr || data == nullptr) {
LOG("code = nullptr ,data = nullptr");
return RES_FAIL; return RES_FAIL;
} }
while (i < timeout) { while (i < timeout) {

View File

@ -209,17 +209,19 @@ void DisKvTest::RemoteCreateKV(char* str)
char code[CODE_LEN_TEN] = { 0 }; char code[CODE_LEN_TEN] = { 0 };
(void)memset_s(str, MAX_DATA_LENGTH, 0, MAX_DATA_LENGTH); (void)memset_s(str, MAX_DATA_LENGTH, 0, MAX_DATA_LENGTH);
if (memset_s(code, strlen(code), 0, CODE_LEN_TEN) != EOK) {
return;
}
Int2String(CTRL_CODE_RESULT_TYPE, str); Int2String(CTRL_CODE_RESULT_TYPE, str);
if (str == nullptr) { if (str == nullptr) {
LOG("%s Int2String(CTRL_CODE_RESULT_TYPE, str)", LOGSTR);
return; return;
} }
if (strcpy_s(code, strlen(str) + 1, str) != EOK) { if (strcpy_s(code, strlen(str) + 1, str) != EOK) {
LOG("%s strcpy_s(code", LOGSTR);
return; return;
} }
(void)memset_s(str, MAX_DATA_LENGTH, 0, MAX_DATA_LENGTH);
LOG("%s code=%s, str=%s", LOGSTR, code, str);
waitDataWithCode(code, str); waitDataWithCode(code, str);
LOG("%s waitDataWithCode(code, str)", LOGSTR);
int ret = strcmp(str, "0"); int ret = strcmp(str, "0");
if (ret == 0) { if (ret == 0) {
LOG("%s SUCCESS: Remote---CREATE_KV ", LOGSTR); LOG("%s SUCCESS: Remote---CREATE_KV ", LOGSTR);
@ -229,21 +231,25 @@ void DisKvTest::RemoteCreateKV(char* str)
} }
void DisKvTest::RemoteDeleteKV(char* str) void DisKvTest::RemoteDeleteKV(char* str)
{ {
LOG("%s RemoteCreateKV", LOGSTR); LOG("%s RemoteDeleteKV", LOGSTR);
writeCodeDataToShm(CTRL_CODE_DATAMGR_DELETE_KV, str); writeCodeDataToShm(CTRL_CODE_DATAMGR_DELETE_KV, str);
char code[CODE_LEN_TEN] = { 0 }; char code[CODE_LEN_TEN] = { 0 };
(void)memset_s(str, MAX_DATA_LENGTH, 0, MAX_DATA_LENGTH); (void)memset_s(str, MAX_DATA_LENGTH, 0, MAX_DATA_LENGTH);
Int2String(CTRL_CODE_RESULT_TYPE, str); Int2String(CTRL_CODE_RESULT_TYPE, str);
if (str == nullptr) { if (str == nullptr) {
LOG("%s Int2String(CTRL_CODE_RESULT_TYPE, str)", LOGSTR);
return; return;
} }
if (strcpy_s(code, strlen(str) + 1, str) != EOK) { if (strcpy_s(code, strlen(str) + 1, str) != EOK) {
LOG("%s strcpy_s(code", LOGSTR);
return; return;
} }
(void)memset_s(str, MAX_DATA_LENGTH, 0, MAX_DATA_LENGTH); (void)memset_s(str, MAX_DATA_LENGTH, 0, MAX_DATA_LENGTH);
LOG("%s code=%s, str=%s", LOGSTR, code, str);
waitDataWithCode(code, str); waitDataWithCode(code, str);
LOG("%s waitDataWithCode(code, str)", LOGSTR);
int ret = strcmp(str, "0"); int ret = strcmp(str, "0");
if (ret == 0) { if (ret == 0) {
LOG("%s SUCCESS: Remote---DELETE_KV ", LOGSTR); LOG("%s SUCCESS: Remote---DELETE_KV ", LOGSTR);