mirror of
https://github.com/openharmony/developtools_syscap_codec.git
synced 2026-08-27 02:11:19 -04:00
Merge branch 'master' of gitee.com:openharmony/developtools_syscap_codec into master
Signed-off-by: youliang_1314 <youliang4@huawei.com>
This commit is contained in:
+14
-3
@@ -32,7 +32,7 @@ typedef struct SystemCapabilityWithNum {
|
||||
typedef enum SystemCapabilityNum {
|
||||
ACCOUNT_APPACCOUNT,
|
||||
ACCOUNT_OSACCOUNT,
|
||||
ACE_ACEENGINELITE,
|
||||
ACE_ACEENGINELITE, // abandoned
|
||||
ACE_UIAPPEARANCE, // abandoned
|
||||
AI_AIENGINE,
|
||||
APPLICATIONS_CONTACTSDATA,
|
||||
@@ -102,7 +102,7 @@ typedef enum SystemCapabilityNum {
|
||||
KERNEL_LITEOS_M,
|
||||
LOCATION_LOCATION, // abandoned
|
||||
MISCSERVICES_DOWNLOAD,
|
||||
MISCSERVICES_INPUTMETHOD,
|
||||
MISCSERVICES_INPUTMETHOD, // abandoned
|
||||
MISCSERVICES_PASTEBOARD,
|
||||
MISCSERVICES_SCREENLOCK,
|
||||
MISCSERVICES_TIME,
|
||||
@@ -214,6 +214,12 @@ typedef enum SystemCapabilityNum {
|
||||
ABILITY_FORM,
|
||||
COMMUNICATION_WIFI_AP_CORE,
|
||||
COMMUNICATION_WIFI_AP_EXTENSION,
|
||||
ARKUI_ARKUI_LITE,
|
||||
ARKUI_ARKUI_FULL,
|
||||
ARKUI_ARKUI_LIBUV,
|
||||
ARKUI_ARKUI_NAPI,
|
||||
MISCSERVICES_INPUTMETHOD_FRAMEWORK,
|
||||
UTILS_LANG,
|
||||
// Add here
|
||||
SYSCAP_NUM_MAX = 960
|
||||
} SyscapNum;
|
||||
@@ -225,6 +231,10 @@ const static SyscapWithNum g_arraySyscap[] = {
|
||||
{"SystemCapability.Account.OsAccount", ACCOUNT_OSACCOUNT},
|
||||
{"SystemCapability.ArkUI.UiAppearance", ARKUI_UIAPPEARANCE},
|
||||
{"SystemCapability.Ace.AceEngineLite", ACE_ACEENGINELITE},
|
||||
{"SystemCapability.ArkUI.ArkUI.Lite", ARKUI_ARKUI_LITE},
|
||||
{"SystemCapability.ArkUI.ArkUI.Full", ARKUI_ARKUI_FULL},
|
||||
{"SystemCapability.ArkUI.ArkUI.Libuv", ARKUI_ARKUI_LIBUV},
|
||||
{"SystemCapability.ArkUI.ArkUI.Napi", ARKUI_ARKUI_NAPI},
|
||||
{"SystemCapability.Ai.AiEngine", AI_AIENGINE},
|
||||
{"SystemCapability.Applications.ContactsData", APPLICATIONS_CONTACTSDATA},
|
||||
{"SystemCapability.Barrierfree.Accessibility.Core", BARRIERFREE_ACCESSIBILITY_CORE},
|
||||
@@ -301,7 +311,7 @@ const static SyscapWithNum g_arraySyscap[] = {
|
||||
{"SystemCapability.Location.Location.Geocoder", LOCATION_LOCATION_GEOCODER},
|
||||
{"SystemCapability.Location.Location.Lite", LOCATION_LOCATION_LITE},
|
||||
{"SystemCapability.MiscServices.Download", MISCSERVICES_DOWNLOAD},
|
||||
{"SystemCapability.MiscServices.InputMethod", MISCSERVICES_INPUTMETHOD},
|
||||
{"SystemCapability.MiscServices.InputMethodFramework", MISCSERVICES_INPUTMETHOD_FRAMEWORK},
|
||||
{"SystemCapability.MiscServices.Pasteboard", MISCSERVICES_PASTEBOARD},
|
||||
{"SystemCapability.MiscServices.ScreenLock", MISCSERVICES_SCREENLOCK},
|
||||
{"SystemCapability.MiscServices.Time", MISCSERVICES_TIME},
|
||||
@@ -381,6 +391,7 @@ const static SyscapWithNum g_arraySyscap[] = {
|
||||
{"SystemCapability.UserIAM.UserAuth.FaceAuth", USERIAM_USERAUTH_FACEAUTH},
|
||||
{"SystemCapability.UserIAM.UserAuth.FingerprintAuth", USERIAM_USERAUTH_FINGERPRINTAUTH},
|
||||
{"SystemCapability.UserIAM.UserAuth.PinAuth", USERIAM_USERAUTH_PINAUTH},
|
||||
{"SystemCapability.Utils.Lang", UTILS_LANG},
|
||||
{"SystemCapability.Security.CertificateManager", SECURITY_CERTIFICATE_MANAGER},
|
||||
{"SystemCapability.Developtools.Syscap", DEVELOPTOOLS_SYSCAP},
|
||||
{"SystemCapability.Multimedia.Audio.Core", MULTIMEDIA_AUDIO_CORE},
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -160,20 +161,19 @@ bool EncodePrivateSyscap(char **output, int *outputLen)
|
||||
return false;
|
||||
}
|
||||
|
||||
*outputLen = bufferLen - PCID_MAIN_BYTES - 1;
|
||||
if (*outputLen == 0) {
|
||||
*output = outputStr;
|
||||
return true;
|
||||
}
|
||||
outputStr = (char *)malloc(*outputLen);
|
||||
if (outputStr == NULL) {
|
||||
PRINT_ERR("malloc buffer failed, size = %d, errno = %d\n", *outputLen, errno);
|
||||
int priLen = bufferLen - PCID_MAIN_BYTES - 1;
|
||||
if (priLen <= 0) {
|
||||
*outputLen = 0;
|
||||
return false;
|
||||
}
|
||||
outputStr = (char *)calloc(priLen, sizeof(char));
|
||||
if (outputStr == NULL) {
|
||||
PRINT_ERR("malloc buffer failed, size = %d, errno = %d\n", priLen, errno);
|
||||
*outputLen = 0;
|
||||
return false;
|
||||
}
|
||||
(void)memset_s(outputStr, *outputLen, 0, *outputLen);
|
||||
|
||||
ret = strncpy_s(outputStr, *outputLen, contextBuffer + PCID_MAIN_BYTES, *outputLen - 1);
|
||||
ret = strncpy_s(outputStr, priLen, contextBuffer + PCID_MAIN_BYTES, priLen - 1);
|
||||
if (ret != 0) {
|
||||
PRINT_ERR("strcpy_s failed.");
|
||||
FreeContextBuffer(contextBuffer);
|
||||
@@ -183,6 +183,7 @@ bool EncodePrivateSyscap(char **output, int *outputLen)
|
||||
}
|
||||
|
||||
FreeContextBuffer(contextBuffer);
|
||||
*outputLen = strlen(outputStr);
|
||||
*output = outputStr;
|
||||
return true;
|
||||
}
|
||||
|
||||
+2
-2
@@ -275,8 +275,8 @@ int32_t CreatePCID(char *inputFile, char *outDirPath)
|
||||
for (i = 0; i < privateCapSize; i++) {
|
||||
jsonArrayItem = cJSON_GetArrayItem(jsonPriSyscapObj, i);
|
||||
priSyscapStr = strchr(jsonArrayItem->valuestring, '.') + 1;
|
||||
nRet = strcat_s(priSyscapHead, PRIVATE_SYSCAP_SIZE - 1, priSyscapStr);
|
||||
nRet += strcat_s(priSyscapHead, PRIVATE_SYSCAP_SIZE - 1, ",");
|
||||
nRet = strcat_s(priSyscapHead, allPriSyscapStrLen + 1, priSyscapStr);
|
||||
nRet += strcat_s(priSyscapHead, allPriSyscapStrLen + 1, ",");
|
||||
if (nRet != EOK) {
|
||||
PRINT_ERR("strcat_s \"pri\" string is failed\n");
|
||||
ret = -1;
|
||||
|
||||
@@ -49,6 +49,9 @@ HWTEST_F(SyscapCodecTest, EncodePrivateSyscap, TestSize.Level1)
|
||||
char *charPriInput = nullptr;
|
||||
int priOutLen;
|
||||
EXPECT_TRUE(EncodePrivateSyscap(&charPriInput, &priOutLen));
|
||||
// Currently, private syscap is null.
|
||||
EXPECT_EQ(*charPriInput, '\0');
|
||||
EXPECT_EQ(priOutLen, 0);
|
||||
free(charPriInput);
|
||||
}
|
||||
|
||||
@@ -74,7 +77,7 @@ HWTEST_F(SyscapCodecTest, DecodeOsSyscap, TestSize.Level1)
|
||||
|
||||
/*
|
||||
* @tc.name: DecodePrivateSyscap
|
||||
* @tc.desc: Check the PrivateSyscap Decoding.
|
||||
* @tc.desc: Check the null PrivateSyscap Decoding.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SyscapCodecTest, DecodePrivateSyscap, TestSize.Level1)
|
||||
@@ -134,8 +137,8 @@ HWTEST_F(SyscapCodecTest, ComparePcidString, TestSize.Level1)
|
||||
const char rpcidString[] = "33588992,1766370052,65536,276824064,0,0,0,0,0,0,"\
|
||||
"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"\
|
||||
"SystemCapability.vendor.xxxxx1,SystemCapability.device.xxxxx2";
|
||||
const char expect[][256] = {"SystemCapability.Graphic.Wms",
|
||||
"SystemCapability.HiviewDFX.HiLog",
|
||||
const char expect[][256] = {"SystemCapability.Graphic.UI",
|
||||
"SystemCapability.HiviewDFX.HiDumper",
|
||||
"SystemCapability.vendor.xxxxx1",
|
||||
"SystemCapability.device.xxxxx2"};
|
||||
int32_t ret = ComparePcidString(pcidString, rpcidString, &result);
|
||||
|
||||
+10
-8
@@ -55,6 +55,12 @@ def list_to_multiline(l):
|
||||
return str(l).lstrip("[").rstrip("]").replace(", ", "\n")
|
||||
|
||||
|
||||
def add_dict_as_table_row(f_table, d_dict):
|
||||
s_keys = sorted(list(d_dict.keys()))
|
||||
for k in s_keys:
|
||||
f_table.add_row([k, list_to_multiline(sorted(list(d_dict.get(k))))])
|
||||
|
||||
|
||||
def read_value_from_json(filepath, key_hierarchy, result_dict):
|
||||
"""
|
||||
:param result_dict: result_dict
|
||||
@@ -187,8 +193,7 @@ def check_component_and_codec(project_path, bundles=None):
|
||||
return
|
||||
if 0 != len(component_diff_array):
|
||||
table.field_names = ["Syscap Only in Component", "Files"]
|
||||
for syscap, files in value_files_dict.items():
|
||||
table.add_row([syscap, list_to_multiline(sorted(files))])
|
||||
add_dict_as_table_row(table, value_files_dict)
|
||||
elif 0 == len(component_diff_array):
|
||||
table.field_names = ["All Syscap in Component have been Covered by Codec"]
|
||||
print("\n")
|
||||
@@ -222,8 +227,7 @@ def check_component_and_sdk(project_path):
|
||||
table.clear()
|
||||
if 0 != len(component_diff_ts):
|
||||
table.field_names = ["SysCap Only in Component", "Files"]
|
||||
for syscap, files in value_component_dict.items():
|
||||
table.add_row([syscap, list_to_multiline(sorted(list(files)))])
|
||||
add_dict_as_table_row(table, value_component_dict)
|
||||
elif 0 == len(component_diff_ts):
|
||||
table.field_names = ["SysCap in Component have been Covered by SDK"]
|
||||
print("\n")
|
||||
@@ -231,8 +235,7 @@ def check_component_and_sdk(project_path):
|
||||
table.clear()
|
||||
if 0 != len(ts_diff_component):
|
||||
table.field_names = ["SysCap Only in SDK", "Files"]
|
||||
for syscap, files in value_ts_dict.items():
|
||||
table.add_row([syscap, list_to_multiline(sorted(list(files)))])
|
||||
add_dict_as_table_row(table, value_ts_dict)
|
||||
elif 0 == len(ts_diff_component):
|
||||
table.field_names = ["All SysCap in SDK have been Covered by Component"]
|
||||
print("\n")
|
||||
@@ -257,8 +260,7 @@ def check_sdk_and_codec(project_path):
|
||||
table.clear()
|
||||
if 0 != len(ts_diff_array):
|
||||
table.field_names = ["SysCap Only in SDK", "Files"]
|
||||
for syscap, files in value_ts_dict.items():
|
||||
table.add_row([syscap, list_to_multiline(sorted(list(files)))])
|
||||
add_dict_as_table_row(table, value_ts_dict)
|
||||
elif 0 == len(ts_diff_array):
|
||||
table.field_names = ["SysCap in SDK have been Covered by Codec"]
|
||||
print("\n")
|
||||
|
||||
Reference in New Issue
Block a user