1fb299fa2Sopenharmony_ci/*
2fb299fa2Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
3fb299fa2Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4fb299fa2Sopenharmony_ci * you may not use this file except in compliance with the License.
5fb299fa2Sopenharmony_ci * You may obtain a copy of the License at
6fb299fa2Sopenharmony_ci *
7fb299fa2Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8fb299fa2Sopenharmony_ci *
9fb299fa2Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10fb299fa2Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11fb299fa2Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12fb299fa2Sopenharmony_ci * See the License for the specific language governing permissions and
13fb299fa2Sopenharmony_ci * limitations under the License.
14fb299fa2Sopenharmony_ci */
15fb299fa2Sopenharmony_ci
16fb299fa2Sopenharmony_ci#include "updater_utils_fuzzer.h"
17fb299fa2Sopenharmony_ci
18fb299fa2Sopenharmony_ci#include <fcntl.h>
19fb299fa2Sopenharmony_ci#include <fstream>
20fb299fa2Sopenharmony_ci#include <iostream>
21fb299fa2Sopenharmony_ci#include <sys/stat.h>
22fb299fa2Sopenharmony_ci#include <unistd.h>
23fb299fa2Sopenharmony_ci#include <vector>
24fb299fa2Sopenharmony_ci#include "cJSON.h"
25fb299fa2Sopenharmony_ci#include "json_node.h"
26fb299fa2Sopenharmony_ci#include "log/log.h"
27fb299fa2Sopenharmony_ci#include "utils.h"
28fb299fa2Sopenharmony_ci
29fb299fa2Sopenharmony_ciusing namespace std::literals;
30fb299fa2Sopenharmony_ciusing namespace std;
31fb299fa2Sopenharmony_ciusing namespace Updater;
32fb299fa2Sopenharmony_ciusing namespace Utils;
33fb299fa2Sopenharmony_ci
34fb299fa2Sopenharmony_cinamespace {
35fb299fa2Sopenharmony_civoid CloseStdout(void)
36fb299fa2Sopenharmony_ci{
37fb299fa2Sopenharmony_ci    int fd = open("/dev/null", O_RDWR | O_CLOEXEC);
38fb299fa2Sopenharmony_ci    if (fd < 0) {
39fb299fa2Sopenharmony_ci        return;
40fb299fa2Sopenharmony_ci    }
41fb299fa2Sopenharmony_ci    dup2(fd, 1);
42fb299fa2Sopenharmony_ci    close(fd);
43fb299fa2Sopenharmony_ci}
44fb299fa2Sopenharmony_ci
45fb299fa2Sopenharmony_civoid TestTrim(const uint8_t* data, size_t size)
46fb299fa2Sopenharmony_ci{
47fb299fa2Sopenharmony_ci    Utils::Trim("");
48fb299fa2Sopenharmony_ci    Utils::Trim("   ");
49fb299fa2Sopenharmony_ci    Utils::Trim("aa   ");
50fb299fa2Sopenharmony_ci    Utils::Trim(std::string(reinterpret_cast<const char*>(data), size));
51fb299fa2Sopenharmony_ci}
52fb299fa2Sopenharmony_ci
53fb299fa2Sopenharmony_civoid TestConvertSha256Hex(void)
54fb299fa2Sopenharmony_ci{
55fb299fa2Sopenharmony_ci    uint8_t a[1] = {0};
56fb299fa2Sopenharmony_ci    a[0] = 1;
57fb299fa2Sopenharmony_ci    Utils::ConvertSha256Hex(a, 1);
58fb299fa2Sopenharmony_ci}
59fb299fa2Sopenharmony_ci
60fb299fa2Sopenharmony_civoid TestSplitString(void)
61fb299fa2Sopenharmony_ci{
62fb299fa2Sopenharmony_ci    Utils::SplitString("aaa\nbbb", "\n");
63fb299fa2Sopenharmony_ci}
64fb299fa2Sopenharmony_ci
65fb299fa2Sopenharmony_civoid TestMkdirRecursive(void)
66fb299fa2Sopenharmony_ci{
67fb299fa2Sopenharmony_ci    Utils::MkdirRecursive("/data/xx?xx", S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
68fb299fa2Sopenharmony_ci}
69fb299fa2Sopenharmony_ci
70fb299fa2Sopenharmony_civoid TestString2Int(void)
71fb299fa2Sopenharmony_ci{
72fb299fa2Sopenharmony_ci    Utils::String2Int<int>("", 10); // 10 : size
73fb299fa2Sopenharmony_ci    Utils::String2Int<int>("0x01", 10); // 10 : size
74fb299fa2Sopenharmony_ci}
75fb299fa2Sopenharmony_ci
76fb299fa2Sopenharmony_civoid TestGetFilesFromDirectory(void)
77fb299fa2Sopenharmony_ci{
78fb299fa2Sopenharmony_ci    std::vector<std::string> files;
79fb299fa2Sopenharmony_ci    Utils::SaveLogs();
80fb299fa2Sopenharmony_ci    Utils::CompressLogs("/data/updater/log/updater_log_test");
81fb299fa2Sopenharmony_ci    Utils::GetFilesFromDirectory("/data/updater/log", files, true);
82fb299fa2Sopenharmony_ci}
83fb299fa2Sopenharmony_ci
84fb299fa2Sopenharmony_civoid TestRemoveDir(void)
85fb299fa2Sopenharmony_ci{
86fb299fa2Sopenharmony_ci    string path = "";
87fb299fa2Sopenharmony_ci    Utils::RemoveDir(path);
88fb299fa2Sopenharmony_ci    path = "/data/updater/utils/nonExistDir";
89fb299fa2Sopenharmony_ci    Utils::RemoveDir(path);
90fb299fa2Sopenharmony_ci    path = "/data/updater/rmDir";
91fb299fa2Sopenharmony_ci    int ret = mkdir(path.c_str(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
92fb299fa2Sopenharmony_ci    if (ret == 0) {
93fb299fa2Sopenharmony_ci        ofstream tmpFile;
94fb299fa2Sopenharmony_ci        string filePath = path + "/tmpFile";
95fb299fa2Sopenharmony_ci        tmpFile.open(filePath.c_str());
96fb299fa2Sopenharmony_ci        if (tmpFile.is_open()) {
97fb299fa2Sopenharmony_ci            tmpFile.close();
98fb299fa2Sopenharmony_ci            Utils::RemoveDir(path);
99fb299fa2Sopenharmony_ci        }
100fb299fa2Sopenharmony_ci    }
101fb299fa2Sopenharmony_ci}
102fb299fa2Sopenharmony_ci
103fb299fa2Sopenharmony_civoid TestIsUpdaterMode(void)
104fb299fa2Sopenharmony_ci{
105fb299fa2Sopenharmony_ci    Utils::IsUpdaterMode();
106fb299fa2Sopenharmony_ci}
107fb299fa2Sopenharmony_ci
108fb299fa2Sopenharmony_civoid TestIsFileExist(void)
109fb299fa2Sopenharmony_ci{
110fb299fa2Sopenharmony_ci    Utils::IsFileExist("/bin/test_updater");
111fb299fa2Sopenharmony_ci    Utils::IsFileExist("/bin/updater_binary");
112fb299fa2Sopenharmony_ci}
113fb299fa2Sopenharmony_ci
114fb299fa2Sopenharmony_civoid TestIsDirExist(void)
115fb299fa2Sopenharmony_ci{
116fb299fa2Sopenharmony_ci    Utils::IsDirExist("/bin/test_updater");
117fb299fa2Sopenharmony_ci    Utils::IsDirExist("/bin");
118fb299fa2Sopenharmony_ci    Utils::IsDirExist("/bin/");
119fb299fa2Sopenharmony_ci}
120fb299fa2Sopenharmony_ci
121fb299fa2Sopenharmony_civoid TestCopyUpdaterLogs(void)
122fb299fa2Sopenharmony_ci{
123fb299fa2Sopenharmony_ci    const std::string sLog = "/data/updater/main_data/updater.tab";
124fb299fa2Sopenharmony_ci    const std::string dLog = "/data/updater/main_data/ut_dLog.txt";
125fb299fa2Sopenharmony_ci    Utils::CopyUpdaterLogs(sLog, dLog);
126fb299fa2Sopenharmony_ci    unlink(dLog.c_str());
127fb299fa2Sopenharmony_ci}
128fb299fa2Sopenharmony_ci
129fb299fa2Sopenharmony_civoid TestGetDirSizeForFile(void)
130fb299fa2Sopenharmony_ci{
131fb299fa2Sopenharmony_ci    Utils::GetDirSizeForFile("xxx");
132fb299fa2Sopenharmony_ci    Utils::GetDirSizeForFile("xxx/xxx");
133fb299fa2Sopenharmony_ci    Utils::GetDirSizeForFile("/data/updater/updater/etc/fstab.ut.updater");
134fb299fa2Sopenharmony_ci}
135fb299fa2Sopenharmony_ci
136fb299fa2Sopenharmony_civoid TestJsonNodeValueKey(void)
137fb299fa2Sopenharmony_ci{
138fb299fa2Sopenharmony_ci    {
139fb299fa2Sopenharmony_ci        std::string str = R"({"key": "value1"})";
140fb299fa2Sopenharmony_ci        JsonNode node(str);
141fb299fa2Sopenharmony_ci        node.Key();
142fb299fa2Sopenharmony_ci        node["key"].Key();
143fb299fa2Sopenharmony_ci    }
144fb299fa2Sopenharmony_ci    {
145fb299fa2Sopenharmony_ci        std::string str = R"({"key"})";
146fb299fa2Sopenharmony_ci        JsonNode node(str);
147fb299fa2Sopenharmony_ci        node.Key();
148fb299fa2Sopenharmony_ci    }
149fb299fa2Sopenharmony_ci}
150fb299fa2Sopenharmony_ci
151fb299fa2Sopenharmony_civoid TestJsonNodeKey(void)
152fb299fa2Sopenharmony_ci{
153fb299fa2Sopenharmony_ci    std::string str = R"({"key": "value1"})";
154fb299fa2Sopenharmony_ci    JsonNode node(str);
155fb299fa2Sopenharmony_ci    node["key"];
156fb299fa2Sopenharmony_ci}
157fb299fa2Sopenharmony_ci
158fb299fa2Sopenharmony_civoid TestJsonNodeValueTypeStr(void)
159fb299fa2Sopenharmony_ci{
160fb299fa2Sopenharmony_ci    std::string str = R"({"key": "value1"})";
161fb299fa2Sopenharmony_ci    JsonNode node(str);
162fb299fa2Sopenharmony_ci    node["key"].Type();
163fb299fa2Sopenharmony_ci    node["key"];
164fb299fa2Sopenharmony_ci}
165fb299fa2Sopenharmony_ci
166fb299fa2Sopenharmony_civoid TestJsonNodeValueTypeInt(void)
167fb299fa2Sopenharmony_ci{
168fb299fa2Sopenharmony_ci    std::string str = R"({"key": 1})";
169fb299fa2Sopenharmony_ci    JsonNode node(str);
170fb299fa2Sopenharmony_ci    node["key"].Type();
171fb299fa2Sopenharmony_ci    node["key"];
172fb299fa2Sopenharmony_ci}
173fb299fa2Sopenharmony_ci
174fb299fa2Sopenharmony_civoid TestJsonNodeValueTypeBool(void)
175fb299fa2Sopenharmony_ci{
176fb299fa2Sopenharmony_ci    std::string str = R"({"key": true})";
177fb299fa2Sopenharmony_ci    JsonNode node(str);
178fb299fa2Sopenharmony_ci    node["key"].Type();
179fb299fa2Sopenharmony_ci    node["key"];
180fb299fa2Sopenharmony_ci}
181fb299fa2Sopenharmony_ci
182fb299fa2Sopenharmony_civoid TestJsonNodeValueTypeArray(void)
183fb299fa2Sopenharmony_ci{
184fb299fa2Sopenharmony_ci    std::string str = R"({"key": [1, true, "value"]})";
185fb299fa2Sopenharmony_ci    JsonNode node(str);
186fb299fa2Sopenharmony_ci    node["key"].Type();
187fb299fa2Sopenharmony_ci    node["key"][0];
188fb299fa2Sopenharmony_ci    node["key"][1];
189fb299fa2Sopenharmony_ci    node["key"][2]; // 2 : value index
190fb299fa2Sopenharmony_ci}
191fb299fa2Sopenharmony_ci
192fb299fa2Sopenharmony_ci
193fb299fa2Sopenharmony_civoid TestJsonNodeValueTypeObject(void)
194fb299fa2Sopenharmony_ci{
195fb299fa2Sopenharmony_ci    std::string str = R"({"key": {"key" : "value"}}})";
196fb299fa2Sopenharmony_ci    JsonNode node(str);
197fb299fa2Sopenharmony_ci    node["key"].Type();
198fb299fa2Sopenharmony_ci    node["key"]["key"];
199fb299fa2Sopenharmony_ci}
200fb299fa2Sopenharmony_ci
201fb299fa2Sopenharmony_civoid TestJsonNodeValueTypeNull(void)
202fb299fa2Sopenharmony_ci{
203fb299fa2Sopenharmony_ci    std::string str = R"({"key1": null})";
204fb299fa2Sopenharmony_ci    JsonNode node(str);
205fb299fa2Sopenharmony_ci    node["key1"].Type();
206fb299fa2Sopenharmony_ci}
207fb299fa2Sopenharmony_ci
208fb299fa2Sopenharmony_civoid TestJsonNodeValueTypeUnknow(void)
209fb299fa2Sopenharmony_ci{
210fb299fa2Sopenharmony_ci    std::string str = R"({"key":})";
211fb299fa2Sopenharmony_ci    JsonNode node(str);
212fb299fa2Sopenharmony_ci    node.Type();
213fb299fa2Sopenharmony_ci}
214fb299fa2Sopenharmony_ci
215fb299fa2Sopenharmony_civoid TestJsonNodeValueTypeJsonNode(void)
216fb299fa2Sopenharmony_ci{
217fb299fa2Sopenharmony_ci    std::string str = R"(
218fb299fa2Sopenharmony_ci    {
219fb299fa2Sopenharmony_ci        "A": "B",
220fb299fa2Sopenharmony_ci        "C": {
221fb299fa2Sopenharmony_ci            "D": "E",
222fb299fa2Sopenharmony_ci            "F": {
223fb299fa2Sopenharmony_ci                "G": {
224fb299fa2Sopenharmony_ci                    "H": "I",
225fb299fa2Sopenharmony_ci                    "J": 8879,
226fb299fa2Sopenharmony_ci                    "K": {
227fb299fa2Sopenharmony_ci                        "L": "M",
228fb299fa2Sopenharmony_ci                        "N": ["O", "P"]
229fb299fa2Sopenharmony_ci                    },
230fb299fa2Sopenharmony_ci                    "L": true
231fb299fa2Sopenharmony_ci                }
232fb299fa2Sopenharmony_ci            }
233fb299fa2Sopenharmony_ci        }
234fb299fa2Sopenharmony_ci    })";
235fb299fa2Sopenharmony_ci    JsonNode node(str);
236fb299fa2Sopenharmony_ci    const JsonNode &nodeC = node["C"];
237fb299fa2Sopenharmony_ci    const JsonNode &nodeG = nodeC["F"]["G"];
238fb299fa2Sopenharmony_ci    node.Type();
239fb299fa2Sopenharmony_ci    node["A"];
240fb299fa2Sopenharmony_ci    nodeC["D"];
241fb299fa2Sopenharmony_ci    nodeG["H"];
242fb299fa2Sopenharmony_ci    nodeG["J"];
243fb299fa2Sopenharmony_ci    nodeG["K"]["L"];
244fb299fa2Sopenharmony_ci    nodeG["K"]["N"][0];
245fb299fa2Sopenharmony_ci    nodeG["K"]["N"][1];
246fb299fa2Sopenharmony_ci    nodeG["L"];
247fb299fa2Sopenharmony_ci}
248fb299fa2Sopenharmony_ci
249fb299fa2Sopenharmony_civoid TestJsonNodeKey1Type(void)
250fb299fa2Sopenharmony_ci{
251fb299fa2Sopenharmony_ci    std::string str = R"({"key": "value1"})";
252fb299fa2Sopenharmony_ci    JsonNode node(str);
253fb299fa2Sopenharmony_ci    node["key1"].Type();
254fb299fa2Sopenharmony_ci}
255fb299fa2Sopenharmony_ci
256fb299fa2Sopenharmony_civoid TestJsonNodeValueTypeString(void)
257fb299fa2Sopenharmony_ci{
258fb299fa2Sopenharmony_ci    {
259fb299fa2Sopenharmony_ci        std::string str = R"({"key": "value1"})";
260fb299fa2Sopenharmony_ci        JsonNode node(str);
261fb299fa2Sopenharmony_ci        node["key"].Type();
262fb299fa2Sopenharmony_ci        node["key1"].Type();
263fb299fa2Sopenharmony_ci        node["key"].Type();
264fb299fa2Sopenharmony_ci    }
265fb299fa2Sopenharmony_ci    {
266fb299fa2Sopenharmony_ci        std::string str = R"({"key": [1]})";
267fb299fa2Sopenharmony_ci        JsonNode node(str);
268fb299fa2Sopenharmony_ci        node["key"].Type();
269fb299fa2Sopenharmony_ci        node["key"][0].Type();
270fb299fa2Sopenharmony_ci        node["key"][1].Type();
271fb299fa2Sopenharmony_ci    }
272fb299fa2Sopenharmony_ci}
273fb299fa2Sopenharmony_ci
274fb299fa2Sopenharmony_civoid TestJsonNodeTypeUnknow(void)
275fb299fa2Sopenharmony_ci{
276fb299fa2Sopenharmony_ci    JsonNode node(Fs::path {R"(\invalid)"});
277fb299fa2Sopenharmony_ci    node.Type();
278fb299fa2Sopenharmony_ci}
279fb299fa2Sopenharmony_ci
280fb299fa2Sopenharmony_civoid TestJsonNodeTypeUnknow1(void)
281fb299fa2Sopenharmony_ci{
282fb299fa2Sopenharmony_ci    JsonNode node(Fs::path {"/data/noexist"});
283fb299fa2Sopenharmony_ci    node.Type();
284fb299fa2Sopenharmony_ci}
285fb299fa2Sopenharmony_ci
286fb299fa2Sopenharmony_civoid TestJsonNodeFileType(void)
287fb299fa2Sopenharmony_ci{
288fb299fa2Sopenharmony_ci    constexpr auto invalidContent = R"({ "key" : "value")";
289fb299fa2Sopenharmony_ci    constexpr auto invalidJsonPath = "/tmp/tmp.json";
290fb299fa2Sopenharmony_ci    {
291fb299fa2Sopenharmony_ci        std::ofstream ofs(Fs::path {invalidJsonPath});
292fb299fa2Sopenharmony_ci        ofs << invalidContent;
293fb299fa2Sopenharmony_ci        ofs.flush();
294fb299fa2Sopenharmony_ci    }
295fb299fa2Sopenharmony_ci    JsonNode node(Fs::path {invalidJsonPath});
296fb299fa2Sopenharmony_ci    node.Type();
297fb299fa2Sopenharmony_ci    DeleteFile(invalidJsonPath);
298fb299fa2Sopenharmony_ci}
299fb299fa2Sopenharmony_ci
300fb299fa2Sopenharmony_civoid TestJsonNodeOperation(void)
301fb299fa2Sopenharmony_ci{
302fb299fa2Sopenharmony_ci    std::string str = R"({"key":[1, true, "value"]})";
303fb299fa2Sopenharmony_ci    JsonNode node {str};
304fb299fa2Sopenharmony_ci    constexpr int intVal = 2;
305fb299fa2Sopenharmony_ci    constexpr bool boolVal = false;
306fb299fa2Sopenharmony_ci    const char *strVal = "newValue";
307fb299fa2Sopenharmony_ci    int idx = 0;
308fb299fa2Sopenharmony_ci    node["key"][idx++] = intVal;
309fb299fa2Sopenharmony_ci    node["key"][idx++] = boolVal;
310fb299fa2Sopenharmony_ci    node["key"][idx++] = strVal;
311fb299fa2Sopenharmony_ci    node["key"][--idx];
312fb299fa2Sopenharmony_ci    node["key"][--idx];
313fb299fa2Sopenharmony_ci    node["key"][--idx];
314fb299fa2Sopenharmony_ci}
315fb299fa2Sopenharmony_ci
316fb299fa2Sopenharmony_civoid TestJsonNodeValueIntChange(void)
317fb299fa2Sopenharmony_ci{
318fb299fa2Sopenharmony_ci    std::string str = R"({"key":1})";
319fb299fa2Sopenharmony_ci    JsonNode node {str};
320fb299fa2Sopenharmony_ci    constexpr int intVal = 2;
321fb299fa2Sopenharmony_ci    node["key"] = intVal;
322fb299fa2Sopenharmony_ci    node["key"];
323fb299fa2Sopenharmony_ci}
324fb299fa2Sopenharmony_ci
325fb299fa2Sopenharmony_civoid TestJsonNodeValueBoolChange(void)
326fb299fa2Sopenharmony_ci{
327fb299fa2Sopenharmony_ci    std::string str = R"({"key":true})";
328fb299fa2Sopenharmony_ci    JsonNode node {str};
329fb299fa2Sopenharmony_ci    constexpr bool boolVal = false;
330fb299fa2Sopenharmony_ci    node["key"] = boolVal;
331fb299fa2Sopenharmony_ci    node["key"];
332fb299fa2Sopenharmony_ci}
333fb299fa2Sopenharmony_ci
334fb299fa2Sopenharmony_civoid TestJsonNodeValueStrChange(void)
335fb299fa2Sopenharmony_ci{
336fb299fa2Sopenharmony_ci    std::string str = R"({"key":"value"})";
337fb299fa2Sopenharmony_ci    JsonNode node {str};
338fb299fa2Sopenharmony_ci    const char *strVal = "newValue";
339fb299fa2Sopenharmony_ci    node["key"] = strVal;
340fb299fa2Sopenharmony_ci    node["key"];
341fb299fa2Sopenharmony_ci}
342fb299fa2Sopenharmony_ci
343fb299fa2Sopenharmony_civoid TestJsonNodeValueArrayChange(void)
344fb299fa2Sopenharmony_ci{
345fb299fa2Sopenharmony_ci    std::string str = R"({"key1":{
346fb299fa2Sopenharmony_ci        "key2":1,
347fb299fa2Sopenharmony_ci        "key3":"value"
348fb299fa2Sopenharmony_ci    }})";
349fb299fa2Sopenharmony_ci    JsonNode node {str};
350fb299fa2Sopenharmony_ci    constexpr int newValue = 2;
351fb299fa2Sopenharmony_ci    node["key1"]["key2"] = newValue;
352fb299fa2Sopenharmony_ci    node["key1"]["key3"] = "value2";
353fb299fa2Sopenharmony_ci    node["key1"]["key2"];
354fb299fa2Sopenharmony_ci    node["key1"]["key3"];
355fb299fa2Sopenharmony_ci}
356fb299fa2Sopenharmony_ci
357fb299fa2Sopenharmony_civoid TestJsonNodeValueChange(void)
358fb299fa2Sopenharmony_ci{
359fb299fa2Sopenharmony_ci    std::string str = R"({"key" : 1})";
360fb299fa2Sopenharmony_ci    JsonNode node {str};
361fb299fa2Sopenharmony_ci    node["key"] = false;
362fb299fa2Sopenharmony_ci    node["key"];
363fb299fa2Sopenharmony_ci    node["key"] = "newValue";
364fb299fa2Sopenharmony_ci    node["key"];
365fb299fa2Sopenharmony_ci}
366fb299fa2Sopenharmony_ci}
367fb299fa2Sopenharmony_ci
368fb299fa2Sopenharmony_cinamespace OHOS {
369fb299fa2Sopenharmony_ci    void FuzzUtils(const uint8_t* data, size_t size)
370fb299fa2Sopenharmony_ci    {
371fb299fa2Sopenharmony_ci        CloseStdout();
372fb299fa2Sopenharmony_ci        TestTrim(data, size);
373fb299fa2Sopenharmony_ci        TestConvertSha256Hex();
374fb299fa2Sopenharmony_ci        TestSplitString();
375fb299fa2Sopenharmony_ci        TestMkdirRecursive();
376fb299fa2Sopenharmony_ci        TestString2Int();
377fb299fa2Sopenharmony_ci        TestGetFilesFromDirectory();
378fb299fa2Sopenharmony_ci        TestRemoveDir();
379fb299fa2Sopenharmony_ci        TestIsUpdaterMode();
380fb299fa2Sopenharmony_ci        TestIsFileExist();
381fb299fa2Sopenharmony_ci        TestIsDirExist();
382fb299fa2Sopenharmony_ci        TestCopyUpdaterLogs();
383fb299fa2Sopenharmony_ci        TestGetDirSizeForFile();
384fb299fa2Sopenharmony_ci        TestJsonNodeValueKey();
385fb299fa2Sopenharmony_ci        TestJsonNodeKey();
386fb299fa2Sopenharmony_ci        TestJsonNodeValueTypeStr();
387fb299fa2Sopenharmony_ci        TestJsonNodeValueTypeInt();
388fb299fa2Sopenharmony_ci        TestJsonNodeValueTypeBool();
389fb299fa2Sopenharmony_ci        TestJsonNodeValueTypeArray();
390fb299fa2Sopenharmony_ci        TestJsonNodeValueTypeObject();
391fb299fa2Sopenharmony_ci        TestJsonNodeValueTypeNull();
392fb299fa2Sopenharmony_ci        TestJsonNodeValueTypeUnknow();
393fb299fa2Sopenharmony_ci        TestJsonNodeValueTypeJsonNode();
394fb299fa2Sopenharmony_ci        TestJsonNodeKey1Type();
395fb299fa2Sopenharmony_ci        TestJsonNodeValueTypeString();
396fb299fa2Sopenharmony_ci        TestJsonNodeTypeUnknow();
397fb299fa2Sopenharmony_ci        TestJsonNodeTypeUnknow1();
398fb299fa2Sopenharmony_ci        TestJsonNodeFileType();
399fb299fa2Sopenharmony_ci        TestJsonNodeOperation();
400fb299fa2Sopenharmony_ci        TestJsonNodeValueIntChange();
401fb299fa2Sopenharmony_ci        TestJsonNodeValueBoolChange();
402fb299fa2Sopenharmony_ci        TestJsonNodeValueStrChange();
403fb299fa2Sopenharmony_ci        TestJsonNodeValueArrayChange();
404fb299fa2Sopenharmony_ci        TestJsonNodeValueChange();
405fb299fa2Sopenharmony_ci    }
406fb299fa2Sopenharmony_ci}
407fb299fa2Sopenharmony_ci
408fb299fa2Sopenharmony_ci/* Fuzzer entry point */
409fb299fa2Sopenharmony_ciextern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
410fb299fa2Sopenharmony_ci{
411fb299fa2Sopenharmony_ci    /* Run your code on data */
412fb299fa2Sopenharmony_ci    OHOS::FuzzUtils(data, size);
413fb299fa2Sopenharmony_ci    return 0;
414fb299fa2Sopenharmony_ci}
415