未验证 提交 85a97645 编写于 作者: O openharmony_ci 提交者: Gitee

!358 fix: fuzztest code build problem

Merge pull request !358 from 熊磊/init0302xyt
......@@ -77,7 +77,8 @@
}
],
"test": [
"//base/startup/init_lite/test/unittest:init_test"
"//base/startup/init_lite/test/unittest:init_test",
"//base/startup/init_lite/test/fuzztest:fuzztest"
]
}
}
......
......@@ -30,7 +30,10 @@ ohos_static_library("libfuzz_utils") {
ohos_fuzztest("DoRebootFuzzTest") {
module_out_path = module_output_path
include_dirs = [ "//base/startup/init_lite/interfaces/innerkits/include" ]
include_dirs = [
"//base/startup/init_lite/interfaces/innerkits/include",
"//base/startup/init_lite/test/fuzztest/utils/include",
]
deps = [
"//base/startup/init_lite/interfaces/innerkits:libbegetutil",
......@@ -53,7 +56,10 @@ ohos_fuzztest("DoRebootFuzzTest") {
ohos_fuzztest("GetControlFileFuzzTest") {
module_out_path = module_output_path
include_dirs = [ "//base/startup/init_lite/interfaces/innerkits/include" ]
include_dirs = [
"//base/startup/init_lite/interfaces/innerkits/include",
"//base/startup/init_lite/test/fuzztest/utils/include",
]
deps = [
"//base/startup/init_lite/interfaces/innerkits:libbegetutil",
......@@ -76,7 +82,10 @@ ohos_fuzztest("GetControlFileFuzzTest") {
ohos_fuzztest("GetControlSocketFuzzTest") {
module_out_path = module_output_path
include_dirs = [ "//base/startup/init_lite/interfaces/innerkits/include" ]
include_dirs = [
"//base/startup/init_lite/interfaces/innerkits/include",
"//base/startup/init_lite/test/fuzztest/utils/include",
]
deps = [
"//base/startup/init_lite/interfaces/innerkits:libbegetutil",
......@@ -128,6 +137,7 @@ ohos_fuzztest("ReadFileInDirFuzzTest") {
include_dirs = [
"//base/startup/init_lite/services/init/include",
"//base/startup/init_lite/services/include",
"//base/startup/init_lite/test/fuzztest/utils/include",
]
deps = [
......@@ -150,7 +160,10 @@ ohos_fuzztest("ReadFileInDirFuzzTest") {
ohos_fuzztest("ServiceControlStartFuzzTest") {
module_out_path = module_output_path
include_dirs = [ "//base/startup/init_lite/interfaces/innerkits/include" ]
include_dirs = [
"//base/startup/init_lite/interfaces/innerkits/include",
"//base/startup/init_lite/test/fuzztest/utils/include",
]
deps = [
"//base/startup/init_lite/interfaces/innerkits:libbegetutil",
"//base/startup/init_lite/services/param:param_client",
......@@ -171,7 +184,10 @@ ohos_fuzztest("ServiceControlStartFuzzTest") {
ohos_fuzztest("ServiceControlStopFuzzTest") {
module_out_path = module_output_path
include_dirs = [ "//base/startup/init_lite/interfaces/innerkits/include" ]
include_dirs = [
"//base/startup/init_lite/interfaces/innerkits/include",
"//base/startup/init_lite/test/fuzztest/utils/include",
]
deps = [
"//base/startup/init_lite/interfaces/innerkits:libbegetutil",
"//base/startup/init_lite/services/param:param_client",
......@@ -219,7 +235,10 @@ ohos_fuzztest("SystemDumpParametersFuzzTest") {
ohos_fuzztest("SystemFindParameterFuzzTest") {
module_out_path = module_output_path
include_dirs = [ "//base/startup/init_lite/services/include/param" ]
include_dirs = [
"//base/startup/init_lite/services/include/param",
"//base/startup/init_lite/test/fuzztest/utils/include",
]
deps = [
"//base/startup/init_lite/services/log:agent_log",
......@@ -242,7 +261,10 @@ ohos_fuzztest("SystemFindParameterFuzzTest") {
ohos_fuzztest("SystemGetParameterFuzzTest") {
module_out_path = module_output_path
include_dirs = [ "//base/startup/init_lite/services/include/param" ]
include_dirs = [
"//base/startup/init_lite/services/include/param",
"//base/startup/init_lite/test/fuzztest/utils/include",
]
deps = [
"//base/startup/init_lite/services/log:agent_log",
......@@ -265,7 +287,10 @@ ohos_fuzztest("SystemGetParameterFuzzTest") {
ohos_fuzztest("SystemGetParameterCommitIdFuzzTest") {
module_out_path = module_output_path
include_dirs = [ "//base/startup/init_lite/services/include/param" ]
include_dirs = [
"//base/startup/init_lite/services/include/param",
"//base/startup/init_lite/test/fuzztest/utils/include",
]
deps = [
"//base/startup/init_lite/services/log:agent_log",
......@@ -290,7 +315,10 @@ ohos_fuzztest("SystemGetParameterCommitIdFuzzTest") {
ohos_fuzztest("SystemGetParameterNameFuzzTest") {
module_out_path = module_output_path
include_dirs = [ "//base/startup/init_lite/services/include/param" ]
include_dirs = [
"//base/startup/init_lite/services/include/param",
"//base/startup/init_lite/test/fuzztest/utils/include",
]
deps = [
"//base/startup/init_lite/services/log:agent_log",
......@@ -314,7 +342,10 @@ ohos_fuzztest("SystemGetParameterNameFuzzTest") {
ohos_fuzztest("SystemGetParameterValueFuzzTest") {
module_out_path = module_output_path
include_dirs = [ "//base/startup/init_lite/services/include/param" ]
include_dirs = [
"//base/startup/init_lite/services/include/param",
"//base/startup/init_lite/test/fuzztest/utils/include",
]
deps = [
"//base/startup/init_lite/services/log:agent_log",
......@@ -338,7 +369,10 @@ ohos_fuzztest("SystemGetParameterValueFuzzTest") {
ohos_fuzztest("SystemSetParameterFuzztest") {
module_out_path = module_output_path
include_dirs = [ "//base/startup/init_lite/services/include/param" ]
include_dirs = [
"//base/startup/init_lite/services/include/param",
"//base/startup/init_lite/test/fuzztest/utils/include",
]
deps = [
"//base/startup/init_lite/services/log:agent_log",
......@@ -391,7 +425,10 @@ ohos_fuzztest("SystemTraversalParameterFuzztest") {
ohos_fuzztest("SystemWaitParameterFuzzTest") {
module_out_path = module_output_path
include_dirs = [ "//base/startup/init_lite/services/include/param" ]
include_dirs = [
"//base/startup/init_lite/services/include/param",
"//base/startup/init_lite/test/fuzztest/utils/include",
]
deps = [
"//base/startup/init_lite/services/log:agent_log",
......@@ -417,6 +454,7 @@ ohos_fuzztest("SystemWatchParameterFuzzTest") {
include_dirs = [
"//base/startup/init_lite/services/include/param",
"//base/startup/init_lite/services/init/include",
"//base/startup/init_lite/test/fuzztest/utils/include",
]
deps = [
......@@ -454,7 +492,7 @@ ohos_fuzztest("UmountAllFstabFuzzTest") {
]
deps = [
"//base/startup/init_lite/interfaces/innerkits/fs_manager:libfsmanager_static",
"//base/startup/init_lite/interfaces/innerkits:libfsmanager_static",
"//base/startup/init_lite/services/log:init_log",
"//base/startup/init_lite/services/utils:libinit_utils",
"//base/startup/init_lite/test/fuzztest:libfuzz_utils",
......@@ -483,8 +521,8 @@ group("fuzztest") {
":GetControlSocketFuzzTest",
":MountAllFstabFuzzTest",
":ReadFileInDirFuzzTest",
":StartDynamicProcessFuzzTest",
":StopDynamicProcessFuzzTest",
":ServiceControlStartFuzzTest",
":ServiceControlStopFuzzTest",
":SystemDumpParametersFuzzTest",
":SystemFindParameterFuzzTest",
":SystemGetParameterCommitIdFuzzTest",
......
......@@ -15,5 +15,6 @@
#ifndef TEST_FUZZTEST_DOREBOOT_FUZZER_H
#define TEST_FUZZTEST_DOREBOOT_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "DoReboot_fuzzer"
#endif
......@@ -15,5 +15,6 @@
#ifndef TEST_FUZZTEST_GETCONTROLFILE_FUZZER_H
#define TEST_FUZZTEST_GETCONTROLFILE_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "GetControlFile_fuzzer"
#endif
......@@ -15,5 +15,6 @@
#ifndef TEST_FUZZTEST_GETCONTROLSOCKET_FUZZER_H
#define TEST_FUZZTEST_GETCONTROLSOCKET_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "GetControlSocket_fuzzer"
#endif
......@@ -29,7 +29,7 @@ namespace OHOS {
std::cout << "[fuzz] open file fstab.test failed";
return false;
}
if (reinterpret_cast<int>(fwrite(data, 1, size, pFile)) != size) {
if (fwrite(data, 1, size, pFile) != size) {
std::cout << "[fuzz] write data to fstab.test failed";
(void)fclose(pFile);
return false;
......
......@@ -15,5 +15,6 @@
#ifndef TEST_FUZZTEST_MOUNTALLFSTAB_FUZZER_H
#define TEST_FUZZTEST_MOUNTALLFSTAB_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "MountAllFstab_fuzzer"
#endif
......@@ -47,7 +47,7 @@ namespace OHOS {
std::cout << "[fuzz] open file ReadFileInDir.test failed";
return false;
}
if (reinterpret_cast<int>(fwrite(data, 1, size, pFile)) != size) {
if (fwrite(data, 1, size, pFile) != size) {
std::cout << "[fuzz] write data to ReadFileInDir.test failed";
(void)fclose(pFile);
return false;
......
......@@ -15,5 +15,6 @@
#ifndef TEST_FUZZTEST_READFILEINDIR_FUZZER_H
#define TEST_FUZZTEST_READFILEINDIR_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "ReadFileInDir_fuzzer"
#endif
......@@ -20,7 +20,7 @@ namespace OHOS {
bool FuzzServiceControlStart(const uint8_t* data, size_t size)
{
bool result = false;
if (!ServiceControl(reinterpret_cast<const char*>(data)), START) {
if (!ServiceControl(reinterpret_cast<const char*>(data), START)) {
result = true;
}
return result;
......
......@@ -15,5 +15,6 @@
#ifndef TEST_FUZZTEST_STARTDYNAMICPROCESS_FUZZER_H
#define TEST_FUZZTEST_STARTDYNAMICPROCESS_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "ServiceControlStart_fuzzer"
#endif
......@@ -20,7 +20,7 @@ namespace OHOS {
bool FuzzServiceControlStop(const uint8_t* data, size_t size)
{
bool result = false;
if (!ServiceControl(reinterpret_cast<const char*>(data)), STOP) {
if (!ServiceControl(reinterpret_cast<const char*>(data), STOP)) {
result = true;
}
return result;
......
......@@ -15,5 +15,6 @@
#ifndef TEST_FUZZTEST_STOPDYNAMICPROCESS_FUZZER_H
#define TEST_FUZZTEST_STOPDYNAMICPROCESS_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "ServiceControlStop_fuzzer"
#endif
......@@ -15,5 +15,6 @@
#ifndef TEST_FUZZTEST_SYSTEMDUMPPARAMETERS_FUZZER_H
#define TEST_FUZZTEST_SYSTEMDUMPPARAMETERS_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "SystemDumpParameters_fuzzer"
#endif
......@@ -15,5 +15,6 @@
#ifndef TEST_FUZZTEST_SYSTEMFINDPARAMETER_FUZZER_H
#define TEST_FUZZTEST_SYSTEMFINDPARAMETER_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "SystemFindParameter_fuzzer"
#endif
......@@ -15,5 +15,6 @@
#ifndef TEST_FUZZTEST_SYSTEMGETPARAMETERCOMMITID_FUZZER_H
#define TEST_FUZZTEST_SYSTEMGETPARAMETERCOMMITID_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "SystemGetParameterCommitId_fuzzer"
#endif
......@@ -15,5 +15,6 @@
#ifndef TEST_FUZZTEST_SYSTEMGETPARAMETERNAME_FUZZER_H
#define TEST_FUZZTEST_SYSTEMGETPARAMETERNAME_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "SystemGetParameterName_fuzzer"
#endif
......@@ -15,5 +15,6 @@
#ifndef TEST_FUZZTEST_SYSTEMGETPARAMETERVALUE_FUZZER_H
#define TEST_FUZZTEST_SYSTEMGETPARAMETERVALUE_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "SystemGetParameterValue_fuzzer"
#endif
......@@ -15,5 +15,6 @@
#ifndef TEST_FUZZTEST_SYSTEMGETPARAMETER_FUZZER_H
#define TEST_FUZZTEST_SYSTEMGETPARAMETER_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "SystemGetParameter_fuzzer"
#endif
......@@ -15,5 +15,6 @@
#ifndef TEST_FUZZTEST_SYSTEMSETPARAMETER_FUZZER_H
#define TEST_FUZZTEST_SYSTEMSETPARAMETER_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "SystemSetParameter_fuzzer"
#endif
......@@ -51,7 +51,7 @@ namespace OHOS {
if (ret != EOK) {
return false;
}
if (!SystemTraversalParameter(FakeShowParam, reinterpret_cast<void*>(cookie))) {
if (!SystemTraversalParameter(nullptr, FakeShowParam, reinterpret_cast<void*>(cookie))) {
result = true;
}
free(cookie->data);
......
......@@ -15,6 +15,7 @@
#ifndef TEST_FUZZTEST_SYSTEMTRAVERSALPARAMETER_FUZZER_H
#define TEST_FUZZTEST_SYSTEMTRAVERSALPARAMETER_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "SystemTraversalParameter_fuzzer"
typedef struct {
......
......@@ -15,5 +15,6 @@
#ifndef TEST_FUZZTEST_SYSTEMWAITPARAMETER_FUZZER_H
#define TEST_FUZZTEST_SYSTEMWAITPARAMETER_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "SystemWaitParameter_fuzzer"
#endif
......@@ -15,5 +15,6 @@
#ifndef TEST_FUZZTEST_SYSTEMWATCHPARAMETER_FUZZER_H
#define TEST_FUZZTEST_SYSTEMWATCHPARAMETER_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "SystemWatchParameter_fuzzer"
#endif
......@@ -29,7 +29,7 @@ namespace OHOS {
std::cout << "[fuzz] open file fstab.test failed";
return false;
}
if (reinterpret_cast<int>(fwrite(data, 1, size, pFile)) != size) {
if (fwrite(data, 1, size, pFile) != size) {
std::cout << "[fuzz] write data to fstab.test failed";
(void)fclose(pFile);
return false;
......
......@@ -15,5 +15,6 @@
#ifndef TEST_FUZZTEST_UMOUNTALLFSTAB_FUZZER_H
#define TEST_FUZZTEST_UMOUNTALLFSTAB_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "UmountAllFstab_fuzzer"
#endif
......@@ -15,6 +15,8 @@
#ifndef FUZZ_UTILS_H
#define FUZZ_UTILS_H
#include <stdint.h>
#include <stdlib.h>
void CloseStdout(void);
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册