Skip to content

Commit

Permalink
pw_presubmit: Add a 'host_clang_fuzz' step
Browse files Browse the repository at this point in the history
This CL adds three things:

* A 'pw_strict_host_clang_fuzz' toolchain based on
  `pw_toolchain_host_clang.fuzz`.
* A top-level `//:host_clang_fuzz` GN targets which builds
  `//:pigweed_defaults` with the above toolchain.
* A `gn_fuzz_build` presubmit step which builds the above target. This
  step is added to the `SECURITY` presubmit program.

As of this CL, this new step does not do much; it merely builds and runs
existing targets such as unit tests with additional fuzzer and ASan
instrumentation. Subsequent CLs will add FuzzTest and its dependencies
to allow `pw_fuzz_test`s to run in "unit test" mode, enabling bounded
fuzzing in presubmit.

Change-Id: I4f0786b49ebf9d9370277551af46033d3b01c1cf
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/143150
Commit-Queue: Aaron Green <[email protected]>
Reviewed-by: Rob Mohr <[email protected]>
  • Loading branch information
nopsledder authored and CQ Bot Account committed May 1, 2023
1 parent 5c4ea8e commit 34e5a1b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ _build_pigweed_default_at_all_optimization_levels("host_clang") {
toolchain_prefix = "$_internal_toolchains:pw_strict_host_clang_"
}

group("host_clang_fuzz") {
deps = [ ":pigweed_default($_internal_toolchains:pw_strict_host_clang_fuzz)" ]
}

# GCC is only supported for Windows. Pigweed doesn't yet provide a Windows
# clang toolchain, and Pigweed does not provide gcc toolchains for macOS and
# Linux.
Expand Down
7 changes: 7 additions & 0 deletions pw_presubmit/py/pw_presubmit/pigweed_presubmit.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,12 @@ def gn_arm_build(ctx: PresubmitContext):
ninja_targets=_at_all_optimization_levels(f'host_{_HOST_COMPILER}'),
)

gn_fuzz_build = build.GnGenNinja(
name='gn_fuzz_build',
path_filter=_BUILD_FILE_FILTER,
ninja_targets=('host_clang_fuzz',),
)

gn_docs_build = build.GnGenNinja(name='gn_docs_build', ninja_targets=('docs',))

gn_host_tools = build.GnGenNinja(
Expand Down Expand Up @@ -989,6 +995,7 @@ def owners_lint_checks(ctx: PresubmitContext):
# keep-sorted: start
gn_crypto_mbedtls_build,
gn_crypto_micro_ecc_build,
gn_fuzz_build,
gn_software_update_build,
# keep-sorted: end
)
Expand Down
12 changes: 12 additions & 0 deletions targets/host/target_toolchains.gni
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,18 @@ pw_internal_host_toolchains = [
default_configs += _internal_clang_default_configs
}
},
{
name = "pw_strict_host_clang_fuzz"
_toolchain_base = pw_toolchain_host_clang.fuzz
forward_variables_from(_toolchain_base, "*", _excluded_members)
defaults = {
forward_variables_from(_toolchain_base.defaults, "*")
forward_variables_from(_host_common, "*")
forward_variables_from(_pigweed_internal, "*")
forward_variables_from(_os_specific_config, "*")
default_configs += _internal_clang_default_configs
}
},
{
name = "pw_strict_host_gcc_debug"
_toolchain_base = pw_toolchain_host_gcc.debug
Expand Down

0 comments on commit 34e5a1b

Please sign in to comment.