提交 edbfdf55 编写于 作者: O openharmony_ci 提交者: Gitee

!147 修改testTruncateEacces用例错误码的问题

Merge pull request !147 from chuaizhzh/kernel_lite_20210415_01
......@@ -12,5 +12,5 @@
# limitations under the License.
group("ActsAiTest") {
deps = [ "//test/xts/acts/ai_lite/engine_posix/base:ActsAiEngineTest" ]
deps = [ "//test/xts/acts/ai_lite/ai_engine_posix/base:ActsAiEngineTest" ]
}
......@@ -53,15 +53,15 @@ lite_component("acts_component") {
"//test/xts/acts/utils_lite/kv_store_posix:ActsKvStoreTest",
"//test/xts/acts/startup_lite/syspara_posix:ActsParameterTest",
"//test/xts/acts/startup_lite/bootstrap_posix:ActsBootstrapTest",
"//test/xts/acts/multimedia_lite/multimedia_posix/camera:ActsMediaCameraTest",
"//test/xts/acts/multimedia_lite/camera_lite_posix/camera_native:ActsMediaCameraTest",
"//test/xts/acts/open_posix_testsuite/conformance/interfaces:ActsOpenPosixTest",
"//test/xts/acts/multimedia_lite/multimedia_posix/player:ActsMediaPlayerTest",
"//test/xts/acts/multimedia_lite/media_lite_posix/player_native:ActsMediaPlayerTest",
"//test/xts/acts/distributed_schedule_lite/samgr_posix:ActsSamgrTest",
#"//test/xts/acts/distributedschedule_lite/dtbschedmgr_posix:ActsDMSTest",
"//test/xts/acts/security_lite/permission_posix/pms:ActsPMSTest",
"//test/xts/acts/hiviewdfx_lite/hilog_posix:ActsHilogTest",
"//test/xts/acts/multimedia_lite/multimedia_posix/recorder:ActsMediaRecorderTest",
"//test/xts/acts/multimedia_lite/media_lite_posix/recorder_native:ActsMediaRecorderTest",
"//test/xts/acts/graphic_lite/graphic_utils:uikit_test1",
"//test/xts/acts/graphic_lite/surface:uikit_test2",
......@@ -80,9 +80,9 @@ lite_component("acts_component") {
"//test/xts/acts/utils_lite/kv_store_posix:ActsKvStoreTest",
"//test/xts/acts/startup_lite/syspara_posix:ActsParameterTest",
"//test/xts/acts/security_lite/datahuks_posix:ActsSecurityDataTest",
"//test/xts/acts/multimedia_lite/multimedia_posix/camera:ActsMediaCameraTest",
"//test/xts/acts/multimedia_lite/multimedia_posix/recorder:ActsMediaRecorderTest",
"//test/xts/acts/multimedia_lite/multimedia_posix/player:ActsMediaPlayerTest",
"//test/xts/acts/multimedia_lite/camera_lite_posix/camera_native:ActsMediaCameraTest",
"//test/xts/acts/multimedia_lite/media_lite_posix/player_native:ActsMediaPlayerTest",
"//test/xts/acts/multimedia_lite/media_lite_posix/recorder_native:ActsMediaRecorderTest",
"//test/xts/acts/distributed_schedule_lite/samgr_posix:ActsSamgrTest",
"//test/xts/acts/appexecfwk_lite/bundle_mgr_posix:ActsBundleMgrTest",
"//test/xts/acts/aafwk_lite/ability_posix:ActsAbilityMgrTest",
......
......@@ -18,7 +18,6 @@ hcpptest_suite("ActsDMSTest") {
sources = [
"src/MsgParserFuncTest.cpp",
"src/MsgParserLenFuncTest.cpp",
"src/StartAbilityFromRemoteFuncTest.cpp",
"src/utils/DMSTestBase.cpp",
"src/utils/dms_packet.cpp",
]
......@@ -31,7 +30,7 @@ hcpptest_suite("ActsDMSTest") {
"//foundation/communication/ipc_lite/interfaces/kits",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/services/dtbschedmgr_lite/include",
"//foundation/distributedschedule/dmsfwk_lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/innerkits",
"${aafwk_lite_path}/interfaces/innerkits/abilitymgr_lite",
......@@ -46,7 +45,7 @@ hcpptest_suite("ActsDMSTest") {
"${appexecfwk_lite_path}/frameworks/bundle_lite:bundle",
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//foundation/distributedschedule/services/dtbschedmgr_lite:dtbschedmgr",
"//foundation/distributedschedule/dmsfwk_lite:dtbschedmgr",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-Wno-error" ]
......
/*
* Copyright (c) 2021 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.
*/
#include "gtest/gtest.h"
#include "utils/DMSTestBase.h"
#include "utils/dms_packet.h"
#include "distributed_service_interface.h"
using namespace testing::ext;
static int8_t RunTest(const uint8_t *buffer, uint16_t bufferLen, const TlvParseCallback onTlvParseDone,
const StartAbilityCallback onStartAbilityDone)
{
IDmsFeatureCallback dmsFeatureCallback = {
.onTlvParseDone = onTlvParseDone,
.onStartAbilityDone = onStartAbilityDone
};
CommuInterInfo interInfo;
interInfo.payloadLength = bufferLen;
interInfo.payload = buffer;
return DmsLiteProcessCommuMsg(&interInfo, &dmsFeatureCallback);
}
class StartAbilityFromRemoteFuncTest : public testing::Test {
protected:
// SetUpTestCase: Testsuit setup, run before 1st testcase
static void SetUpTestCase(void)
{
SystemInitProxy();
}
// TearDownTestCase: Testsuit teardown, run after last testcase
static void TearDownTestCase(void)
{
UninstallHap();
}
// Testcase setup
virtual void SetUp()
{
}
// Testcase teardown
virtual void TearDown()
{
}
};
/**
* @tc.number : DMSLite_DMS_StartAbilityFromRemoteFunc_0010
* @tc.name : User can start ability from remote
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F(StartAbilityFromRemoteFuncTest, testStartAbilityFromRemoteFunc0010, Function | MediumTest | Level2) {
std::string bundleName = "com.huawei.helloworld";
std::string abilityName = "AceAbility";
std::string signature = "BERxL4Em2dAox98GRbsB31dRcsHDto7hjc5ztnc0cNMsHX33a0B2xgfJIJiGMBiAEcTlW3mbxzm6KIMyrKJj1z8=";
char buffer[PACKET_DATA_SIZE] = {0};
uint16_t dataSize = 0;
DmsPacket dmsPacket {buffer, PACKET_DATA_SIZE};
DmsMsgInfo dmsMsgInfo = {
DMSLITE_COMMAND::START_ABILITY_FROM_REMOTE,
bundleName,
abilityName,
signature
};
if (!dmsPacket.BuildDmsPacket(dmsMsgInfo, dataSize)) {
printf("[hcpptest]E BuildDmsPacket failed");
}
auto onStartAbilityDone = [] (int8_t errCode) {
printf("[hcpptest]onStartAbilityDone call and errCode:%d \n", errCode);
};
int8_t resultCode = RunTest((uint8_t *)buffer, dataSize, nullptr, onStartAbilityDone);
ASSERT_EQ(resultCode, DMS_EC_START_ABILITY_SYNC_SUCCESS);
}
/**
* @tc.number : DMSLite_DMS_StartAbilityFromRemoteFunc_0020
* @tc.name : When start ability from remote with unknown comand id user get error code
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F(StartAbilityFromRemoteFuncTest, testStartAbilityFromRemoteFunc0020, Function | MediumTest | Level2) {
std::string bundleName = "com.huawei.helloworld";
std::string abilityName = "AceAbility";
std::string signature = "BERxL4Em2dAox98GRbsB31dRcsHDto7hjc5ztnc0cNMsHX33a0B2xgfJIJiGMBiAEcTlW3mbxzm6KIMyrKJj1z8=";
char buffer[PACKET_DATA_SIZE] = {0};
uint16_t dataSize = 0;
DmsPacket dmsPacket {buffer, PACKET_DATA_SIZE};
DmsMsgInfo dmsMsgInfo = {
DMSLITE_COMMAND::START_ABILITY_FROM_REMOTE,
bundleName,
abilityName,
signature
};
dmsMsgInfo.commandId = 9;
if (!dmsPacket.BuildDmsPacket(dmsMsgInfo, dataSize)) {
printf("[hcpptest]E BuildDmsPacket failed");
}
auto onStartAbilityDone = [] (int8_t errCode) {
printf("[hcpptest]onStartAbilityDone call and errCode:%d \n", errCode);
};
int8_t resultCode = RunTest((uint8_t *)buffer, dataSize, nullptr, onStartAbilityDone);
ASSERT_EQ(resultCode, DMS_EC_UNKNOWN_COMMAND_ID);
}
/**
* @tc.number : DMSLite_DMS_StartAbilityFromRemoteFunc_0030
* @tc.name : When start ability from remote with unknown bundle name user get error code
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F(StartAbilityFromRemoteFuncTest, testStartAbilityFromRemoteFunc0030, Function | MediumTest | Level2) {
std::string bundleName = "com.huawei.unknownPackage";
std::string abilityName = "AceAbility";
std::string signature = "BERxL4Em2dAox98GRbsB31dRcsHDto7hjc5ztnc0cNMsHX33a0B2xgfJIJiGMBiAEcTlW3mbxzm6KIMyrKJj1z8=";
char buffer[PACKET_DATA_SIZE] = {0};
uint16_t dataSize = 0;
DmsPacket dmsPacket {buffer, PACKET_DATA_SIZE};
DmsMsgInfo dmsMsgInfo = {
DMSLITE_COMMAND::START_ABILITY_FROM_REMOTE,
bundleName,
abilityName,
signature
};
if (!dmsPacket.BuildDmsPacket(dmsMsgInfo, dataSize)) {
printf("[hcpptest]E BuildDmsPacket failed");
}
auto onStartAbilityDone = [] (int8_t errCode) {
printf("[hcpptest]onStartAbilityDone call and errCode:%d \n", errCode);
};
int8_t resultCode = RunTest((uint8_t *)buffer, dataSize, nullptr, onStartAbilityDone);
ASSERT_EQ(resultCode, DMS_EC_GET_BUNDLEINFO_FAILURE);
}
/**
* @tc.number : DMSLite_DMS_StartAbilityFromRemoteFunc_0040
* @tc.name : When start ability from remote with unknown ability name user can not get error code
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F(StartAbilityFromRemoteFuncTest, testStartAbilityFromRemoteFunc0040, Function | MediumTest | Level2) {
std::string bundleName = "com.huawei.helloworld";
std::string abilityName = "unknownAbility";
std::string signature = "BERxL4Em2dAox98GRbsB31dRcsHDto7hjc5ztnc0cNMsHX33a0B2xgfJIJiGMBiAEcTlW3mbxzm6KIMyrKJj1z8=";
char buffer[PACKET_DATA_SIZE] = {0};
uint16_t dataSize = 0;
DmsPacket dmsPacket {buffer, PACKET_DATA_SIZE};
DmsMsgInfo dmsMsgInfo = {
DMSLITE_COMMAND::START_ABILITY_FROM_REMOTE,
bundleName,
abilityName,
signature
};
if (!dmsPacket.BuildDmsPacket(dmsMsgInfo, dataSize)) {
printf("[hcpptest]E BuildDmsPacket failed");
}
auto onStartAbilityDone = [] (int8_t errCode) {
printf("[hcpptest]onStartAbilityDone call and errCode:%d \n", errCode);
};
int8_t resultCode = RunTest((uint8_t *)buffer, dataSize, nullptr, onStartAbilityDone);
ASSERT_EQ(resultCode, DMS_EC_START_ABILITY_SYNC_SUCCESS);
}
/**
* @tc.number : DMSLite_DMS_StartAbilityFromRemoteFunc_0050
* @tc.name : When start ability from remote with wrong signature user get error code
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F(StartAbilityFromRemoteFuncTest, testStartAbilityFromRemoteFunc0050, Function | MediumTest | Level2) {
std::string bundleName = "com.huawei.helloworld";
std::string abilityName = "AceAbility";
std::string signature = "wrongPublicKey";
char buffer[PACKET_DATA_SIZE] = {0};
uint16_t dataSize = 0;
DmsPacket dmsPacket {buffer, PACKET_DATA_SIZE};
DmsMsgInfo dmsMsgInfo = {
DMSLITE_COMMAND::START_ABILITY_FROM_REMOTE,
bundleName,
abilityName,
signature
};
if (!dmsPacket.BuildDmsPacket(dmsMsgInfo, dataSize)) {
printf("[hcpptest]E BuildDmsPacket failed");
}
auto onStartAbilityDone = [] (int8_t errCode) {
printf("[hcpptest]onStartAbilityDone call and errCode:%d \n", errCode);
};
int8_t resultCode = RunTest((uint8_t *)buffer, dataSize, nullptr, onStartAbilityDone);
ASSERT_EQ(resultCode, DMS_EC_CHECK_PERMISSION_FAILURE);
}
/**
* @tc.number : DMSLite_DMS_StartAbilityFromRemoteFunc_0060
* @tc.name : User can start ability repeatedly and no memory leak
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F(StartAbilityFromRemoteFuncTest, testStartAbilityFromRemoteFunc0060, Function | MediumTest | Level2) {
std::string bundleName = "com.huawei.helloworld";
std::string abilityName = "AceAbility";
std::string signature = "BERxL4Em2dAox98GRbsB31dRcsHDto7hjc5ztnc0cNMsHX33a0B2xgfJIJiGMBiAEcTlW3mbxzm6KIMyrKJj1z8=";
char buffer[PACKET_DATA_SIZE] = {0};
uint16_t dataSize = 0;
DmsPacket dmsPacket {buffer, PACKET_DATA_SIZE};
DmsMsgInfo dmsMsgInfo = {
DMSLITE_COMMAND::START_ABILITY_FROM_REMOTE,
bundleName,
abilityName,
signature
};
if (!dmsPacket.BuildDmsPacket(dmsMsgInfo, dataSize)) {
printf("[hcpptest]E BuildDmsPacket failed");
}
auto onStartAbilityDone = [] (int8_t errCode) {
printf("[hcpptest]onStartAbilityDone call and errCode:%d \n", errCode);
};
for (int i = 0; i < PRESSURE_LEVEL0; i++) {
usleep(OPER_INTERVAL * MS2US);
int8_t resultCode = RunTest((uint8_t *)buffer, dataSize, nullptr, onStartAbilityDone);
ASSERT_EQ(resultCode, DMS_EC_START_ABILITY_SYNC_SUCCESS);
printf("[hcpptest]occurs: %d, resultCode:%d \n", i, resultCode);
}
}
/**
* @tc.number : DMSLite_DMS_StartAbilityFromRemoteFunc_0070
* @tc.name : When start ability from remote DMS cost time less than 50ms
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F(StartAbilityFromRemoteFuncTest, testStartAbilityFromRemoteFunc0070, Function | MediumTest | Level2) {
std::string bundleName = "com.huawei.helloworld";
std::string abilityName = "AceAbility";
std::string signature = "BERxL4Em2dAox98GRbsB31dRcsHDto7hjc5ztnc0cNMsHX33a0B2xgfJIJiGMBiAEcTlW3mbxzm6KIMyrKJj1z8=";
char buffer[PACKET_DATA_SIZE] = {0};
uint16_t dataSize = 0;
DmsPacket dmsPacket {buffer, PACKET_DATA_SIZE};
DmsMsgInfo dmsMsgInfo = {
DMSLITE_COMMAND::START_ABILITY_FROM_REMOTE,
bundleName,
abilityName,
signature
};
if (!dmsPacket.BuildDmsPacket(dmsMsgInfo, dataSize)) {
printf("[hcpptest]E BuildDmsPacket failed");
}
auto onStartAbilityDone = [] (int8_t errCode) {
printf("[hcpptest]onStartAbilityDone call and errCode:%d \n", errCode);
};
long long totalTime = 0;
for (int i = 0; i < PRESSURE_LEVEL0; i++) {
usleep(OPER_INTERVAL * MS2US);
long long startTime = GetSystemTime();
RunTest((uint8_t *)buffer, dataSize, nullptr, onStartAbilityDone);
long long endTime = GetSystemTime();
totalTime = totalTime + (endTime - startTime);
}
printf("[hcpptest]totalTime:%lld, averageTime:%lld \n", totalTime, totalTime / PRESSURE_LEVEL0);
// usually it costs about 19ms, if bigger than 50ms need to analyse
ASSERT_EQ((totalTime / PRESSURE_LEVEL0) < 50, TRUE);
}
\ No newline at end of file
......@@ -641,18 +641,6 @@ HWTEST_F(UiInterfaceTest, SUB_GRAPHIC_INTERFACE_FIRST_5200, Function | MediumTes
delete animatorCallback;
}
/**
* @tc.number SUB_GRAPHIC_INTERFACE_FIRST_5300
* @tc.name test GetInstance api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(UiInterfaceTest, SUB_GRAPHIC_INTERFACE_FIRST_5300, Function | MediumTest | Level0)
{
AnimatorManager* animatorManager = AnimatorManager::GetInstance();
animatorManager->GetInstance();
EXPECT_EQ(0, 0);
}
/**
* @tc.number SUB_GRAPHIC_INTERFACE_FIRST_5400
* @tc.name test SetMarkNum api
......
......@@ -128,15 +128,4 @@ HWTEST_F(AnimatorTest, Graphic_Animator_Test_IsRepeat_0800, Function | MediumTes
{
EXPECT_EQ(animator->IsRepeat(), false);
}
/**
* @tc.number SUB_GRAPHIC_ANIMATOR_GETINSTANCE_0900
* @tc.name test animator get-instance api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(AnimatorTest, Graphic_Animator_Test_GetInstance_0900, Function | MediumTest | Level0)
{
AnimatorManager::GetInstance();
EXPECT_EQ(0, 0);
}
} // namespace OHOS
\ No newline at end of file
......@@ -127,13 +127,37 @@ static void CmsisThreadCreat004Func001(void const *argument)
osThreadExit();
}
static void KeepRunByTick(UINT32 tick)
{
UINT32 tickA = osKernelGetTickCount();
UINT32 runned = 0;
UINT32 loop = 0;
UINT32 tickB = 0;
while (runned < tick) {
loop++;
tickB = osKernelGetTickCount();
if (tickB >= tickA) {
runned = tickB - tickA;
} else {
runned = tickB + (MAX_UINT32 - tickA);
}
if (loop % ALIVE_INFO_DIS == 0) {
printf("runned:%u, tickB:%u, tickA:%u, loop:%u\t\n",
runned, tickB, tickA, loop);
}
}
printf("return runned:%u, tickB:%u, tickA:%u\t\n",
runned, tickB, tickA);
return;
}
static void CmsisThreadCreat005Func001(void const *argument)
{
(void)argument;
UINT32 uwIndex;
TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_1, g_cmsisTestTaskCount);
for (uwIndex = 0; uwIndex < TEST_TIME; uwIndex++) {
printf("test the thread running delay:%d \t\n", uwIndex);
while (g_cmsisTestTaskCount < TESTCOUNT_NUM_2) {
KeepRunByTick(DELAY_TICKS_10);
}
g_cmsisTestTaskCount++;
TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_3, g_cmsisTestTaskCount);
......@@ -504,6 +528,9 @@ LITE_TEST_CASE(CmsisTaskFuncTestSuite, testOsThreadNew005, Function | MediumTest
g_cmsisTestTaskCount++;
TEST_ASSERT_EQUAL_INT(TESTCOUNT_NUM_2, g_cmsisTestTaskCount);
osDelay(DELAY_TICKS_5);
while (g_cmsisTestTaskCount != TESTCOUNT_NUM_3) {
KeepRunByTick(DELAY_TICKS_10);
}
};
/**
......
......@@ -33,6 +33,8 @@
#define THREAD_COUNT_MIN 3
#define THREAD_COUNT_MAX 30
#define THREAD_STACK_SPACE_MAX 4096
#define MAX_UINT32 0xFFFFFFFF
#define ALIVE_INFO_DIS 10000
#ifdef __cplusplus
#if __cplusplus
......
......@@ -327,7 +327,7 @@ HWTEST_F(ProcessTest, testAssertTrue, Function | MediumTest | Level3)
exit(0);
}
Msleep(50);
AssertProcExitedOK(pid);
WaitProcExitedOK(pid);
}
int FunctionAssertFalse(void)
......
......@@ -16,13 +16,13 @@ import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsMediaCameraTest") {
suite_name = "acts"
sources = [
"//test/xts/acts/multimedia_lite/multimedia_posix/common/src/ActsTestMediaUtils.cpp",
"//test/xts/acts/multimedia_lite/utils_posix/common/src/ActsTestMediaUtils.cpp",
"src/ActsMediaCameraTest.cpp",
]
include_dirs = [
"src",
"//test/xts/acts/multimedia_lite/multimedia_posix/common/include",
"//test/xts/acts/multimedia_lite/utils_posix/common/include",
]
ldflags = [ "-lstdc++" ]
ldflags += [ "-lm" ]
......
......@@ -19,7 +19,7 @@ hcpptest_suite("ActsMediaRecorderTest") {
include_dirs = [
"src/include",
"//test/xts/acts/multimedia_lite/multimedia_posix/common/include",
"//test/xts/acts/multimedia_lite/utils_posix/common/include",
]
deps = [
......
......@@ -31,7 +31,7 @@ void DacTestSuite::SetUp()
// Delete the the directory if exists
RemoveDir(TOP_DIR "/" DACDIR0);
RemoveDir(TOP_DIR "/" DACDIR1);
RemoveDir("/dev/" DACDIR0);
RemoveDir("/storage/" DACDIR0);
// Obtain the current working directory of the test code
mCurPath = GetCurrentPath();
// Modify the current working directory of the test code
......@@ -47,7 +47,7 @@ void DacTestSuite::TearDown()
// Delete the the directory if exists
RemoveDir(TOP_DIR "/" DACDIR0);
RemoveDir(TOP_DIR "/" DACDIR1);
RemoveDir("/dev/" DACDIR0);
RemoveDir("/storage/" DACDIR0);
// Initialize the process and set the uid and gid of the process to zero
SetUidGid(UID0, GID0);
// Restore the working directory of the test code
......
......@@ -55,7 +55,7 @@ static BOOL KvStoreFuncTestSuiteTearDown(void)
}
/* Create files in batches. */
bool SetKVFiles (int num, const char* key, const char* value)
BOOL SetKVFiles (int num, const char* key, const char* value)
{
int size;
int ret;
......@@ -63,16 +63,16 @@ bool SetKVFiles (int num, const char* key, const char* value)
char valuetemp[MAX_VALUE_LEN_TEST] = {0};
char temp[MAX_VALUE_LEN_TEST] = {0};
if (num <= 0) {
return false;
return FALSE;
}
for (int i = 1; i <= num; i++) {
size = sprintf_s(keytemp, MAX_KEY_LEN_TEST, "%s_%d", key, i);
if (size < 0) {
return false;
return FALSE;
}
size = sprintf_s(valuetemp, MAX_VALUE_LEN_TEST, "%s_%d", value, i);
if (size < 0) {
return false;
return FALSE;
}
ret = UtilsSetValue(keytemp, valuetemp);
if (i <= MAX_KEY_NUM_TEST) {
......@@ -97,11 +97,11 @@ bool SetKVFiles (int num, const char* key, const char* value)
IoTWatchDogKick();
}
IoTWatchDogKick();
return true;
return TRUE;
}
/* Read files in batches. */
bool ReadKVFiles (int num, const char* key, const char* value)
BOOL ReadKVFiles (int num, const char* key, const char* value)
{
int size;
int ret;
......@@ -110,16 +110,16 @@ bool ReadKVFiles (int num, const char* key, const char* value)
char valuetemp[MAX_VALUE_LEN_TEST] = {0};
char temp[MAX_VALUE_LEN_TEST] = {0};
if (num <= 0) {
return false;
return FALSE;
}
for (int loop = num; loop > 0; loop--) {
size = sprintf_s(keytemp, MAX_KEY_LEN_TEST, "%s_%d", key, loop);
if (size < 0) {
return false;
return FALSE;
}
size = sprintf_s(valuetemp, MAX_VALUE_LEN_TEST, "%s_%d", value, loop);
if (size < 0) {
return false;
return FALSE;
}
ret = UtilsGetValue(keytemp, temp, MAX_VALUE_LEN_TEST);
if (loop <= MAX_KEY_NUM_TEST) {
......@@ -143,23 +143,23 @@ bool ReadKVFiles (int num, const char* key, const char* value)
IoTWatchDogKick();
}
IoTWatchDogKick();
return true;
return TRUE;
}
/* Delete files in batches. */
bool DeleteKVFiles (int num, const char* key)
BOOL DeleteKVFiles (int num, const char* key)
{
int size;
int ret;
char keytemp[MAX_KEY_LEN_TEST] = {0};
if (num <= 0) {
return false;
return FALSE;
}
for (int i = 1; i <= num; i++) {
size = sprintf_s(keytemp, MAX_KEY_LEN_TEST, "%s_%d", key, i);
if (size < 0) {
return false;
return FALSE;
}
ret = UtilsDeleteValue(keytemp);
if (i <= MAX_KEY_NUM_TEST) {
......@@ -171,7 +171,7 @@ bool DeleteKVFiles (int num, const char* key)
IoTWatchDogKick();
}
IoTWatchDogKick();
return true;
return TRUE;
}
/**
......@@ -621,20 +621,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreCacheSize001, Function | MediumT
{
char key[] = "rw.sys.version";
char value[] = "It is never too old to learn";
bool ret = false;
BOOL ret = FALSE;
ret = SetKVFiles(MAX_CACHE_NUM_TEST-1, key, value);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
ret = ReadKVFiles(MAX_CACHE_NUM_TEST-1, key, value);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
ret = DeleteKVFiles(MAX_CACHE_NUM_TEST-1, key);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
......@@ -649,20 +649,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreCacheSize002, Function | MediumT
{
char key[] = "rw.sys.version";
char value[] = "It is never too old to learn";
bool ret = false;
BOOL ret = FALSE;
ret = SetKVFiles(MAX_CACHE_NUM_TEST, key, value);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
ret = ReadKVFiles(MAX_CACHE_NUM_TEST, key, value);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
ret = DeleteKVFiles(MAX_CACHE_NUM_TEST, key);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
......@@ -677,20 +677,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreCacheSize003, Function | MediumT
{
char key[] = "rw.sys.version";
char value[] = "It is never too old to learn";
bool ret = false;
BOOL ret = FALSE;
ret = SetKVFiles(MAX_CACHE_NUM_TEST+1, key, value);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
ret = ReadKVFiles(MAX_CACHE_NUM_TEST+1, key, value);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
ret = DeleteKVFiles(MAX_CACHE_NUM_TEST+1, key);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
......@@ -705,20 +705,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreMaxSize001, Function | MediumTes
{
char key[] = "rw.sys.version";
char value[] = "It is never too old to learn";
bool ret = false;
BOOL ret = FALSE;
ret = SetKVFiles(MAX_KEY_NUM_TEST-1, key, value);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
ret = ReadKVFiles(MAX_KEY_NUM_TEST-1, key, value);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
ret = DeleteKVFiles(MAX_KEY_NUM_TEST-1, key);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
......@@ -733,20 +733,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreMaxSize002, Function | MediumTes
{
char key[] = "rw.sys.version";
char value[] = "It is never too old to learn";
bool ret = false;
BOOL ret = FALSE;
ret = SetKVFiles(MAX_KEY_NUM_TEST, key, value);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
ret = ReadKVFiles(MAX_KEY_NUM_TEST, key, value);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
ret = DeleteKVFiles(MAX_KEY_NUM_TEST, key);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
......@@ -761,20 +761,20 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreMaxSize003, Function | MediumTes
{
char key[] = "rw.sys.version";
char value[] = "It is never too old to learn";
bool ret = false;
BOOL ret = FALSE;
ret = SetKVFiles(MAX_KEY_NUM_TEST+1, key, value);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
ret = ReadKVFiles(MAX_KEY_NUM_TEST+1, key, value);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
ret = DeleteKVFiles(MAX_KEY_NUM_TEST+1, key);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
......@@ -791,26 +791,26 @@ LITE_TEST_CASE(KvStoreFuncTestSuite, testKvStoreMaxSize004, Function | MediumTes
char value[] = "It is never too old to learn";
char value1[] = "Two tigers Two tigers two tiger running so fast \
running so fast one has no ears one has no tail How strange How strange";
bool ret = false;
BOOL ret = FALSE;
ret = SetKVFiles(INVALID_KEY_NUM, key, value);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
// Update operation
ret = SetKVFiles(INVALID_KEY_NUM, key, value1);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
ret = ReadKVFiles(INVALID_KEY_NUM, key, value1);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
ret = DeleteKVFiles(INVALID_KEY_NUM, key);
if (ret != true)
if (ret != TRUE)
{
TEST_FAIL();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册