提交 ce163195 编写于 作者: S sunmingze

modify xts_lite

Signed-off-by: Nsunmingze <sunmingze3@huawei.com>
上级 105782f5
......@@ -72,7 +72,7 @@ public:
result = false;
}
if (!AttestStatusNumberValid(attestResultInfo.softwareResultDetail[SOFTWARE_RESULT_RESERVE])) {
failString += string(" reserveResult is ") + to_string(attestResultInfo.softwareResultDetail[SOFTWARE_RESULT_PCID]);
failString += string(" reserveResult is ") + to_string(attestResultInfo.softwareResultDetail[SOFTWARE_RESULT_RESERVE]);
result = false;
}
if (attestResultInfo.authResult == DEVATTEST_SUCCESS) {
......@@ -119,6 +119,21 @@ HWTEST_F(DeviceAttestQuerryTest, subDeviceAttestTest0200, Function | MediumTest
* @tc.name : HiLog::Warn parameter legal test (Cortex-A, C)
* @tc.desc : [C- SOFTWARE -0200]
*/
#ifdef __LINUX__
HWTEST_F(DeviceAttestQuerryTest, subDeviceAttestTest0300, Function | MediumTest | Level1)
{
int32_t ret = DEVATTEST_SUCCESS;
ret = StartDevAttestTask();
printf("[CLIENT MAIN] StartDevAttestTask ret:%d.\n", ret);
EXPECT_EQ(ret, DEVATTEST_SUCCESS);
AttestResultInfo attestResultInfo = { 0 };
attestResultInfo.ticket = NULL;
printf("[CLIENT MAIN] query.\n");
ret = GetAttestStatus(&attestResultInfo);
printf("[CLIENT MAIN] wrong. ret:%d\n", ret);
EXPECT_EQ(ret, DEVATTEST_SUCCESS);
}
#else
HWTEST_F(DeviceAttestQuerryTest, subDeviceAttestTest0300, Function | MediumTest | Level1)
{
int32_t ret = DEVATTEST_SUCCESS;
......@@ -132,3 +147,5 @@ HWTEST_F(DeviceAttestQuerryTest, subDeviceAttestTest0300, Function | MediumTest
printf("[CLIENT MAIN] wrong. ret:%d\n", ret);
EXPECT_FALSE(ret == DEVATTEST_SUCCESS);
}
#endif
......@@ -17,6 +17,17 @@
#include "hctest.h"
#include "devattest_interface.h"
#define DEVATTEST_INIT -2
#define DEVATTEST_SUCCESS 0
typedef enum {
SOFTWARE_RESULT_VERSIONID,
SOFTWARE_RESULT_PATCHLEVEL,
SOFTWARE_RESULT_ROOTHASH,
SOFTWARE_RESULT_PCID,
SOFTWARE_RESULT_RESERVE,
} SOFTWARE_RESULT_DETAIL_TYPE;
/**
* @tc.desc : register a test suite, this suite is used to test basic flow and interface dependency
* @param : subsystem name is dfx
......@@ -44,8 +55,55 @@ static BOOL DeviceAttestFuncTestSuiteTearDown(void)
return TRUE;
}
bool AttestStatusNumberValid(int32_t attestStatusNumber)
{
if (attestStatusNumber < DEVATTEST_INIT || attestStatusNumber > DEVATTEST_SUCCESS) {
return false;
}
return true;
}
bool AttestStatusValid(AttestResultInfo attestResultInfo)
{
bool result = true;
if (!AttestStatusNumberValid(attestResultInfo.authResult)) {
result = false;
}
if (!AttestStatusNumberValid(attestResultInfo.softwareResult)) {
result = false;
}
if (!AttestStatusNumberValid(attestResultInfo.softwareResultDetail[SOFTWARE_RESULT_VERSIONID])) {
result = false;
}
if (!AttestStatusNumberValid(attestResultInfo.softwareResultDetail[SOFTWARE_RESULT_PATCHLEVEL])) {
result = false;
}
if (!AttestStatusNumberValid(attestResultInfo.softwareResultDetail[SOFTWARE_RESULT_ROOTHASH])) {
result = false;
}
if (!AttestStatusNumberValid(attestResultInfo.softwareResultDetail[SOFTWARE_RESULT_PCID])) {
result = false;
}
if (!AttestStatusNumberValid(attestResultInfo.softwareResultDetail[SOFTWARE_RESULT_RESERVE])) {
result = false;
}
if (attestResultInfo.authResult == DEVATTEST_SUCCESS) {
if (attestResultInfo.ticketLength <= 0) {
result = false;
}
if (attestResultInfo.ticket == "") {
result = false;
}
}
if (result) {
return true;
} else {
return false;
}
}
/**
* @tc.number : SUB_Device_Attest_0600
* @tc.number : SUB_Device_Attest_0100
* @tc.name : StartDevAttestTask test
* @tc.desc : [C- SOFTWARE -0200]
* @tc.size : MEDIUM
......@@ -56,8 +114,25 @@ LITE_TEST_CASE(DeviceAttestFuncTestSuite, subDeviceAttest0100, LEVEL0)
{
int32_t ret = DEVATTEST_SUCCESS;
ret = StartDevAttestTask();
printf("[CLIENT MAIN] StartDevAttestTask ret:%d.\n", ret);
TEST_ASSERT_EQUAL_INT(ret, DEVATTEST_SUCCESS);
};
/**
* @tc.number : SUB_Device_Attest_0200
* @tc.name : GetAttestStatus test
* @tc.desc : [C- SOFTWARE -0200]
* @tc.size : MEDIUM
* @tc.type : RELI
* @tc.level : Level 0
*/
LITE_TEST_CASE(DeviceAttestFuncTestSuite, subDeviceAttest0200, LEVEL0)
{
int32_t ret = DEVATTEST_SUCCESS;
AttestResultInfo attestResultInfo = { 0 };
attestResultInfo.ticket = NULL;
ret = GetAttestStatus(&attestResultInfo);
TEST_ASSERT_EQUAL_INT(ret, DEVATTEST_SUCCESS);
TEST_ASSERT_EQUAL_INT(AttestStatusValid(attestResultInfo), true);
};
RUN_TEST_SUITE(DeviceAttestFuncTestSuite);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册