BUILD.gn 15.3 KB
Newer Older
X
xionglei6 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# 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.

module_output_path = "startup/fuzztest"

#####################hydra-fuzz###################
import("//build/config/features.gni")
import("//build/ohos.gni")
X
xionglei6 已提交
19
import("//build/test.gni")
X
xionglei6 已提交
20
ohos_static_library("libfuzz_utils") {
X
xionglei6 已提交
21
  sources = [ "utils/fuzz_utils.cpp" ]
X
xionglei6 已提交
22 23 24 25 26 27 28 29

  include_dirs = [ "//base/startup/init_lite/test/fuzztest/utils/include" ]

  deps = []
  part_name = "init"
}

##############################fuzztest##########################################
X
xionglei6 已提交
30
ohos_fuzztest("test_startup_DoRebootFuzzTest") {
X
xionglei6 已提交
31 32
  module_out_path = module_output_path

X
xionglei6 已提交
33 34 35 36
  include_dirs = [
    "//base/startup/init_lite/interfaces/innerkits/include",
    "//base/startup/init_lite/test/fuzztest/utils/include",
  ]
X
xionglei6 已提交
37 38

  deps = [
39
    "//base/startup/init_lite/interfaces/innerkits:libbegetutil",
X
xionglei6 已提交
40 41 42 43 44 45 46 47 48 49 50
    "//base/startup/init_lite/services/log:init_log",
    "//base/startup/init_lite/services/param:param_client",
    "//third_party/bounds_checking_function:libsec_static",
  ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
X
xionglei6 已提交
51
  sources = [ "test_startup_DoReboot_fuzzer/test_startup_DoReboot_fuzzer.cpp" ]
X
xionglei6 已提交
52 53 54 55

  defines = [ "STARTUP_INIT_TEST" ]
}

X
xionglei6 已提交
56
ohos_fuzztest("test_startup_GetControlFileFuzzTest") {
X
xionglei6 已提交
57 58
  module_out_path = module_output_path

X
xionglei6 已提交
59 60 61 62
  include_dirs = [
    "//base/startup/init_lite/interfaces/innerkits/include",
    "//base/startup/init_lite/test/fuzztest/utils/include",
  ]
X
xionglei6 已提交
63 64

  deps = [
65
    "//base/startup/init_lite/interfaces/innerkits:libbegetutil",
X
xionglei6 已提交
66 67 68 69 70 71 72 73 74 75 76
    "//base/startup/init_lite/services/log:init_log",
    "//base/startup/init_lite/services/utils:libinit_utils",
    "//third_party/bounds_checking_function:libsec_static",
  ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
X
xionglei6 已提交
77 78 79
  sources = [
    "test_startup_GetControlFile_fuzzer/test_startup_GetControlFile_fuzzer.cpp",
  ]
X
xionglei6 已提交
80 81 82 83

  defines = [ "STARTUP_INIT_TEST" ]
}

X
xionglei6 已提交
84
ohos_fuzztest("test_startup_GetControlSocketFuzzTest") {
X
xionglei6 已提交
85 86
  module_out_path = module_output_path

X
xionglei6 已提交
87 88 89 90
  include_dirs = [
    "//base/startup/init_lite/interfaces/innerkits/include",
    "//base/startup/init_lite/test/fuzztest/utils/include",
  ]
X
xionglei6 已提交
91 92

  deps = [
93
    "//base/startup/init_lite/interfaces/innerkits:libbegetutil",
X
xionglei6 已提交
94 95 96 97 98 99 100 101 102 103
    "//base/startup/init_lite/services/log:init_log",
    "//third_party/bounds_checking_function:libsec_static",
  ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
X
xionglei6 已提交
104
  sources = [ "test_startup_GetControlSocket_fuzzer/test_startup_GetControlSocket_fuzzer.cpp" ]
X
xionglei6 已提交
105 106 107 108

  defines = [ "STARTUP_INIT_TEST" ]
}

X
xionglei6 已提交
109
ohos_fuzztest("test_startup_MountAllFstabFuzzTest") {
X
xionglei6 已提交
110 111 112 113 114 115 116 117
  module_out_path = module_output_path

  include_dirs = [
    "//base/startup/init_lite/interfaces/innerkits/include",
    "//base/startup/init_lite/test/fuzztest/utils/include",
  ]

  deps = [
118
    "//base/startup/init_lite/interfaces/innerkits:libbegetutil",
X
xionglei6 已提交
119 120 121 122 123 124 125 126 127 128 129 130
    "//base/startup/init_lite/services/log:init_log",
    "//base/startup/init_lite/services/utils:libinit_utils",
    "//base/startup/init_lite/test/fuzztest:libfuzz_utils",
    "//third_party/bounds_checking_function:libsec_static",
  ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
X
xionglei6 已提交
131 132 133
  sources = [
    "test_startup_MountAllFstab_fuzzer/test_startup_MountAllFstab_fuzzer.cpp",
  ]
X
xionglei6 已提交
134 135 136 137

  defines = [ "STARTUP_INIT_TEST" ]
}

X
xionglei6 已提交
138
ohos_fuzztest("test_startup_ReadFileInDirFuzzTest") {
X
xionglei6 已提交
139 140 141 142 143
  module_out_path = module_output_path

  include_dirs = [
    "//base/startup/init_lite/services/init/include",
    "//base/startup/init_lite/services/include",
X
xionglei6 已提交
144
    "//base/startup/init_lite/test/fuzztest/utils/include",
X
xionglei6 已提交
145 146 147 148 149 150 151 152 153 154 155 156 157 158
  ]

  deps = [
    "//base/startup/init_lite/services/log:init_log",
    "//base/startup/init_lite/services/utils:libinit_utils",
    "//third_party/bounds_checking_function:libsec_static",
  ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
X
xionglei6 已提交
159 160 161
  sources = [
    "test_startup_ReadFileInDir_fuzzer/test_startup_ReadFileInDir_fuzzer.cpp",
  ]
X
xionglei6 已提交
162 163 164 165

  defines = [ "STARTUP_INIT_TEST" ]
}

X
xionglei6 已提交
166
ohos_fuzztest("test_startup_ServiceControlStartFuzzTest") {
X
xionglei6 已提交
167 168
  module_out_path = module_output_path

X
xionglei6 已提交
169 170 171 172
  include_dirs = [
    "//base/startup/init_lite/interfaces/innerkits/include",
    "//base/startup/init_lite/test/fuzztest/utils/include",
  ]
X
xionglei6 已提交
173 174 175 176 177 178 179 180 181 182 183 184
  deps = [
    "//base/startup/init_lite/interfaces/innerkits:libbegetutil",
    "//base/startup/init_lite/services/param:param_client",
  ]
  external_deps = [ "hiviewdfx_hilog_native:libhilog" ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
X
xionglei6 已提交
185
  sources = [ "test_startup_ServiceControlStart_fuzzer/test_startup_ServiceControlStart_fuzzer.cpp" ]
X
xionglei6 已提交
186 187 188 189

  defines = [ "STARTUP_INIT_TEST" ]
}

X
xionglei6 已提交
190
ohos_fuzztest("test_startup_ServiceControlStopFuzzTest") {
X
xionglei6 已提交
191 192
  module_out_path = module_output_path

X
xionglei6 已提交
193 194 195 196
  include_dirs = [
    "//base/startup/init_lite/interfaces/innerkits/include",
    "//base/startup/init_lite/test/fuzztest/utils/include",
  ]
X
xionglei6 已提交
197 198 199 200 201 202 203 204 205 206 207 208
  deps = [
    "//base/startup/init_lite/interfaces/innerkits:libbegetutil",
    "//base/startup/init_lite/services/param:param_client",
  ]
  external_deps = [ "hiviewdfx_hilog_native:libhilog" ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
X
xionglei6 已提交
209
  sources = [ "test_startup_ServiceControlStop_fuzzer/test_startup_ServiceControlStop_fuzzer.cpp" ]
X
xionglei6 已提交
210 211 212 213

  defines = [ "STARTUP_INIT_TEST" ]
}

X
xionglei6 已提交
214
ohos_fuzztest("test_startup_SystemDumpParametersFuzzTest") {
X
xionglei6 已提交
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
  module_out_path = module_output_path

  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",
    "//base/startup/init_lite/services/param:param_client",
    "//base/startup/init_lite/test/fuzztest:libfuzz_utils",
    "//third_party/bounds_checking_function:libsec_static",
  ]
  external_deps = [ "hiviewdfx_hilog_native:libhilog" ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
X
xionglei6 已提交
236
  sources = [ "test_startup_SystemDumpParameters_fuzzer/test_startup_SystemDumpParameters_fuzzer.cpp" ]
X
xionglei6 已提交
237 238 239 240

  defines = [ "STARTUP_INIT_TEST" ]
}

X
xionglei6 已提交
241
ohos_fuzztest("test_startup_SystemFindParameterFuzzTest") {
X
xionglei6 已提交
242 243
  module_out_path = module_output_path

X
xionglei6 已提交
244 245 246 247
  include_dirs = [
    "//base/startup/init_lite/services/include/param",
    "//base/startup/init_lite/test/fuzztest/utils/include",
  ]
X
xionglei6 已提交
248 249 250 251 252 253 254 255 256 257 258 259 260 261

  deps = [
    "//base/startup/init_lite/services/log:agent_log",
    "//base/startup/init_lite/services/param:param_client",
    "//third_party/bounds_checking_function:libsec_static",
  ]
  external_deps = [ "hiviewdfx_hilog_native:libhilog" ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
X
xionglei6 已提交
262
  sources = [ "test_startup_SystemFindParameter_fuzzer/test_startup_SystemFindParameter_fuzzer.cpp" ]
X
xionglei6 已提交
263 264 265 266

  defines = [ "STARTUP_INIT_TEST" ]
}

X
xionglei6 已提交
267
ohos_fuzztest("test_startup_SystemGetParameterFuzzTest") {
X
xionglei6 已提交
268 269
  module_out_path = module_output_path

X
xionglei6 已提交
270 271 272 273
  include_dirs = [
    "//base/startup/init_lite/services/include/param",
    "//base/startup/init_lite/test/fuzztest/utils/include",
  ]
X
xionglei6 已提交
274 275 276 277 278 279 280 281 282 283 284 285 286 287

  deps = [
    "//base/startup/init_lite/services/log:agent_log",
    "//base/startup/init_lite/services/param:param_client",
    "//third_party/bounds_checking_function:libsec_static",
  ]
  external_deps = [ "hiviewdfx_hilog_native:libhilog" ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
X
xionglei6 已提交
288
  sources = [ "test_startup_SystemGetParameter_fuzzer/test_startup_SystemGetParameter_fuzzer.cpp" ]
X
xionglei6 已提交
289 290 291 292

  defines = [ "STARTUP_INIT_TEST" ]
}

X
xionglei6 已提交
293
ohos_fuzztest("test_startup_SystemGetParameterCommitIdFuzzTest") {
X
xionglei6 已提交
294 295
  module_out_path = module_output_path

X
xionglei6 已提交
296 297 298 299
  include_dirs = [
    "//base/startup/init_lite/services/include/param",
    "//base/startup/init_lite/test/fuzztest/utils/include",
  ]
X
xionglei6 已提交
300 301 302 303 304 305 306 307 308 309 310 311 312 313

  deps = [
    "//base/startup/init_lite/services/log:agent_log",
    "//base/startup/init_lite/services/param:param_client",
    "//third_party/bounds_checking_function:libsec_static",
  ]
  external_deps = [ "hiviewdfx_hilog_native:libhilog" ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
X
xionglei6 已提交
314
  sources = [ "test_startup_SystemGetParameterCommitId_fuzzer/test_startup_SystemGetParameterCommitId_fuzzer.cpp" ]
X
xionglei6 已提交
315 316 317 318

  defines = [ "STARTUP_INIT_TEST" ]
}

X
xionglei6 已提交
319
ohos_fuzztest("test_startup_SystemGetParameterNameFuzzTest") {
X
xionglei6 已提交
320 321
  module_out_path = module_output_path

X
xionglei6 已提交
322 323 324 325
  include_dirs = [
    "//base/startup/init_lite/services/include/param",
    "//base/startup/init_lite/test/fuzztest/utils/include",
  ]
X
xionglei6 已提交
326 327 328 329 330 331 332 333 334 335 336 337 338 339

  deps = [
    "//base/startup/init_lite/services/log:agent_log",
    "//base/startup/init_lite/services/param:param_client",
    "//third_party/bounds_checking_function:libsec_static",
  ]
  external_deps = [ "hiviewdfx_hilog_native:libhilog" ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
X
xionglei6 已提交
340
  sources = [ "test_startup_SystemGetParameterName_fuzzer/test_startup_SystemGetParameterName_fuzzer.cpp" ]
X
xionglei6 已提交
341 342 343 344

  defines = [ "STARTUP_INIT_TEST" ]
}

X
xionglei6 已提交
345
ohos_fuzztest("test_startup_SystemGetParameterValueFuzzTest") {
X
xionglei6 已提交
346 347
  module_out_path = module_output_path

X
xionglei6 已提交
348 349 350 351
  include_dirs = [
    "//base/startup/init_lite/services/include/param",
    "//base/startup/init_lite/test/fuzztest/utils/include",
  ]
X
xionglei6 已提交
352 353 354 355 356 357 358 359 360 361 362 363 364 365

  deps = [
    "//base/startup/init_lite/services/log:agent_log",
    "//base/startup/init_lite/services/param:param_client",
    "//third_party/bounds_checking_function:libsec_static",
  ]
  external_deps = [ "hiviewdfx_hilog_native:libhilog" ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
X
xionglei6 已提交
366
  sources = [ "test_startup_SystemGetParameterValue_fuzzer/test_startup_SystemGetParameterValue_fuzzer.cpp" ]
X
xionglei6 已提交
367 368 369 370

  defines = [ "STARTUP_INIT_TEST" ]
}

S
sunman4 已提交
371
ohos_fuzztest("test_startup_SystemSetParameterFuzzTest") {
X
xionglei6 已提交
372 373
  module_out_path = module_output_path

X
xionglei6 已提交
374 375 376 377
  include_dirs = [
    "//base/startup/init_lite/services/include/param",
    "//base/startup/init_lite/test/fuzztest/utils/include",
  ]
X
xionglei6 已提交
378 379 380 381 382 383 384 385 386 387 388 389 390 391

  deps = [
    "//base/startup/init_lite/services/log:agent_log",
    "//base/startup/init_lite/services/param:param_client",
    "//third_party/bounds_checking_function:libsec_static",
  ]
  external_deps = [ "hiviewdfx_hilog_native:libhilog" ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
X
xionglei6 已提交
392
  sources = [ "test_startup_SystemSetParameter_fuzzer/test_startup_SystemSetParameter_fuzzer.cpp" ]
X
xionglei6 已提交
393 394 395 396

  defines = [ "STARTUP_INIT_TEST" ]
}

S
sunman4 已提交
397
ohos_fuzztest("test_startup_SystemTraversalParameterFuzzTest") {
X
xionglei6 已提交
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420
  module_out_path = module_output_path

  include_dirs = [
    "//base/startup/init_lite/services/include/param",
    "//base/startup/init_lite/services/init/include",
    "//base/startup/init_lite/test/fuzztest/utils/include",
    "//third_party/bounds_checking_function/include",
  ]

  deps = [
    "//base/startup/init_lite/services/log:agent_log",
    "//base/startup/init_lite/services/param:param_client",
    "//base/startup/init_lite/test/fuzztest:libfuzz_utils",
    "//third_party/bounds_checking_function:libsec_static",
  ]
  external_deps = [ "hiviewdfx_hilog_native:libhilog" ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
X
xionglei6 已提交
421
  sources = [ "test_startup_SystemTraversalParameter_fuzzer/test_startup_SystemTraversalParameter_fuzzer.cpp" ]
X
xionglei6 已提交
422 423 424 425

  defines = [ "STARTUP_INIT_TEST" ]
}

X
xionglei6 已提交
426
ohos_fuzztest("test_startup_SystemWaitParameterFuzzTest") {
X
xionglei6 已提交
427 428
  module_out_path = module_output_path

X
xionglei6 已提交
429 430 431 432
  include_dirs = [
    "//base/startup/init_lite/services/include/param",
    "//base/startup/init_lite/test/fuzztest/utils/include",
  ]
X
xionglei6 已提交
433 434 435 436 437 438 439 440 441 442 443 444 445 446

  deps = [
    "//base/startup/init_lite/services/log:agent_log",
    "//base/startup/init_lite/services/param:param_client",
    "//third_party/bounds_checking_function:libsec_static",
  ]
  external_deps = [ "hiviewdfx_hilog_native:libhilog" ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
X
xionglei6 已提交
447
  sources = [ "test_startup_SystemWaitParameter_fuzzer/test_startup_SystemWaitParameter_fuzzer.cpp" ]
X
xionglei6 已提交
448 449 450 451

  defines = [ "STARTUP_INIT_TEST" ]
}

X
xionglei6 已提交
452
ohos_fuzztest("test_startup_SystemWatchParameterFuzzTest") {
X
xionglei6 已提交
453 454 455 456 457
  module_out_path = module_output_path

  include_dirs = [
    "//base/startup/init_lite/services/include/param",
    "//base/startup/init_lite/services/init/include",
X
xionglei6 已提交
458
    "//base/startup/init_lite/test/fuzztest/utils/include",
X
xionglei6 已提交
459 460 461 462 463
  ]

  deps = [
    "//base/startup/init_lite/services/log:agent_log",
    "//base/startup/init_lite/services/param:param_client",
H
handyohos 已提交
464
    "//base/startup/init_lite/services/param/watcher:param_watcheragent",
X
xionglei6 已提交
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481
    "//third_party/bounds_checking_function:libsec_static",
    "//utils/native/base:utils",
  ]

  external_deps = [
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "safwk:system_ability_fwk",
    "samgr_standard:samgr_proxy",
  ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
X
xionglei6 已提交
482
  sources = [ "test_startup_SystemWatchParameter_fuzzer/test_startup_SystemWatchParameter_fuzzer.cpp" ]
X
xionglei6 已提交
483 484 485 486

  defines = [ "STARTUP_INIT_TEST" ]
}

X
xionglei6 已提交
487
ohos_fuzztest("test_startup_UmountAllFstabFuzzTest") {
X
xionglei6 已提交
488 489 490 491 492 493 494 495
  module_out_path = module_output_path

  include_dirs = [
    "//base/startup/init_lite/interfaces/innerkits/include",
    "//base/startup/init_lite/test/fuzztest/utils/include",
  ]

  deps = [
X
xionglei6 已提交
496
    "//base/startup/init_lite/interfaces/innerkits:libfsmanager_static",
X
xionglei6 已提交
497 498 499 500 501 502 503 504 505 506 507 508
    "//base/startup/init_lite/services/log:init_log",
    "//base/startup/init_lite/services/utils:libinit_utils",
    "//base/startup/init_lite/test/fuzztest:libfuzz_utils",
    "//third_party/bounds_checking_function:libsec_static",
  ]

  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
X
xionglei6 已提交
509 510 511
  sources = [
    "test_startup_UmountAllFstab_fuzzer/test_startup_UmountAllFstab_fuzzer.cpp",
  ]
X
xionglei6 已提交
512 513 514 515 516 517 518 519 520 521

  defines = [ "STARTUP_INIT_TEST" ]
}

###############################################################################
group("fuzztest") {
  testonly = true
  deps = []
  deps += [
    # deps file
X
xionglei6 已提交
522 523 524 525 526 527 528 529 530 531 532 533 534
    ":test_startup_DoRebootFuzzTest",
    ":test_startup_GetControlFileFuzzTest",
    ":test_startup_GetControlSocketFuzzTest",
    ":test_startup_MountAllFstabFuzzTest",
    ":test_startup_ReadFileInDirFuzzTest",
    ":test_startup_ServiceControlStartFuzzTest",
    ":test_startup_ServiceControlStopFuzzTest",
    ":test_startup_SystemDumpParametersFuzzTest",
    ":test_startup_SystemFindParameterFuzzTest",
    ":test_startup_SystemGetParameterCommitIdFuzzTest",
    ":test_startup_SystemGetParameterFuzzTest",
    ":test_startup_SystemGetParameterNameFuzzTest",
    ":test_startup_SystemGetParameterValueFuzzTest",
S
sunman4 已提交
535 536
    ":test_startup_SystemSetParameterFuzzTest",
    ":test_startup_SystemTraversalParameterFuzzTest",
X
xionglei6 已提交
537 538 539
    ":test_startup_SystemWaitParameterFuzzTest",
    ":test_startup_SystemWatchParameterFuzzTest",
    ":test_startup_UmountAllFstabFuzzTest",
X
xionglei6 已提交
540 541 542
  ]
}
###############################################################################